Fun with config nodes that modifiy other config nodes. Circular connections lead to a crash.
This commit is contained in:
+51
-7
@@ -23,10 +23,10 @@ namespace VISEQ::GRAPH::NODES {
|
||||
private:
|
||||
MIDI::MidiNote midiNote;
|
||||
MIDI::MidiCC midiCC;
|
||||
MIDI::MidiPC midiPC;
|
||||
MIDI::MidiPitchBend midiPitchBend;
|
||||
MIDI::MidiAftertouch midiAftertouch;
|
||||
MIDI::MidiPolyPressure midiPolyPressure;
|
||||
MIDI::MidiPC midiPC;
|
||||
|
||||
std::vector<APP::UI::ButtonRound> channelButtons;
|
||||
|
||||
@@ -166,11 +166,29 @@ namespace VISEQ::GRAPH::NODES {
|
||||
if(midiCC.control > 127 ) midiCC.control = 0;
|
||||
}
|
||||
|
||||
void modMidiPC(int incr){
|
||||
midiPC.program += incr;
|
||||
if(midiPC.program < 0 ) midiPC.program = 127;
|
||||
if(midiPC.program > 127 ) midiPC.program = 0;
|
||||
}
|
||||
|
||||
void modMidiPitchBend(int incr){
|
||||
midiPitchBend.value += incr;
|
||||
if(midiPitchBend.value < 0 ) midiPitchBend.value = 0;
|
||||
if(midiPitchBend.value > 16383 ) midiPitchBend.value = 16383;
|
||||
}
|
||||
|
||||
void modMidiAftertouch(int incr){
|
||||
midiAftertouch.value += incr;
|
||||
if(midiAftertouch.value < 0 ) midiAftertouch.value = 0;
|
||||
if(midiAftertouch.value > 127 ) midiAftertouch.value = 127;
|
||||
}
|
||||
|
||||
void modMidiPolyPressure(int incr){
|
||||
midiPolyPressure.value += incr;
|
||||
if(midiPolyPressure.value < 0 ) midiPolyPressure.value = 0;
|
||||
if(midiPolyPressure.value > 127 ) midiPolyPressure.value = 127;
|
||||
}
|
||||
|
||||
void interact(){
|
||||
float wheel = GetMouseWheelMove();
|
||||
@@ -184,8 +202,17 @@ namespace VISEQ::GRAPH::NODES {
|
||||
modMidiCC(wheel);
|
||||
break;}
|
||||
case 2:{
|
||||
modMidiPC(wheel);
|
||||
break;}
|
||||
case 3:{
|
||||
modMidiPitchBend(wheel);
|
||||
break;}
|
||||
case 4:{
|
||||
modMidiAftertouch(wheel);
|
||||
break;}
|
||||
case 5:{
|
||||
modMidiPolyPressure(wheel);
|
||||
break;}
|
||||
};
|
||||
} else if(KEYS_DOWN.shift && !KEYS_DOWN.alt) {
|
||||
midiNote.velocity += wheel;
|
||||
@@ -204,11 +231,28 @@ namespace VISEQ::GRAPH::NODES {
|
||||
if(midiCC.value > 127 ) midiCC.value = 127;
|
||||
break;}
|
||||
case 2:{
|
||||
midiPC.value += wheel;
|
||||
if(midiPC.value < 0 ) midiPC.value = 0;
|
||||
if(midiPC.value > 127 ) midiPC.value = 127;
|
||||
break;}
|
||||
case 3:{
|
||||
float incr = (float)wheel * (KEYS_DOWN.shift ? 100.0f : KEYS_DOWN.ctrl ? 1000.0f : 10.0f);
|
||||
midiPitchBend.value += incr;
|
||||
if(midiPitchBend.value < 0 ) midiPitchBend.value = 0;
|
||||
if(midiPitchBend.value > 16383 ) midiPitchBend.value = 16383;
|
||||
break;}
|
||||
case 4:{
|
||||
float incr = (float)wheel * (KEYS_DOWN.shift ? 100.0f : KEYS_DOWN.ctrl ? 1000.0f : 10.0f);
|
||||
midiAftertouch.value += incr;
|
||||
if(midiAftertouch.value < 0 ) midiAftertouch.value = 0;
|
||||
if(midiAftertouch.value > 127 ) midiAftertouch.value = 127;
|
||||
break;}
|
||||
case 5:{
|
||||
float incr = (float)wheel * (KEYS_DOWN.shift ? 100.0f : KEYS_DOWN.ctrl ? 1000.0f : 10.0f);
|
||||
midiPolyPressure.value += incr;
|
||||
if(midiPolyPressure.value < 0 ) midiPolyPressure.value = 0;
|
||||
if(midiPolyPressure.value > 127 ) midiPolyPressure.value = 127;
|
||||
break;}
|
||||
};
|
||||
}
|
||||
}
|
||||
@@ -285,32 +329,32 @@ namespace VISEQ::GRAPH::NODES {
|
||||
case 0:
|
||||
value = (float)getNotes().gate/1000.0f;
|
||||
offset_gate = MeasureText(std::format("{:.2f}", value).c_str(), 12);
|
||||
DrawText(std::format("{:.2f}",value).c_str(), position.x-offset_gate/2.0f, position.y-5, 12, WHITE );
|
||||
DrawText(std::format("{:.2f}",value).c_str(), position.x-offset_gate/2.0f, position.y-5, 12, VS_COLOR_BLACK );
|
||||
break;
|
||||
case 1:
|
||||
value = (float)getCC().value;
|
||||
offset_gate = MeasureText(std::format("{}", value).c_str(), 12);
|
||||
DrawText(std::format("{}",value).c_str(), position.x-offset_gate/2.0f, position.y-5, 12, WHITE );
|
||||
DrawText(std::format("{}",value).c_str(), position.x-offset_gate/2.0f, position.y-5, 12, VS_COLOR_BLACK );
|
||||
break;
|
||||
case 2:
|
||||
value = (float)getPitchBend().value;
|
||||
offset_gate = MeasureText(std::format("{}", value).c_str(), 12);
|
||||
DrawText(std::format("{}",value).c_str(), position.x-offset_gate/2.0f, position.y-5, 12, WHITE );
|
||||
DrawText(std::format("{}",value).c_str(), position.x-offset_gate/2.0f, position.y-5, 12, VS_COLOR_BLACK );
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
switch(mode){
|
||||
case 0:{
|
||||
int offset = MeasureText(MIDI::Notes[(int)getNotes().note].c_str(), 12);
|
||||
DrawText(MIDI::Notes[getNotes().note].c_str(), position.x-offset/2.0f, position.y-5, 12, WHITE );
|
||||
DrawText(MIDI::Notes[getNotes().note].c_str(), position.x-offset/2.0f, position.y-5, 12, VS_COLOR_BLACK );
|
||||
break;}
|
||||
case 1:{
|
||||
int offset = MeasureText(std::format("{}", getCC().control).c_str(), 12);
|
||||
DrawText(std::format("{}", getCC().control).c_str(), position.x-offset/2.0f, position.y-5, 12, WHITE );
|
||||
DrawText(std::format("{}", getCC().control).c_str(), position.x-offset/2.0f, position.y-5, 12, VS_COLOR_BLACK );
|
||||
break;}
|
||||
case 2:{
|
||||
int offset = MeasureText(std::format("{}", getPitchBend().value).c_str(), 12);
|
||||
DrawText(std::format("{}", getPitchBend().value).c_str(), position.x-offset/2.0f, position.y-5, 12, WHITE );
|
||||
DrawText(std::format("{}", getPitchBend().value).c_str(), position.x-offset/2.0f, position.y-5, 12, VS_COLOR_BLACK );
|
||||
break;}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user