diff --git a/src/midi-node.h b/src/midi-node.h index 7f2f9be..3a49c9a 100644 --- a/src/midi-node.h +++ b/src/midi-node.h @@ -78,6 +78,7 @@ namespace VISEQ::GRAPH::NODES { midiNoteHandles.emplace_back(std::make_shared>(midiNote.note, position, VS_COLOR_GREEN, "NOTE", orbit_5, 12)); midiNoteHandles.emplace_back(std::make_shared>(midiNote.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 16, 1, 16, 40, 150)); midiNoteHandles.emplace_back(std::make_shared>(midiNote.gate, position, VS_COLOR_RED, "GATE", orbit_3, 30, 10, 30000, 40, 300)); + midiNoteHandles.back()->logScale = true; midiNoteHandles.emplace_back(std::make_shared>(midiNote.velocity, position, VS_COLOR_PURPLE, "VELOCITY", orbit_4, 32)); midiCCHandles.emplace_back(std::make_shared>(midiCC.control, position, VS_COLOR_SUN, "CONTROL", orbit_3, 32)); diff --git a/src/node-handle.h b/src/node-handle.h index 948763b..879bbe4 100644 --- a/src/node-handle.h +++ b/src/node-handle.h @@ -37,6 +37,7 @@ namespace VISEQ::GRAPH::NODES{ float minDistance = 40; float maxDistance = 40 + 2*127; bool stopAtMax = true; + bool logScale = false; float radius = 10.0f; float orbit = 0.0f; @@ -67,14 +68,14 @@ namespace VISEQ::GRAPH::NODES{ float range = (maxValue - minValue) + 1; float stepping = 360.0f / range; - if(KEYS_DOWN.shift) stepping = 360.0f/steps; + if(KEYS_DOWN.shift) stepping = stepping * steps; - float angle = Vector2Angle((SCREEN_MOUSE - parentPosition), Vector2(0,1)) * RAD2DEG; + float angle = Vector2Angle((SCREEN_MOUSE - parentPosition), Vector2(0,1)) * RAD2DEG - 180; // -180 because round(180 / 33.75) * 33.75 is not 0 if(KEYS_PRESSED.ctrl) angle_start = angle; if(KEYS_DOWN.ctrl) angle = angle_start + (angle - angle_start) / 10; - float stepped_angle = (round(angle / stepping) * stepping) * DEG2RAD; + float stepped_angle = (round(angle / stepping) * stepping + 180) * DEG2RAD; // see above. -180 + 180 to get 0 right round(0 / 33.75) * 33.75 is still 0 position = parentPosition.orbitAtAngle(orbit, stepped_angle) - parentPosition; } @@ -98,6 +99,11 @@ namespace VISEQ::GRAPH::NODES{ float stepping = 360.0f / range; angle_g = angle; T value = (T)Remap(angle, 0, 359 - stepping, minValue, maxValue); + if(logScale) { + float exp = value / maxValue; + float p = 2.2; + value = (pow(exp, p) / pow(1.0f, p)) * maxValue; + } assignedValueRef = value; }