Config nodes do what they should do now. UX is still off, modifier keys do different things on MidiNodes and ConfigNodes.

This commit is contained in:
Sebastian
2024-12-08 14:21:46 +01:00
parent 558829f619
commit 3b08037f92
8 changed files with 106 additions and 131 deletions
+7 -23
View File
@@ -34,7 +34,7 @@ namespace VISEQ::GRAPH::NODES {
bool enabled;
};
MidiNode() : Node() {std::cout << "MidiNode Constructor std" << std::endl;}
MidiNode() {std::cout << "MidiNode Constructor std" << std::endl;}
MidiNode(Vec2Df position) : Node(position) {}
NodeType nodeType = NodeType::MIDINODE;
@@ -53,10 +53,6 @@ namespace VISEQ::GRAPH::NODES {
bool gui_midi_velocity_edit = false;
bool gui_midi_gate_edit = false;
bool triggered = false;
int mode = 0;
float start = 0;
float fade = 0;
float time = 0;
@@ -75,23 +71,18 @@ namespace VISEQ::GRAPH::NODES {
void trigger() override {
triggered = true;
start = GetTime();
fade = midiNote.gate;
fade = getNotes().gate;
}
void SMode(int _mode) override{
void setMode(int _mode) override {
mode = _mode;
}
int GGate(){
return midiNote.gate;
}
MIDI::MidiNote getNotes() const {
MIDI::MidiNote cNote;
for(auto cn : getConnectedConfigNodes()){
cNote += cn.lock()->getNotes();
}
std::cout << cNote.note << std::endl;
return midiNote + cNote;
}
@@ -142,6 +133,7 @@ namespace VISEQ::GRAPH::NODES {
if(e->start.lock()->getNodeType() == NodeType::CONFIGNODE) config_nodes.push_back(std::dynamic_pointer_cast<ConfigNode>(e->start.lock()));
if(e->end.lock()->getNodeType() == NodeType::CONFIGNODE) config_nodes.push_back(std::dynamic_pointer_cast<ConfigNode>(e->end.lock()));
}
/*std::cout << "id: " << id << " n cn: " << config_nodes.size() << std::endl;*/
return config_nodes;
}
@@ -150,14 +142,6 @@ namespace VISEQ::GRAPH::NODES {
mode = state->node_mode;
}
int getMidiNote(){
int mod_notes = 0;
for(auto cn : getConnectedConfigNodes()){
mod_notes += cn.lock()->midiNote.note;
}
return midiNote.note + mod_notes;
}
void modMidiNote(int incr){
midiNote.note += incr;
if(midiNote.note < 0 ) midiNote.note = VISEQ::MIDI::Notes.size()-1;
@@ -223,7 +207,7 @@ namespace VISEQ::GRAPH::NODES {
last = time;
time = GetTime();
if(time - start >= (float)midiNote.gate / 1000.0f){
if(time - start >= (float)getNotes().gate / 1000.0f){
triggered = false;
fade = 0;
} else {
@@ -231,10 +215,10 @@ namespace VISEQ::GRAPH::NODES {
}
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) * midiNote.velocity - 90.0f, 24, (Color){158, 134, 200, 255});
DrawRing(position, radius, radius+4, 0.0f - 90.0f, (360.0f/127.0f) * getNotes().velocity - 90.0f, 24, (Color){158, 134, 200, 255});
DrawCircleLinesV(position, radius + 4, (Color){100, 100, 100, 255});
float midi_gate_map = round((255.f / midiNote.gate) * fade);
float midi_gate_map = round((255.f / getNotes().gate) * fade);
Color gate_color = VS_COLOR_GREEN;