midi modes added, context menu adapted
This commit is contained in:
+1
-4
@@ -205,7 +205,6 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
break;}
|
break;}
|
||||||
case PC:{
|
case PC:{
|
||||||
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiPCValue(wheel);
|
if(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiPCValue(wheel);
|
||||||
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) modMidiPCProgram(wheel);
|
|
||||||
break;}
|
break;}
|
||||||
case PB:{
|
case PB:{
|
||||||
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPitchBend(wheel*64);
|
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && KEYS_DOWN.alt) modMidiPitchBend(wheel*64);
|
||||||
@@ -322,11 +321,9 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
break;}
|
break;}
|
||||||
case PC:{
|
case PC:{
|
||||||
if(!KEYS_DOWN.shift) DrawCenteredText(std::format("{}", getPC().value), position, 12, VS_COLOR_DARKGREY);
|
if(!KEYS_DOWN.shift) DrawCenteredText(std::format("{}", getPC().value), position, 12, VS_COLOR_DARKGREY);
|
||||||
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawCenteredText(std::format("{}", getPC().program), position, 12, VS_COLOR_WHITE);
|
|
||||||
if(selected){
|
if(selected){
|
||||||
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("PROGRAM CHANGE", desc_position, 8, VS_COLOR_WHITE);
|
if(!KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("PROGRAM CHANGE", 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(KEYS_DOWN.ctrl && !KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("PROGRAM", desc_position, 8, VS_COLOR_WHITE);
|
||||||
if(!KEYS_DOWN.ctrl && KEYS_DOWN.shift && !KEYS_DOWN.alt) DrawText("PROGRAM", desc_position, 8, VS_COLOR_WHITE);
|
|
||||||
}
|
}
|
||||||
break;}
|
break;}
|
||||||
case PB:{
|
case PB:{
|
||||||
|
|||||||
@@ -46,6 +46,8 @@ namespace VISEQ::GRAPH::NODES {
|
|||||||
bool send_cc = false;
|
bool send_cc = false;
|
||||||
bool send_pc = false;
|
bool send_pc = false;
|
||||||
bool send_pitch_bend = false;
|
bool send_pitch_bend = false;
|
||||||
|
bool send_aftertouch = false;
|
||||||
|
bool send_polypressure = false;
|
||||||
|
|
||||||
int midi_out = -1;
|
int midi_out = -1;
|
||||||
|
|
||||||
|
|||||||
@@ -4,6 +4,7 @@
|
|||||||
#include "raylib.h"
|
#include "raylib.h"
|
||||||
|
|
||||||
#include <iostream>
|
#include <iostream>
|
||||||
|
#include <libremidi/message.hpp>
|
||||||
#include <memory>
|
#include <memory>
|
||||||
#include <sstream>
|
#include <sstream>
|
||||||
#include "datatypes.h"
|
#include "datatypes.h"
|
||||||
@@ -79,6 +80,14 @@ namespace VISEQ::MIDI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Midi::pc(int midi_out, int channel, int value){
|
||||||
|
if(midi_outs.contains(midi_out)){
|
||||||
|
if(midi_outs[midi_out]->is_port_open()){
|
||||||
|
midi_outs[midi_out]->send_message(libremidi::channel_events::program_change(channel, value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Midi::pitch_bend(int midi_out, int channel, int pitch_value){
|
void Midi::pitch_bend(int midi_out, int channel, int pitch_value){
|
||||||
if(midi_outs.contains(midi_out)){
|
if(midi_outs.contains(midi_out)){
|
||||||
if(midi_outs[midi_out]->is_port_open()){
|
if(midi_outs[midi_out]->is_port_open()){
|
||||||
@@ -87,6 +96,22 @@ namespace VISEQ::MIDI {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void Midi::aftertouch(int midi_out, int channel, int aftertouch_value){
|
||||||
|
if(midi_outs.contains(midi_out)){
|
||||||
|
if(midi_outs[midi_out]->is_port_open()){
|
||||||
|
midi_outs[midi_out]->send_message(libremidi::channel_events::aftertouch(channel, aftertouch_value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void Midi::polypressure(int midi_out, int channel, int note, int polypressure_value){
|
||||||
|
if(midi_outs.contains(midi_out)){
|
||||||
|
if(midi_outs[midi_out]->is_port_open()){
|
||||||
|
midi_outs[midi_out]->send_message(libremidi::channel_events::poly_pressure(channel, note, polypressure_value));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
void Midi::all_notes_off(){
|
void Midi::all_notes_off(){
|
||||||
for(auto &n : notes){
|
for(auto &n : notes){
|
||||||
if(midi_outs.contains(n.midi_out) && midi_outs[n.midi_out]->is_port_open()) midi_outs[n.midi_out]->send_message(libremidi::channel_events::note_off(n.channel, n.note, n.velocity));
|
if(midi_outs.contains(n.midi_out) && midi_outs[n.midi_out]->is_port_open()) midi_outs[n.midi_out]->send_message(libremidi::channel_events::note_off(n.channel, n.note, n.velocity));
|
||||||
|
|||||||
@@ -50,7 +50,10 @@ namespace VISEQ::MIDI {
|
|||||||
void close_midi_out(VirtualMidiOutPort *out_port);
|
void close_midi_out(VirtualMidiOutPort *out_port);
|
||||||
void note(int midi_out, int channel, int note, int velocity, int gate);
|
void note(int midi_out, int channel, int note, int velocity, int gate);
|
||||||
void cc(int midi_out, int channel, int cc, int value);
|
void cc(int midi_out, int channel, int cc, int value);
|
||||||
|
void pc(int midi_out, int channel, int value);
|
||||||
void pitch_bend(int midi_out, int channel, int pitch_value);
|
void pitch_bend(int midi_out, int channel, int pitch_value);
|
||||||
|
void aftertouch(int midi_out, int channel, int aftertouch_value);
|
||||||
|
void polypressure(int midi_out, int channel, int note, int polypressure_value);
|
||||||
void all_notes_off();
|
void all_notes_off();
|
||||||
void update();
|
void update();
|
||||||
};
|
};
|
||||||
|
|||||||
@@ -103,7 +103,10 @@ namespace VISEQ::SIGNAL {
|
|||||||
if(m.second.enabled) {
|
if(m.second.enabled) {
|
||||||
if(midinode->send_note) midi.note(m.second.i, midinode->getNotes().channel, (int)Clamp(midinode->getNotes().note + s->midi_note_offset, 0, 127), midinode->getNotes().velocity, midinode->getNotes().gate);
|
if(midinode->send_note) midi.note(m.second.i, midinode->getNotes().channel, (int)Clamp(midinode->getNotes().note + s->midi_note_offset, 0, 127), midinode->getNotes().velocity, midinode->getNotes().gate);
|
||||||
if(midinode->send_cc) midi.cc(m.second.i, midinode->getCC().channel, midinode->getCC().control, (int)Clamp(midinode->getCC().value + s->midi_cc_offset, 0, 127));
|
if(midinode->send_cc) midi.cc(m.second.i, midinode->getCC().channel, midinode->getCC().control, (int)Clamp(midinode->getCC().value + s->midi_cc_offset, 0, 127));
|
||||||
|
if(midinode->send_pc) midi.pc(m.second.i, midinode->getPC().channel, midinode->getPC().value);
|
||||||
if(midinode->send_pitch_bend) midi.pitch_bend(m.second.i, midinode->getPitchBend().channel, midinode->getPitchBend().value);
|
if(midinode->send_pitch_bend) midi.pitch_bend(m.second.i, midinode->getPitchBend().channel, midinode->getPitchBend().value);
|
||||||
|
if(midinode->send_aftertouch) midi.aftertouch(m.second.i, midinode->getAftertouch().channel, midinode->getAftertouch().value);
|
||||||
|
if(midinode->send_polypressure) midi.polypressure(m.second.i, midinode->getPolyPressure().channel, midinode->getPolyPressure().note, midinode->getPolyPressure().value);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
s->last = s->next;
|
s->last = s->next;
|
||||||
|
|||||||
+12
-5
@@ -141,13 +141,20 @@ namespace VISEQ::APP::UI{
|
|||||||
int y_channel = y_midi + 30 + i*20;
|
int y_channel = y_midi + 30 + i*20;
|
||||||
GuiCheckBox((Rectangle){np.x + 20, np.y + y_channel, 20, 20}, "NOTE", &mn->send_note);
|
GuiCheckBox((Rectangle){np.x + 20, np.y + y_channel, 20, 20}, "NOTE", &mn->send_note);
|
||||||
GuiCheckBox((Rectangle){np.x + 90, np.y + y_channel, 20, 20}, "CC", &mn->send_cc);
|
GuiCheckBox((Rectangle){np.x + 90, np.y + y_channel, 20, 20}, "CC", &mn->send_cc);
|
||||||
GuiCheckBox((Rectangle){np.x + 160, np.y + y_channel, 20, 20}, "PITCH", &mn->send_pitch_bend);
|
GuiCheckBox((Rectangle){np.x + 160, np.y + y_channel, 20, 20}, "PITCH-B", &mn->send_pitch_bend);
|
||||||
|
|
||||||
int y_cc_note = y_channel + 120;
|
int y_send_bools = y_channel + 30;
|
||||||
|
GuiCheckBox((Rectangle){np.x + 20, np.y + y_send_bools, 20, 20}, "PC", &mn->send_pc);
|
||||||
|
GuiCheckBox((Rectangle){np.x + 90, np.y + y_send_bools, 20, 20}, "AT", &mn->send_aftertouch);
|
||||||
|
GuiCheckBox((Rectangle){np.x + 160, np.y + y_send_bools, 20, 20}, "POLY-P", &mn->send_polypressure);
|
||||||
|
|
||||||
|
int y_cc_note = y_send_bools + 120;
|
||||||
|
GuiLabel((Rectangle){np.x + 20, np.y + y_cc_note - 75, 220, 20}, "NOTE CHANNEL");
|
||||||
|
GuiToggleGroup((Rectangle){np.x + 20, np.y + y_cc_note - 50, 25, 20}, "1;2;3;4;5;6;7;8\n9;10;11;12;13;14;15;16", &mn->midiNote.channel);
|
||||||
|
|
||||||
|
/*
|
||||||
switch(state->node_mode){
|
switch(state->node_mode){
|
||||||
case 0:{
|
case 0:{
|
||||||
GuiLabel((Rectangle){np.x + 20, np.y + y_cc_note - 75, 220, 20}, "NOTE CHANNEL");
|
|
||||||
GuiToggleGroup((Rectangle){np.x + 20, np.y + y_cc_note - 50, 25, 20}, "1;2;3;4;5;6;7;8\n9;10;11;12;13;14;15;16", &mn->midiNote.channel);
|
|
||||||
|
|
||||||
GuiLabel((Rectangle){np.x + 20, np.y + y_cc_note , 100, 20}, "NOTE");
|
GuiLabel((Rectangle){np.x + 20, np.y + y_cc_note , 100, 20}, "NOTE");
|
||||||
float v = mn->midiNote.note;
|
float v = mn->midiNote.note;
|
||||||
@@ -197,7 +204,7 @@ namespace VISEQ::APP::UI{
|
|||||||
GuiSlider((Rectangle){np.x + 20, np.y + y_cc_note + 30, 220, 20}, "", "", &v, 0, 16383);
|
GuiSlider((Rectangle){np.x + 20, np.y + y_cc_note + 30, 220, 20}, "", "", &v, 0, 16383);
|
||||||
mn->midiPitchBend.value = round(v);
|
mn->midiPitchBend.value = round(v);
|
||||||
break;}
|
break;}
|
||||||
}
|
}*/
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user