introduction of config nodes

This commit is contained in:
Sebastian
2024-11-07 00:56:33 +01:00
parent 96a19d55ef
commit 529106e815
5 changed files with 66 additions and 10 deletions
+19
View File
@@ -0,0 +1,19 @@
#pragma once
#include "datatypes.h"
#include "node.h"
namespace VISEQ::GRAPH::NODES {
class ConfigNode : public Node{
public:
NodeType nodeType = NodeType::CONFIGNODE;
MIDI::MidiNote midiNote;
virtual NodeType getNodeType() const override {return nodeType;}
};
}
+37 -1
View File
@@ -49,11 +49,47 @@ namespace VISEQ::APP{
namespace VISEQ::GRAPH{ namespace VISEQ::GRAPH{
enum GraphItemType {NODE, EDGE}; enum GraphItemType {NODE, EDGE};
enum NodeType {OSCNODE, MIDINODE}; enum NodeType {OSCNODE, MIDINODE, CONFIGNODE};
enum EdgeType {MIDIEDGE, CONFIGEDGE};
} }
namespace VISEQ::MIDI{ namespace VISEQ::MIDI{
struct MidiNote{
int channel = 1;
int note = 48;
int velocity = 60;
int gate = 10; // gate time in milliseconds
};
struct MidiCC{
int channel = 0;
int control = 0;
int value = 0;
};
struct MidiPC{
int channel = 0;
int program = 0;
int value = 0;
};
struct MidiPitchBend{
int channel = 0;
int value = 0;
};
struct MidiAftertouch{
int channel = 0;
int value = 0;
};
struct MidiPolyPressure{
int channel = 0;
int note = 0;
int value = 0;
};
struct MidiOutPort{ struct MidiOutPort{
libremidi::output_port port; libremidi::output_port port;
int number; int number;
+5
View File
@@ -15,6 +15,8 @@ namespace VISEQ::GRAPH::EDGES {
std::shared_ptr<NODES::Node> start; std::shared_ptr<NODES::Node> start;
std::shared_ptr<NODES::Node> end; std::shared_ptr<NODES::Node> end;
EdgeType edgeType;
bool pass_forward = true; bool pass_forward = true;
bool pass_backward = true; bool pass_backward = true;
@@ -22,6 +24,9 @@ namespace VISEQ::GRAPH::EDGES {
bool active = false; bool active = false;
bool config = false; bool config = false;
bool split = false; bool split = false;
float speed = 0;
float bpm = 120.0f;
float connector_offset = 8.0f; float connector_offset = 8.0f;
float switches_offset = 25.0f; float switches_offset = 25.0f;
+1 -1
View File
@@ -128,7 +128,7 @@ namespace VISEQ::SIGNAL {
} }
mutex->unlock(); mutex->unlock();
} }
}; };
inline void to_json(json& j, const SignalManager& G){ inline void to_json(json& j, const SignalManager& G){
+4 -8
View File
@@ -98,14 +98,10 @@ namespace VISEQ::APP::UI{
DrawText(std::format("{}", gm->nodes.size()).c_str(), 20, settings->height - 70, 15, VS_COLOR_WHITE); DrawText(std::format("{}", gm->nodes.size()).c_str(), 20, settings->height - 70, 15, VS_COLOR_WHITE);
DrawFPS(20, settings->height - 30); DrawFPS(20, settings->height - 30);
} }
void drawPropertiesBar(){ void DrawCenteredText(std::string text, Vec2Df position, int size, Color color){
float offset = MeasureText(text.c_str(), size);
float left = settings->width - 280.f; DrawText(text.c_str(), position.x-offset/2.0f, position.y-(float)size/2.0f+1, size, color );
GuiPanel((Rectangle){left,-30,280,(float)settings->height + 31}, "");
const int s_controls = 25;
} }
void drawPerNodeConfig(Camera2D *camera){ void drawPerNodeConfig(Camera2D *camera){