From 792e537f2b17f25a887db48d683a733b27821d36 Mon Sep 17 00:00:00 2001 From: Sebastian Date: Thu, 25 Jun 2026 11:41:55 +0200 Subject: [PATCH] removed orbits unified ctrl/alt/shift modifiers for alle node types --- src/config-node.cpp | 4 +- src/graph-manager.cpp | 6 + src/graph-manager.h | 1 + src/interaction-manager.cpp | 4 +- src/midi-node.cpp | 341 ++++++++++++++++-------------------- src/midi-node.h | 16 +- src/modifier-node.cpp | 4 +- src/node.cpp | 9 + src/node.h | 1 + 9 files changed, 187 insertions(+), 199 deletions(-) diff --git a/src/config-node.cpp b/src/config-node.cpp index 5557bc5..6bcfbba 100644 --- a/src/config-node.cpp +++ b/src/config-node.cpp @@ -82,14 +82,14 @@ namespace VISEQ::GRAPH::NODES { void ConfigNode::update() { Node::update(); - mode = state->node_mode; + //mode = state->node_mode; } void ConfigNode::interact(){ float wheel = GetMouseWheelMove(); if(KEYS_DOWN.ctrl && !KEYS_DOWN.alt){ - switch(state->node_mode){ + switch(mode){ case 0:{ midiNote.note += KEYS_DOWN.shift ? ((wheel > 0) - (wheel < 0)) * 12 : wheel; break;} diff --git a/src/graph-manager.cpp b/src/graph-manager.cpp index 46c5c4b..68d1b49 100644 --- a/src/graph-manager.cpp +++ b/src/graph-manager.cpp @@ -147,6 +147,12 @@ namespace VISEQ::GRAPH{ } } + void GraphManager::cycleModeOfSelectedNodes(bool direction){ + for(auto n: selected_nodes){ + n->cycleMode(direction); + } + } + void GraphManager::reset(){ counter.clear(); } diff --git a/src/graph-manager.h b/src/graph-manager.h index 4e0c86d..1292080 100644 --- a/src/graph-manager.h +++ b/src/graph-manager.h @@ -56,6 +56,7 @@ namespace VISEQ::GRAPH { SPTR_Node copyNode(SPTR_Node n, Vec2Df position); SPTR_Node copyNode(std::shared_ptr n, Vec2Df position); void setNodeMode(int mode); + void cycleModeOfSelectedNodes(bool direction); void reset(); WPTR_Node getNode(int i); WPTR_Node getFirstNode(); diff --git a/src/interaction-manager.cpp b/src/interaction-manager.cpp index 9fd36a3..c2b73aa 100644 --- a/src/interaction-manager.cpp +++ b/src/interaction-manager.cpp @@ -26,11 +26,11 @@ namespace VISEQ::INTERACTION{ } if(!KEYS_DOWN.shift && IsKeyPressed(KEY_TAB)) { - state->node_mode = (state->node_mode + 1) % 7; + gm->cycleModeOfSelectedNodes(true); } if(KEYS_DOWN.shift && IsKeyPressed(KEY_TAB)) { - state->node_mode -= state->node_mode > 0 ? 1 : -6; + gm->cycleModeOfSelectedNodes(false); } } diff --git a/src/midi-node.cpp b/src/midi-node.cpp index e409552..6e40769 100644 --- a/src/midi-node.cpp +++ b/src/midi-node.cpp @@ -3,7 +3,7 @@ #include "config-node.h" #include "datatypes.h" #include "edge.h" -#include "node-handle.h" +#include "midi.h" #include "node.h" #include "raylib.h" #include "state.h" @@ -14,40 +14,10 @@ namespace VISEQ::GRAPH::NODES { void MidiNode::init(){ - float orbit_1 = radius + 25.0f; - float orbit_2 = orbit_1 + 20.0f; - float orbit_3 = orbit_2 + 20.0f; - float orbit_4 = orbit_3 + 20.0f; - float orbit_5 = orbit_4 + 30.0f; - midiNote.note = 64; midiNote.channel = 1; midiNote.gate = 250; midiNote.velocity = 64; - - midiHandles[NOTE].emplace_back(std::make_shared>(midiNote.note, position, VS_COLOR_GREEN, "NOTE", orbit_5, 12)); - midiHandles[NOTE].emplace_back(std::make_shared>(midiNote.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 16, 1, 16, 40, 150)); - midiHandles[NOTE].emplace_back(std::make_shared>(midiNote.gate, position, VS_COLOR_RED, "GATE", orbit_3, 30, 10, 30000, 40, 300)); - midiHandles[NOTE].back()->logScale = true; - midiHandles[NOTE].emplace_back(std::make_shared>(midiNote.velocity, position, VS_COLOR_PURPLE, "VELOCITY", orbit_4, 32)); - - midiHandles[CC].emplace_back(std::make_shared>(midiCC.control, position, VS_COLOR_SUN, "CONTROL", orbit_3, 32)); - midiHandles[CC].emplace_back(std::make_shared>(midiCC.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 1, 1, 16, 40, 150)); - midiHandles[CC].emplace_back(std::make_shared>(midiCC.value, position, VS_COLOR_GREEN, "VALUE", orbit_4, 32)); - - midiHandles[PC].emplace_back(std::make_shared>(midiPC.program, position, VS_COLOR_SUN, "PROGRAM", orbit_3, 32)); - midiHandles[PC].emplace_back(std::make_shared>(midiPC.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 1, 1, 16, 40, 150)); - midiHandles[PC].emplace_back(std::make_shared>(midiPC.value, position, VS_COLOR_GREEN, "VALUE", orbit_4, 32)); - - midiHandles[PB].emplace_back(std::make_shared>(midiPitchBend.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 1, 1, 16, 40, 150)); - midiHandles[PB].emplace_back(std::make_shared>(midiPitchBend.value, position, VS_COLOR_GREEN, "VALUE", orbit_3, 256, -8192, 8192, 40, 300)); - - midiHandles[AT].emplace_back(std::make_shared>(midiAftertouch.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 1, 1, 16, 40, 150)); - midiHandles[AT].emplace_back(std::make_shared>(midiAftertouch.value, position, VS_COLOR_GREEN, "VALUE", orbit_3, 32)); - - midiHandles[PP].emplace_back(std::make_shared>(midiPolyPressure.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 1, 1, 16, 40, 150)); - midiHandles[PP].emplace_back(std::make_shared>(midiPolyPressure.value, position, VS_COLOR_GREEN, "VALUE", orbit_4, 32)); - midiHandles[PP].emplace_back(std::make_shared>(midiPolyPressure.note, position, VS_COLOR_SUN, "NOTE", orbit_5, 12)); } std::shared_ptr MidiNode::getPtr(){ @@ -134,40 +104,49 @@ namespace VISEQ::GRAPH::NODES { void MidiNode::update() { Node::update(); - mode = state->node_mode; - for(auto mh : midiHandles[NOTE]){ - mh->update(position); - } - for(auto mh : midiHandles[CC]){ - mh->update(position); - } - for(auto mh : midiHandles[PC]){ - mh->update(position); - } - for(auto mh : midiHandles[PB]){ - mh->update(position); - } - for(auto mh : midiHandles[AT]){ - mh->update(position); - } - for(auto mh : midiHandles[PP]){ - mh->update(position); - } } - - void MidiNode::modMidiNote(int incr){ + + void MidiNode::modMidiChannel(int incr){ + + } + + void MidiNode::modMidiNoteValue(int incr){ midiNote.note += incr; if(midiNote.note < 0 ) midiNote.note = VISEQ::MIDI::Notes.size()-1; if(midiNote.note >= (int)VISEQ::MIDI::Notes.size()) midiNote.note = 0; } - void MidiNode::modMidiCC(int incr){ + void MidiNode::modMidiNoteVelocity(int incr){ + midiNote.velocity += incr; + if(midiNote.velocity < 0 ) midiNote.velocity = 127; + if(midiNote.velocity > 127 ) midiNote.velocity = 0; + } + + void MidiNode::modMidiNoteGate(int incr){ + midiNote.gate += incr; + if(midiNote.gate < 0 ) midiNote.gate = 0; + if(midiNote.gate > 20000) midiNote.gate = 20000; + } + + void MidiNode::modMidiCCValue(int incr){ + midiCC.value += incr; + if(midiCC.value < 0 ) midiCC.value = 127; + if(midiCC.value > 127 ) midiCC.value = 0; + } + + void MidiNode::modMidiCCControl(int incr){ midiCC.control += incr; if(midiCC.control < 0 ) midiCC.control = 127; if(midiCC.control > 127 ) midiCC.control = 0; } - void MidiNode::modMidiPC(int incr){ + void MidiNode::modMidiPCValue(int incr){ + midiPC.value += incr; + if(midiPC.value < 0 ) midiPC.value = 127; + if(midiPC.value > 127 ) midiPC.value = 0; + } + + void MidiNode::modMidiPCProgram(int incr){ midiPC.program += incr; if(midiPC.program < 0 ) midiPC.program = 127; if(midiPC.program > 127 ) midiPC.program = 0; @@ -185,88 +164,61 @@ namespace VISEQ::GRAPH::NODES { if(midiAftertouch.value > 127 ) midiAftertouch.value = 127; } - void MidiNode::modMidiPolyPressure(int incr){ + void MidiNode::modMidiPolyPressureValue(int incr){ midiPolyPressure.value += incr; if(midiPolyPressure.value < 0 ) midiPolyPressure.value = 0; - if(midiPolyPressure.value > 127 ) midiPolyPressure.value = 127; + if(midiPolyPressure.value > 16383 ) midiPolyPressure.value = 16383; + } + + void MidiNode::modMidiPolyPressureNote(int incr){ + midiPolyPressure.note += incr; + if(midiPolyPressure.note < 0 ) midiPolyPressure.note = VISEQ::MIDI::Notes.size()-1; + if(midiPolyPressure.note >= (int)VISEQ::MIDI::Notes.size()) midiPolyPressure.note = 0; } void MidiNode::interact(){ float wheel = GetMouseWheelMove(); - - if(KEYS_DOWN.ctrl && !KEYS_DOWN.alt){ - switch(state->node_mode){ - case 0:{ - modMidiNote(wheel); - break;} - case 1:{ - 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; - if(midiNote.velocity < 0 ) midiNote.velocity = 127; - if(midiNote.velocity > 127 ) midiNote.velocity = 0; - } else if(KEYS_DOWN.alt) { - switch(state->node_mode){ - case 0:{ - float incr = (float)wheel * (KEYS_DOWN.shift ? 100.0f : KEYS_DOWN.ctrl ? 1000.0f : 10.0f); - midiNote.gate += incr; - if(midiNote.gate < 0 ) midiNote.gate = 0; - break;} - case 1:{ - midiCC.value += wheel; - if(midiCC.value < 0 ) midiCC.value = 0; - 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;} - }; - } + + switch(mode){ + case NOTE:{ + 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) modMidiNoteGate(wheel*100); + if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiNoteGate(wheel*1000); + if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiNoteGate(wheel*10); + break;} + case CC:{ + if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiCCValue(wheel); + if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiCCControl(wheel); + break;} + case PC:{ + if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiPCValue(wheel); + if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiPCProgram(wheel); + break;} + case PB:{ + if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPitchBend(wheel*100); + if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPitchBend(wheel*1000); + if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPitchBend(wheel*10); + break;} + case AT:{ + if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiAftertouch(wheel*100); + if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiAftertouch(wheel*1000); + if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiAftertouch(wheel*10); + break;} + case PP:{ + if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiPolyPressureNote(wheel); + + if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPolyPressureValue(wheel*100); + if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPolyPressureValue(wheel*1000); + if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPolyPressureValue(wheel*10); + break;} + }; } void MidiNode::draw(Vec2Df mouse, Camera2D cam) { Node::draw(); - for(int i = 0; i < 6; ++i){ - for(auto mh : midiHandles[(Handles)i]){ - mh->lock(); - } - } - if(hovering() || selected) interact(); last = time; @@ -277,6 +229,27 @@ namespace VISEQ::GRAPH::NODES { } else { fade -= (time - last)*1000.0f; } + + switch((Handles)mode){ + case NOTE:{ + radius = (float)midiNote.velocity * 0.2f + 5.0f; + break;} + case CC:{ + radius = (float)midiCC.value * 0.2f + 5.0f; + break;} + case PC:{ + radius = (float)midiPC.program * 0.2f + 5.0f; + break;} + case PB:{ + radius = (float)midiPitchBend.value * 0.002f + 5.0f; + break;} + case AT:{ + radius = (float)midiAftertouch.value * 0.002f + 5.0f; + break;} + case PP:{ + radius = (float)midiPolyPressure.value * 0.002f + 5.0f; + break;} + } DrawRing(position, radius, radius + 4, 0, 360, 24, (Color){60, 60, 60, 255}); DrawRing(position, radius, radius + 4, 0.0f - 90.0f, (360.0f/127.0f) * getNotes().velocity - 90.0f, 24, (Color){158, 134, 200, 255}); @@ -292,45 +265,63 @@ namespace VISEQ::GRAPH::NODES { if(distributionMode == Distribution::ROUNDROBIN) DrawCircle(position.x, position.y, radius/2.0f, VS_COLOR_YELLOW); if(selected) DrawCircleLinesV(position, radius+8, (Color){158, 255, 210, 255}); - bool modified = false; - if(selected && mode >= 0 && mode < 6){ - for(auto mh : midiHandles[(Handles)mode]){ - mh->unlock(); - mh->draw(); - std::string text = ""; - if(mh->hovering() || mh->picked_up){ - text = std::format("{}", mh->assignedValueRef); - if(mh->name == "NOTE") text = MIDI::Notes[mh->assignedValueRef]; - if(mh->name == "GATE") text = std::format("{:.2f}", mh->assignedValueRef / 1000.0f); - if(mh->name == "VALUE" && (Handles)mode == PB) text = std::format("{}", round(((float)mh->assignedValueRef / 8192.0f) * 100)); - DrawCenteredText(text, position, 12, WHITE); - modified = true; - } - } - } - - if(!modified){ - switch((Handles)mode){ - case NOTE:{ - DrawCenteredText(MIDI::Notes[getNotes().note], position, 12, WHITE); - break;} - case CC:{ - DrawCenteredText(std::format("{}", getCC().value), position, 12, WHITE); - break;} - case PC:{ - DrawCenteredText(std::format("{}", getPC().value), position, 12, WHITE); - break;} - case PB:{ - DrawCenteredText(std::format("{}", round(((float)getPitchBend().value / 8192.0f) * 100)), position, 12, WHITE); - break;} - case AT:{ - DrawCenteredText(std::format("{}", getAftertouch().value), position, 12, WHITE); - break;} - case PP:{ - DrawCenteredText(std::format("{}", getPolyPressure().value), position, 12, WHITE); - break;} - } + + // TODO draw values of corresponding attribute when modifiers are pressed +// switch(mode){ +// case NOTE:{ +// if(!KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(MIDI::Notes[getNotes().note], position, 12, WHITE); +// if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiNoteVelocity(wheel); +// +// if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiNoteGate(wheel*100); +// if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiNoteGate(wheel*1000); +// if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiNoteGate(wheel*10); +// break;} +// case CC:{ +// if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiCCValue(wheel); +// if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiCCControl(wheel); +// break;} +// case PC:{ +// if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiPCValue(wheel); +// if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiPCProgram(wheel); +// break;} +// case PB:{ +// if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPitchBend(wheel*100); +// if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPitchBend(wheel*1000); +// if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPitchBend(wheel*10); +// break;} +// case AT:{ +// if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiAftertouch(wheel*100); +// if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiAftertouch(wheel*1000); +// if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiAftertouch(wheel*10); +// break;} +// case PP:{ +// if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiPolyPressureNote(wheel); +// +// if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPolyPressureValue(wheel*100); +// if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPolyPressureValue(wheel*1000); +// if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPolyPressureValue(wheel*10); +// break;} +// }; + switch(mode){ + case NOTE:{ + DrawCenteredText(MIDI::Notes[getNotes().note], position, 12, WHITE); + break;} + case CC:{ + DrawCenteredText(std::format("{}", getCC().value), position, 12, WHITE); + break;} + case PC:{ + DrawCenteredText(std::format("{}", getPC().value), position, 12, WHITE); + break;} + case PB:{ + DrawCenteredText(std::format("{}", round(((float)getPitchBend().value / 8192.0f) * 100)), position, 12, WHITE); + break;} + case AT:{ + DrawCenteredText(std::format("{}", getAftertouch().value), position, 12, WHITE); + break;} + case PP:{ + DrawCenteredText(std::format("{}", getPolyPressure().value), position, 12, WHITE); + break;} } if(highlighted) DrawCircleLinesV(position, radius+2, (Color){255, 0, 0, 200}); @@ -340,15 +331,6 @@ namespace VISEQ::GRAPH::NODES { std::vector conns; std::ranges::transform(N.connections.begin(), N.connections.end(), std::back_inserter(conns), [](VISEQ::GRAPH::EDGES::SPTR_Edge e){ return e->id;}); - std::vector> handles; - - for(auto i : N.midiHandles){ - handles.emplace_back(); - for(auto n : i.second){ - handles.at(i.first).push_back(n->position); - } - } - j = json{ {"id", N.id}, {"position", N.position}, @@ -360,7 +342,6 @@ namespace VISEQ::GRAPH::NODES { {"midiPitchBend", N.midiPitchBend}, {"midiAftertouch", N.midiAftertouch}, {"midiPolyPressure", N.midiPolyPressure}, - {"handles", handles}, {"connections",conns}}; } @@ -378,20 +359,6 @@ namespace VISEQ::GRAPH::NODES { j.at("midiPitchBend").get_to(N.midiPitchBend); j.at("midiAftertouch").get_to(N.midiAftertouch); j.at("midiPolyPressure").get_to(N.midiPolyPressure); - - std::vector> handles; - - j.at("handles").get_to(handles); - - int i = 0; - for(auto n : handles){ - int j = 0; - for(auto nn : n){ - N.midiHandles[(Handles)i][j]->position = nn; - j++; - } - i++; - } } void to_json(json& j, const std::shared_ptr& N){ diff --git a/src/midi-node.h b/src/midi-node.h index a724f44..9ec3238 100644 --- a/src/midi-node.h +++ b/src/midi-node.h @@ -27,8 +27,6 @@ namespace VISEQ::GRAPH::NODES { MIDI::MidiAftertouch midiAftertouch; MIDI::MidiPolyPressure midiPolyPressure; - std::map>>> midiHandles; - public: struct NodeMidiOut{ @@ -77,12 +75,18 @@ namespace VISEQ::GRAPH::NODES { MIDI::MidiPolyPressure getPolyPressure() const ; std::vector> getConnectedConfigNodes() const ; void update() override ; - void modMidiNote(int incr); - void modMidiCC(int incr); - void modMidiPC(int incr); + void modMidiChannel(int incr); + void modMidiNoteValue(int incr); + void modMidiNoteVelocity(int incr); + void modMidiNoteGate(int incr); + void modMidiCCValue(int incr); + void modMidiCCControl(int incr); + void modMidiPCValue(int incr); + void modMidiPCProgram(int incr); void modMidiPitchBend(int incr); void modMidiAftertouch(int incr); - void modMidiPolyPressure(int incr); + void modMidiPolyPressureValue(int incr); + void modMidiPolyPressureNote(int incr); void interact(); void draw(Vec2Df mouse, Camera2D cam) override ; diff --git a/src/modifier-node.cpp b/src/modifier-node.cpp index 87c0234..ee58694 100644 --- a/src/modifier-node.cpp +++ b/src/modifier-node.cpp @@ -85,14 +85,14 @@ namespace VISEQ::GRAPH::NODES { void ModNode::update() { Node::update(); - mode = state->node_mode; + //mode = state->node_mode; } void ModNode::interact(){ float wheel = GetMouseWheelMove(); if(KEYS_DOWN.ctrl && !KEYS_DOWN.alt){ - switch(state->node_mode){ + switch(mode){ case 0:{ midiNote.note += KEYS_DOWN.shift ? ((wheel > 0) - (wheel < 0)) * 12 : wheel; break;} diff --git a/src/node.cpp b/src/node.cpp index 54b686a..e01cae4 100644 --- a/src/node.cpp +++ b/src/node.cpp @@ -73,6 +73,15 @@ namespace VISEQ::GRAPH::NODES { } } + void Node::cycleMode(bool direction){ + if(direction){ + mode = (mode + 1) % 7; + } else { + mode -= mode > 0 ? 1 : -6; + } + std::cout << "mode changed to: " << mode << std::endl; + } + void to_json(json& j, const Node& N){ if(N.getNodeType() == NodeType::MIDINODE){ j = dynamic_cast(N); diff --git a/src/node.h b/src/node.h index 5693408..55502b4 100644 --- a/src/node.h +++ b/src/node.h @@ -52,6 +52,7 @@ namespace VISEQ::GRAPH::NODES { void update() override; void draw(Vec2Df mp, Camera2D cam) override; void draw() override; + virtual void cycleMode(bool direction); friend void to_json(json& j, const Node& N); friend void from_json(const json& j, Node& N);