modifier chains implemented for notes
This commit is contained in:
@@ -386,8 +386,8 @@ namespace VISEQ::GRAPH{
|
|||||||
unsigned char opacity_to = 250.0f - Clamp(to_from_handle.dist(mouse_pos), 0.0f, 220.0f);
|
unsigned char opacity_to = 250.0f - Clamp(to_from_handle.dist(mouse_pos), 0.0f, 220.0f);
|
||||||
|
|
||||||
float opacity_normalized = Clamp((float)opacity / 255.0f, .0f, 1.0f);
|
float opacity_normalized = Clamp((float)opacity / 255.0f, .0f, 1.0f);
|
||||||
float opacity_from_normalized = Clamp((float)opacity_from / 255.0f, .0f, 1.0f);
|
//float opacity_from_normalized = Clamp((float)opacity_from / 255.0f, .0f, 1.0f);
|
||||||
float opacity_to_normalized = Clamp((float)opacity_to / 255.0f, .0f, 1.0f);
|
//float opacity_to_normalized = Clamp((float)opacity_to / 255.0f, .0f, 1.0f);
|
||||||
|
|
||||||
// Line with small connector circles
|
// Line with small connector circles
|
||||||
if(c->end.lock()->getNodeType() == NodeType::MIDINODE && c->start.lock()->getNodeType() == NodeType::MIDINODE){
|
if(c->end.lock()->getNodeType() == NodeType::MIDINODE && c->start.lock()->getNodeType() == NodeType::MIDINODE){
|
||||||
|
|||||||
+38
-23
@@ -3,6 +3,7 @@
|
|||||||
#include "config-node.h"
|
#include "config-node.h"
|
||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
#include "edge.h"
|
#include "edge.h"
|
||||||
|
#include "interaction-event.h"
|
||||||
#include "midi.h"
|
#include "midi.h"
|
||||||
#include "node.h"
|
#include "node.h"
|
||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
@@ -181,16 +182,22 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
|
|
||||||
switch(mode){
|
switch(mode){
|
||||||
case NOTE:{
|
case NOTE:{
|
||||||
if(state->isModChain(APP::CTRL, APP::SHIFT, APP::ALT)){
|
if(state->isModChain(APP::CTRL)) modMidiNoteValue(wheel);
|
||||||
std::cout << "yeah" << std::endl;
|
if(state->isModChain(APP::CTRL, APP::SHIFT)) modMidiNoteValue(wheel*12);
|
||||||
}
|
if(state->isModChain(APP::CTRL, APP::ALT)) modMidiNoteValue(wheel*12);
|
||||||
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiNoteValue(wheel);
|
if(state->isModChain(APP::CTRL, APP::SHIFT, APP::ALT)) modMidiNoteValue(wheel*24);
|
||||||
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiNoteVelocity(wheel);
|
if(state->isModChain(APP::CTRL, APP::ALT, APP::SHIFT)) modMidiNoteValue(wheel*24);
|
||||||
|
|
||||||
|
if(state->isModChain(APP::SHIFT)) modMidiNoteVelocity(wheel);
|
||||||
|
if(state->isModChain(APP::SHIFT, APP::CTRL)) modMidiNoteVelocity(wheel*16);
|
||||||
|
if(state->isModChain(APP::SHIFT, APP::ALT)) modMidiNoteVelocity(wheel*16);
|
||||||
|
if(state->isModChain(APP::SHIFT, APP::CTRL, APP::ALT)) modMidiNoteVelocity(wheel*32);
|
||||||
|
if(state->isModChain(APP::SHIFT, APP::ALT, APP::CTRL)) modMidiNoteVelocity(wheel*32);
|
||||||
|
|
||||||
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiNoteGate(wheel*100);
|
if(state->isModChain(APP::ALT)) modMidiNoteGate(wheel*100);
|
||||||
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiNoteGate(wheel*1000);
|
if(state->isModChain(APP::ALT, APP::CTRL)) modMidiNoteGate(wheel*1000);
|
||||||
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiNoteGate(wheel*10);
|
if(state->isModChain(APP::ALT, APP::SHIFT)) modMidiNoteGate(wheel*10);
|
||||||
if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiNoteGate(wheel);
|
if(state->isModChain(APP::ALT, APP::SHIFT, APP::CTRL)) modMidiNoteGate(wheel);
|
||||||
break;}
|
break;}
|
||||||
case CC:{
|
case CC:{
|
||||||
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiCCValue(wheel);
|
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiCCValue(wheel);
|
||||||
@@ -277,23 +284,31 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
VMATH::Vec2D<float> desc_position = position + VMATH::Vec2D<float>(radius + 7.0f, radius + 7.0f);
|
VMATH::Vec2D<float> desc_position = position + VMATH::Vec2D<float>(radius + 7.0f, radius + 7.0f);
|
||||||
switch(mode){
|
switch(mode){
|
||||||
case NOTE:{
|
case NOTE:{
|
||||||
if(!KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(MIDI::Notes[getNotes().note], position, 14, VS_COLOR_DARKGREY);
|
if(state->isModChainStart(APP::CTRL) || state->modifier_chain.size() == 0) DrawCenteredText(MIDI::Notes[getNotes().note], position, 14, VS_COLOR_DARKGREY);
|
||||||
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getNotes().velocity), position, 12, VS_COLOR_WHITE);
|
if(state->isModChainStart(APP::SHIFT)) DrawCenteredText(std::format("{}", getNotes().velocity), position, 12, VS_COLOR_DARKGREY);
|
||||||
|
|
||||||
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{:.1f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_WHITE);
|
if(state->isModChain(APP::ALT)) DrawCenteredText(std::format("{:.1f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_DARKGREY);
|
||||||
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{:.2f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_WHITE);
|
if(state->isModChainStart(APP::ALT, APP::CTRL)) DrawCenteredText(std::format("{:.2f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_DARKGREY);
|
||||||
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{:.2f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_WHITE);
|
if(state->isModChain(APP::ALT, APP::SHIFT)) DrawCenteredText(std::format("{:.2f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_DARKGREY);
|
||||||
if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawCenteredText(std::format("{:.3f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_WHITE);
|
if(state->isModChain(APP::ALT, APP::SHIFT, APP::CTRL)) DrawCenteredText(std::format("{:.3f}s", (float)getNotes().gate / 1000.f), position, 12, VS_COLOR_DARKGREY);
|
||||||
|
|
||||||
if(selected){
|
if(selected || hovering()){
|
||||||
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("NOTE", desc_position, 8, VS_COLOR_WHITE);
|
if(state->isModChain(APP::CTRL)) DrawText("NOTE +1", desc_position, 8, VS_COLOR_WHITE);
|
||||||
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("VALUE", desc_position, 8, VS_COLOR_WHITE);
|
if(state->isModChain(APP::CTRL, APP::SHIFT)) DrawText("NOTE +12", desc_position, 8, VS_COLOR_WHITE);
|
||||||
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("VELOCITY", desc_position, 8, VS_COLOR_WHITE);
|
if(state->isModChain(APP::CTRL, APP::ALT)) DrawText("NOTE +12", desc_position, 8, VS_COLOR_WHITE);
|
||||||
|
if(state->isModChain(APP::CTRL, APP::SHIFT, APP::ALT)) DrawText("NOTE +24", desc_position, 8, VS_COLOR_WHITE);
|
||||||
|
if(state->isModChain(APP::CTRL, APP::ALT, APP::SHIFT)) DrawText("NOTE +24", desc_position, 8, VS_COLOR_WHITE);
|
||||||
|
|
||||||
|
if(state->isModChain(APP::SHIFT)) DrawText("VELOCITY +1", desc_position, 8, VS_COLOR_WHITE);
|
||||||
|
if(state->isModChain(APP::SHIFT, APP::CTRL)) DrawText("VELOCITY +16", desc_position, 8, VS_COLOR_WHITE);
|
||||||
|
if(state->isModChain(APP::SHIFT, APP::ALT)) DrawText("VELOCITY +16", desc_position, 8, VS_COLOR_WHITE);
|
||||||
|
if(state->isModChain(APP::SHIFT, APP::CTRL, APP::ALT)) DrawText("VELOCITY +32", desc_position, 8, VS_COLOR_WHITE);
|
||||||
|
if(state->isModChain(APP::SHIFT, APP::ALT, APP::CTRL)) DrawText("VELOCITY +32", desc_position, 8, VS_COLOR_WHITE);
|
||||||
|
|
||||||
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("GATE 0.1s", desc_position, 8, VS_COLOR_WHITE);
|
if(state->isModChain(APP::ALT)) DrawText("GATE 0.1s", desc_position, 8, VS_COLOR_WHITE);
|
||||||
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("GATE 1.0s", desc_position, 8, VS_COLOR_WHITE);
|
if(state->isModChainStart(APP::ALT, APP::CTRL)) DrawText("GATE 1.0s", desc_position, 8, VS_COLOR_WHITE);
|
||||||
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("GATE 0.01s", desc_position, 8, VS_COLOR_WHITE);
|
if(state->isModChain(APP::ALT, APP::SHIFT)) DrawText("GATE 0.01s", desc_position, 8, VS_COLOR_WHITE);
|
||||||
if(KEYS_DOWN.ctrl && KEYS_DOWN.shift && KEYS_DOWN.alt) DrawText("GATE 0.001s", desc_position, 8, VS_COLOR_WHITE);
|
if(state->isModChain(APP::ALT, APP::SHIFT, APP::CTRL)) DrawText("GATE 0.001s", desc_position, 8, VS_COLOR_WHITE);
|
||||||
}
|
}
|
||||||
break;}
|
break;}
|
||||||
case CC:{
|
case CC:{
|
||||||
|
|||||||
+26
-3
@@ -4,6 +4,7 @@
|
|||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
#include "vmath.h"
|
#include "vmath.h"
|
||||||
#include <memory>
|
#include <memory>
|
||||||
|
#include <ostream>
|
||||||
|
|
||||||
namespace VISEQ::APP{
|
namespace VISEQ::APP{
|
||||||
|
|
||||||
@@ -59,14 +60,22 @@ namespace VISEQ::APP{
|
|||||||
if(modifier_chain.size() < n_modifier){
|
if(modifier_chain.size() < n_modifier){
|
||||||
ModifierKeyNames modKey = keys_pressed.ctrl ? CTRL : keys_pressed.shift ? SHIFT : ALT;
|
ModifierKeyNames modKey = keys_pressed.ctrl ? CTRL : keys_pressed.shift ? SHIFT : ALT;
|
||||||
modifier_chain.push_back(modKey);
|
modifier_chain.push_back(modKey);
|
||||||
std::cout << modifier_chain.size() << " " << modKey << std::endl;
|
//std::cout << modifier_chain.size() << " " << modKey << std::endl;
|
||||||
|
for(ModifierKeyNames n : modifier_chain){
|
||||||
|
std::cout << n << " ";
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
if(modifier_chain.size() > n_modifier){
|
if(modifier_chain.size() > n_modifier){
|
||||||
ModifierKeyNames modKey = !keys_released.ctrl ? CTRL : !keys_released.shift ? SHIFT : ALT;
|
ModifierKeyNames modKey = keys_released.ctrl ? CTRL : keys_released.shift ? SHIFT : ALT;
|
||||||
auto it = std::remove(modifier_chain.begin(), modifier_chain.end(), modKey);
|
auto it = std::remove(modifier_chain.begin(), modifier_chain.end(), modKey);
|
||||||
modifier_chain.erase(it);
|
modifier_chain.erase(it);
|
||||||
std::cout << modifier_chain.size() << " " << modKey << std::endl;
|
//std::cout << modifier_chain.size() << " " << modKey << std::endl;
|
||||||
|
for(ModifierKeyNames n : modifier_chain){
|
||||||
|
std::cout << n << " ";
|
||||||
|
}
|
||||||
|
std::cout << std::endl;
|
||||||
}
|
}
|
||||||
|
|
||||||
screen_mouse = {round(mouse_pos.x), round(mouse_pos.y)};
|
screen_mouse = {round(mouse_pos.x), round(mouse_pos.y)};
|
||||||
@@ -89,6 +98,20 @@ namespace VISEQ::APP{
|
|||||||
return State::instance;
|
return State::instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool State::isModChainEmpty(){
|
||||||
|
return modifier_chain.size() == 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool State::isModChainStart(ModifierKeyNames first){
|
||||||
|
if(modifier_chain.size() < 1) return false;
|
||||||
|
return std::equal(modifier_chain.begin(), modifier_chain.begin() + 1, std::vector<ModifierKeyNames>{first}.begin());
|
||||||
|
}
|
||||||
|
|
||||||
|
bool State::isModChainStart(ModifierKeyNames first, ModifierKeyNames second){
|
||||||
|
if(modifier_chain.size() < 2) return false;
|
||||||
|
return std::equal(modifier_chain.begin(), modifier_chain.begin() + 2, std::vector<ModifierKeyNames>{first, second}.begin());
|
||||||
|
}
|
||||||
|
|
||||||
bool State::isModChain(ModifierKeyNames first){
|
bool State::isModChain(ModifierKeyNames first){
|
||||||
return modifier_chain == std::vector<ModifierKeyNames>{first};
|
return modifier_chain == std::vector<ModifierKeyNames>{first};
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -102,6 +102,9 @@ namespace VISEQ::APP{
|
|||||||
|
|
||||||
std::deque<InteractionEvent> event_queue;
|
std::deque<InteractionEvent> event_queue;
|
||||||
|
|
||||||
|
bool isModChainEmpty();
|
||||||
|
bool isModChainStart(ModifierKeyNames first);
|
||||||
|
bool isModChainStart(ModifierKeyNames first, ModifierKeyNames second);
|
||||||
bool isModChain(ModifierKeyNames first);
|
bool isModChain(ModifierKeyNames first);
|
||||||
bool isModChain(ModifierKeyNames first, ModifierKeyNames second);
|
bool isModChain(ModifierKeyNames first, ModifierKeyNames second);
|
||||||
bool isModChain(ModifierKeyNames first, ModifierKeyNames second, ModifierKeyNames third);
|
bool isModChain(ModifierKeyNames first, ModifierKeyNames second, ModifierKeyNames third);
|
||||||
|
|||||||
Reference in New Issue
Block a user