Exp scale for gate time
This commit is contained in:
@@ -78,6 +78,7 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
midiNoteHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiNote.note, position, VS_COLOR_GREEN, "NOTE", orbit_5, 12));
|
midiNoteHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiNote.note, position, VS_COLOR_GREEN, "NOTE", orbit_5, 12));
|
||||||
midiNoteHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiNote.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 16, 1, 16, 40, 150));
|
midiNoteHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiNote.channel, position, VS_COLOR_PINK, "CHANNEL", orbit_1, 16, 1, 16, 40, 150));
|
||||||
midiNoteHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiNote.gate, position, VS_COLOR_RED, "GATE", orbit_3, 30, 10, 30000, 40, 300));
|
midiNoteHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiNote.gate, position, VS_COLOR_RED, "GATE", orbit_3, 30, 10, 30000, 40, 300));
|
||||||
|
midiNoteHandles.back()->logScale = true;
|
||||||
midiNoteHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiNote.velocity, position, VS_COLOR_PURPLE, "VELOCITY", orbit_4, 32));
|
midiNoteHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiNote.velocity, position, VS_COLOR_PURPLE, "VELOCITY", orbit_4, 32));
|
||||||
|
|
||||||
midiCCHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiCC.control, position, VS_COLOR_SUN, "CONTROL", orbit_3, 32));
|
midiCCHandles.emplace_back(std::make_shared<NodeHandle<int>>(midiCC.control, position, VS_COLOR_SUN, "CONTROL", orbit_3, 32));
|
||||||
|
|||||||
+9
-3
@@ -37,6 +37,7 @@ namespace VISEQ::GRAPH::NODES{
|
|||||||
float minDistance = 40;
|
float minDistance = 40;
|
||||||
float maxDistance = 40 + 2*127;
|
float maxDistance = 40 + 2*127;
|
||||||
bool stopAtMax = true;
|
bool stopAtMax = true;
|
||||||
|
bool logScale = false;
|
||||||
|
|
||||||
float radius = 10.0f;
|
float radius = 10.0f;
|
||||||
float orbit = 0.0f;
|
float orbit = 0.0f;
|
||||||
@@ -67,14 +68,14 @@ namespace VISEQ::GRAPH::NODES{
|
|||||||
float range = (maxValue - minValue) + 1;
|
float range = (maxValue - minValue) + 1;
|
||||||
float stepping = 360.0f / range;
|
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_PRESSED.ctrl) angle_start = angle;
|
||||||
if(KEYS_DOWN.ctrl) angle = angle_start + (angle - angle_start) / 10;
|
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;
|
position = parentPosition.orbitAtAngle(orbit, stepped_angle) - parentPosition;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -98,6 +99,11 @@ namespace VISEQ::GRAPH::NODES{
|
|||||||
float stepping = 360.0f / range;
|
float stepping = 360.0f / range;
|
||||||
angle_g = angle;
|
angle_g = angle;
|
||||||
T value = (T)Remap(angle, 0, 359 - stepping, minValue, maxValue);
|
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;
|
assignedValueRef = value;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user