modifier chains added

This commit is contained in:
Sebastian
2026-07-17 00:13:01 +02:00
parent 0be3d6cd77
commit 183d89ceaf
4 changed files with 92 additions and 51 deletions
+5 -2
View File
@@ -368,8 +368,11 @@ namespace VISEQ::GRAPH{
float v1_v2_distance = v1_position.dist(&v2_position); float v1_v2_distance = v1_position.dist(&v2_position);
if(v1_v2_distance < 100) c->switches_offset = v1_v2_distance/2.3f; if(v1_v2_distance < 100) c->switches_offset = v1_v2_distance/2.3f;
Vec2Df from_to_handle = c->start.lock()->position - ((c->start.lock()->position - c->end.lock()->position)).norm()*45.0f; float from_radius = c->start.lock()->radius;
Vec2Df to_from_handle = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position)).norm()*45.0f; float to_radius = c->end.lock()->radius;
Vec2Df from_to_handle = c->start.lock()->position - ((c->start.lock()->position - c->end.lock()->position)).norm() * (from_radius + 35.0f);
Vec2Df to_from_handle = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position)).norm() * (to_radius + 35.0f);
//Vec2Df middle_handle_2 = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position)).norm()*65.0f; //Vec2Df middle_handle_2 = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position)).norm()*65.0f;
//Vec2Df middle_handle = c->start.lock()->position - ((c->start.lock()->position - c->end.lock()->position)).norm()*65.0f; //Vec2Df middle_handle = c->start.lock()->position - ((c->start.lock()->position - c->end.lock()->position)).norm()*65.0f;
Vec2Df center_handle = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position))*0.5f; Vec2Df center_handle = c->end.lock()->position - ((c->end.lock()->position - c->start.lock()->position))*0.5f;
+52 -49
View File
@@ -181,6 +181,9 @@ namespace VISEQ::GRAPH::NODES {
switch(mode){ switch(mode){
case NOTE:{ case NOTE:{
if(state->isModChain(APP::CTRL, APP::SHIFT, APP::ALT)){
std::cout << "yeah" << std::endl;
}
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiNoteValue(wheel); if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiNoteValue(wheel);
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiNoteVelocity(wheel); if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiNoteVelocity(wheel);
@@ -236,22 +239,22 @@ namespace VISEQ::GRAPH::NODES {
switch((Handles)mode){ switch((Handles)mode){
case NOTE:{ case NOTE:{
radius = (float)midiNote.velocity * 0.2f + 5.0f; radius = (float)midiNote.velocity * 0.2f + 15.0f;
break;} break;}
case CC:{ case CC:{
radius = (float)midiCC.value * 0.2f + 5.0f; radius = (float)midiCC.value * 0.2f + 15.0f;
break;} break;}
case PC:{ case PC:{
radius = (float)midiPC.value * 0.2f + 5.0f; radius = (float)midiPC.value * 0.2f + 15.0f;
break;} break;}
case PB:{ case PB:{
radius = (float)midiPitchBend.value * 0.002f + 5.0f; radius = (float)midiPitchBend.value * 0.002f + 15.0f;
break;} break;}
case AT:{ case AT:{
radius = (float)midiAftertouch.value * 0.002f + 5.0f; radius = (float)midiAftertouch.value * 0.002f + 15.0f;
break;} break;}
case PP:{ case PP:{
radius = (float)midiPolyPressure.value * 0.002f + 5.0f; radius = (float)midiPolyPressure.value * 0.002f + 15.0f;
break;} break;}
} }
@@ -274,74 +277,74 @@ namespace VISEQ::GRAPH::NODES {
VMATH::Vec2D<float> desc_position = position + VMATH::Vec2D<float>(radius + 7.0f, radius + 7.0f); VMATH::Vec2D<float> desc_position = position + VMATH::Vec2D<float>(radius + 7.0f, radius + 7.0f);
switch(mode){ switch(mode){
case NOTE:{ case NOTE:{
if(!KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(MIDI::Notes[getNotes().note], position, 14, VS_COLOR_BLACK); if(!KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(MIDI::Notes[getNotes().note], position, 14, VS_COLOR_DARKGREY);
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getNotes().velocity), position, 12, VS_COLOR_BLACK); if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getNotes().velocity), position, 12, VS_COLOR_WHITE);
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{:.1f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_BLACK); if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{:.1f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{:.2f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_BLACK); if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{:.2f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_WHITE);
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{:.2f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_BLACK); if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{:.2f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{:.3f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_BLACK); if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{:.3f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_WHITE);
if(selected){ if(selected){
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("NOTE", desc_position, 8, VS_COLOR_BLACK); if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("NOTE", desc_position, 8, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("VALUE", desc_position, 8, VS_COLOR_BLACK); if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("VALUE", desc_position, 8, VS_COLOR_WHITE);
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("VELOCITY", desc_position, 8, VS_COLOR_BLACK); if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("VELOCITY", desc_position, 8, VS_COLOR_WHITE);
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("GATE 0.1s", desc_position, 8, VS_COLOR_BLACK); if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("GATE 0.1s", desc_position, 8, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("GATE 1.0s", desc_position, 8, VS_COLOR_BLACK); if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("GATE 1.0s", desc_position, 8, VS_COLOR_WHITE);
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("GATE 0.01s", desc_position, 8, VS_COLOR_BLACK); if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("GATE 0.01s", desc_position, 8, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("GATE 0.001s", desc_position, 8, VS_COLOR_BLACK); if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("GATE 0.001s", desc_position, 8, VS_COLOR_WHITE);
} }
break;} break;}
case CC:{ case CC:{
if(!KEYS_DOWN.shift) DrawCenteredText(std::format("{}", getCC().value), position, 12, WHITE); if(!KEYS_DOWN.shift) DrawCenteredText(std::format("{}", getCC().value), position, 12, VS_COLOR_DARKGREY);
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getCC().control), position, 12, BLACK); if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getCC().control), position, 12, VS_COLOR_WHITE);
if(selected){ if(selected){
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("CC", desc_position, 8, WHITE); if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("CC", desc_position, 8, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("VALUE", desc_position, 8, WHITE); if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("VALUE", desc_position, 8, VS_COLOR_WHITE);
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("CONTROL", desc_position, 8, WHITE); if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("CONTROL", desc_position, 8, VS_COLOR_WHITE);
} }
break;} break;}
case PC:{ case PC:{
if(!KEYS_DOWN.shift) DrawCenteredText(std::format("{}", getPC().value), position, 12, WHITE); if(!KEYS_DOWN.shift) DrawCenteredText(std::format("{}", getPC().value), position, 12, VS_COLOR_DARKGREY);
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getPC().program), position, 12, BLACK); if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getPC().program), position, 12, VS_COLOR_WHITE);
if(selected){ if(selected){
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("PROGRAM CHANGE", desc_position, 8, WHITE); if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("PROGRAM CHANGE", desc_position, 8, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("VALUE", desc_position, 8, WHITE); if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("VALUE", desc_position, 8, VS_COLOR_WHITE);
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("PROGRAM", desc_position, 8, WHITE); if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("PROGRAM", desc_position, 8, VS_COLOR_WHITE);
} }
break;} break;}
case PB:{ case PB:{
DrawCenteredText(std::format("{}", getPitchBend().value), position, 10, WHITE); DrawCenteredText(std::format("{}", getPitchBend().value), position, 10, VS_COLOR_DARKGREY);
if(selected){ if(selected){
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("PITCHBEND", desc_position, 8, WHITE); if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("PITCHBEND", desc_position, 8, VS_COLOR_WHITE);
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("64", desc_position, 8, WHITE); if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("64", desc_position, 8, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("2048", desc_position, 8, WHITE); if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("2048", desc_position, 8, VS_COLOR_WHITE);
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("256", desc_position, 8, WHITE); if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("256", desc_position, 8, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("1", desc_position, 8, WHITE); if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("1", desc_position, 8, VS_COLOR_WHITE);
} }
break;} break;}
case AT:{ case AT:{
DrawCenteredText(std::format("{}", getAftertouch().value), position, 12, WHITE); DrawCenteredText(std::format("{}", getAftertouch().value), position, 12, VS_COLOR_DARKGREY);
if(selected){ if(selected){
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("AFTERTOUCH", desc_position, 8, WHITE); if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("AFTERTOUCH", desc_position, 8, VS_COLOR_WHITE);
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("10", desc_position, 8, WHITE); if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("10", desc_position, 8, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("100", desc_position, 8, WHITE); if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("100", desc_position, 8, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("1", desc_position, 8, WHITE); if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("1", desc_position, 8, VS_COLOR_WHITE);
} }
break;} break;}
case PP:{ case PP:{
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(MIDI::Notes[getPolyPressure().note], position, 12, WHITE); if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(MIDI::Notes[getPolyPressure().note], position, 12, VS_COLOR_DARKGREY);
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getPolyPressure().value), position, 12, WHITE); if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getPolyPressure().value), position, 12, VS_COLOR_DARKGREY);
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getPolyPressure().value), position, 12, WHITE); if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getPolyPressure().value), position, 12, VS_COLOR_DARKGREY);
if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getPolyPressure().value), position, 12, WHITE); if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getPolyPressure().value), position, 12, VS_COLOR_DARKGREY);
if(selected){ if(selected){
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("POLYPRESSURE", desc_position, 8, WHITE); if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("POLYPRESSURE", desc_position, 8, VS_COLOR_WHITE);
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("64", desc_position, 8, WHITE); if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("64", desc_position, 8, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("2048", desc_position, 8, WHITE); if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("2048", desc_position, 8, VS_COLOR_WHITE);
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("256", desc_position, 8, WHITE); if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("256", desc_position, 8, VS_COLOR_WHITE);
if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("1", desc_position, 8, WHITE); if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("1", desc_position, 8, VS_COLOR_WHITE);
} }
break;} break;}
}; };
+27
View File
@@ -54,6 +54,21 @@ namespace VISEQ::APP{
keys_released.shift = IsKeyReleased(KEY_LEFT_SHIFT) || IsKeyReleased(KEY_RIGHT_SHIFT); keys_released.shift = IsKeyReleased(KEY_LEFT_SHIFT) || IsKeyReleased(KEY_RIGHT_SHIFT);
keys_released.alt = IsKeyReleased(KEY_LEFT_ALT) || IsKeyReleased(KEY_RIGHT_ALT); keys_released.alt = IsKeyReleased(KEY_LEFT_ALT) || IsKeyReleased(KEY_RIGHT_ALT);
int n_modifier = keys_down.alt + keys_down.ctrl + keys_down.shift;
if(modifier_chain.size() < n_modifier){
ModifierKeyNames modKey = keys_pressed.ctrl ? CTRL : keys_pressed.shift ? SHIFT : ALT;
modifier_chain.push_back(modKey);
std::cout << modifier_chain.size() << " " << modKey << std::endl;
}
if(modifier_chain.size() > n_modifier){
ModifierKeyNames modKey = !keys_released.ctrl ? CTRL : !keys_released.shift ? SHIFT : ALT;
auto it = std::remove(modifier_chain.begin(), modifier_chain.end(), modKey);
modifier_chain.erase(it);
std::cout << modifier_chain.size() << " " << modKey << std::endl;
}
screen_mouse = {round(mouse_pos.x), round(mouse_pos.y)}; screen_mouse = {round(mouse_pos.x), round(mouse_pos.y)};
raw_mouse = {GetMousePosition().x, GetMousePosition().y}; raw_mouse = {GetMousePosition().x, GetMousePosition().y};
mod_mouse = {round(mouse_pos.x), round(mouse_pos.y)}; mod_mouse = {round(mouse_pos.x), round(mouse_pos.y)};
@@ -73,4 +88,16 @@ namespace VISEQ::APP{
} }
return State::instance; return State::instance;
} }
bool State::isModChain(ModifierKeyNames first){
return modifier_chain == std::vector<ModifierKeyNames>{first};
}
bool State::isModChain(ModifierKeyNames first, ModifierKeyNames second){
return modifier_chain == std::vector<ModifierKeyNames>{first, second};
}
bool State::isModChain(ModifierKeyNames first, ModifierKeyNames second, ModifierKeyNames third){
return modifier_chain == std::vector<ModifierKeyNames>{first, second, third};
}
} }
+8
View File
@@ -49,6 +49,8 @@ namespace VISEQ::APP{
bool alt = false; bool alt = false;
}; };
enum ModifierKeyNames {CTRL, SHIFT, ALT};
class State{ class State{
public: public:
State(){} State(){}
@@ -80,6 +82,8 @@ namespace VISEQ::APP{
ModifierKeys keys_pressed; ModifierKeys keys_pressed;
ModifierKeys keys_released; ModifierKeys keys_released;
std::vector<ModifierKeyNames> modifier_chain;
Rectangle selection; Rectangle selection;
Rectangle bounding_box; Rectangle bounding_box;
@@ -97,6 +101,10 @@ namespace VISEQ::APP{
static std::shared_ptr<State> get(); static std::shared_ptr<State> get();
std::deque<InteractionEvent> event_queue; std::deque<InteractionEvent> event_queue;
bool isModChain(ModifierKeyNames first);
bool isModChain(ModifierKeyNames first, ModifierKeyNames second);
bool isModChain(ModifierKeyNames first, ModifierKeyNames second, ModifierKeyNames third);
}; };
} }