removed orbits unified ctrl/alt/shift modifiers for alle node types

This commit is contained in:
Sebastian
2026-06-25 11:41:55 +02:00
parent 5c433111e2
commit 792e537f2b
9 changed files with 187 additions and 199 deletions
+2 -2
View File
@@ -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;}
+6
View File
@@ -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();
}
+1
View File
@@ -56,6 +56,7 @@ namespace VISEQ::GRAPH {
SPTR_Node copyNode(SPTR_Node n, Vec2Df position);
SPTR_Node copyNode(std::shared_ptr<MidiNode> n, Vec2Df position);
void setNodeMode(int mode);
void cycleModeOfSelectedNodes(bool direction);
void reset();
WPTR_Node getNode(int i);
WPTR_Node getFirstNode();
+2 -2
View File
@@ -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);
}
}
+154 -187
View File
@@ -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<NodeHandle<int>>(midiNote.note, position, VS_COLOR_GREEN, "NOTE", orbit_5, 12));
midiHandles[NOTE].emplace_back(std::make_shared<NodeHandle<int>>(midiNote.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 16, 1, 16, 40, 150));
midiHandles[NOTE].emplace_back(std::make_shared<NodeHandle<int>>(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<NodeHandle<int>>(midiNote.velocity, position, VS_COLOR_PURPLE, "VELOCITY", orbit_4, 32));
midiHandles[CC].emplace_back(std::make_shared<NodeHandle<int>>(midiCC.control, position, VS_COLOR_SUN, "CONTROL", orbit_3, 32));
midiHandles[CC].emplace_back(std::make_shared<NodeHandle<int>>(midiCC.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 1, 1, 16, 40, 150));
midiHandles[CC].emplace_back(std::make_shared<NodeHandle<int>>(midiCC.value, position, VS_COLOR_GREEN, "VALUE", orbit_4, 32));
midiHandles[PC].emplace_back(std::make_shared<NodeHandle<int>>(midiPC.program, position, VS_COLOR_SUN, "PROGRAM", orbit_3, 32));
midiHandles[PC].emplace_back(std::make_shared<NodeHandle<int>>(midiPC.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 1, 1, 16, 40, 150));
midiHandles[PC].emplace_back(std::make_shared<NodeHandle<int>>(midiPC.value, position, VS_COLOR_GREEN, "VALUE", orbit_4, 32));
midiHandles[PB].emplace_back(std::make_shared<NodeHandle<int>>(midiPitchBend.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 1, 1, 16, 40, 150));
midiHandles[PB].emplace_back(std::make_shared<NodeHandle<int>>(midiPitchBend.value, position, VS_COLOR_GREEN, "VALUE", orbit_3, 256, -8192, 8192, 40, 300));
midiHandles[AT].emplace_back(std::make_shared<NodeHandle<int>>(midiAftertouch.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 1, 1, 16, 40, 150));
midiHandles[AT].emplace_back(std::make_shared<NodeHandle<int>>(midiAftertouch.value, position, VS_COLOR_GREEN, "VALUE", orbit_3, 32));
midiHandles[PP].emplace_back(std::make_shared<NodeHandle<int>>(midiPolyPressure.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 1, 1, 16, 40, 150));
midiHandles[PP].emplace_back(std::make_shared<NodeHandle<int>>(midiPolyPressure.value, position, VS_COLOR_GREEN, "VALUE", orbit_4, 32));
midiHandles[PP].emplace_back(std::make_shared<NodeHandle<int>>(midiPolyPressure.note, position, VS_COLOR_SUN, "NOTE", orbit_5, 12));
}
std::shared_ptr<MidiNode> 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<int> 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<std::vector<Vec2Df>> 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<std::vector<Vec2Df>> 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<MidiNode>& N){
+10 -6
View File
@@ -27,8 +27,6 @@ namespace VISEQ::GRAPH::NODES {
MIDI::MidiAftertouch midiAftertouch;
MIDI::MidiPolyPressure midiPolyPressure;
std::map<Handles, std::vector<std::shared_ptr<NodeHandle<int>>>> midiHandles;
public:
struct NodeMidiOut{
@@ -77,12 +75,18 @@ namespace VISEQ::GRAPH::NODES {
MIDI::MidiPolyPressure getPolyPressure() const ;
std::vector<std::weak_ptr<ConfigNode>> 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 ;
+2 -2
View File
@@ -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;}
+9
View File
@@ -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<const MidiNode&>(N);
+1
View File
@@ -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);