MIDI mute implemented.

master
Holger Wirtz 4 years ago
parent ca5427f6d5
commit 98b3a0b491
  1. 37
      OSC2MIDI.ino

@ -44,6 +44,8 @@
#define FORMAT_SPIFFS_IF_FAILED true
void OSCToMidiCC(OSCMessage &msg, int offset);
void OSCMixerMuteToMidiCC(OSCMessage &msg, int offset);
void OSCMixerSoloToMidiCC(OSCMessage &msg, int offset);
void MidiCCToOSC(uint8_t channel, uint8_t number, uint8_t value);
/*void change_midi_state(uint8_t midichannel, uint8_t cc, uint8_t value);
void show_midi_state(void);
@ -231,6 +233,8 @@ void loop()
{
DEBUG_OSC_MESSAGE(msg);
msg.route("/midi/cc", OSCToMidiCC);
msg.route("/midi/mixer/mute", OSCMixerMuteToMidiCC);
msg.route("/midi/mixer/solo", OSCMixerSoloToMidiCC);
msg.route("/ping", ping);
//msg.route("/midi/sysex", OSCToMidiSYSEX);
//msg.route("/midi/note", OSCToMidiNote);
@ -283,7 +287,7 @@ void OSCToMidiCC(OSCMessage & msg, int offset)
cc = getCC(address);
value = round(msg.getFloat(0));
value = value > 127 ? 127 : value;
DEBUG_MSG("MSG: % s\tChannel: % u\t\tCC: % u\tValue: % u\n", address, midichannel, cc, value);
DEBUG_MSG("MSG: %s\tChannel: %u\t\tCC: %u\tValue: %u\n", address, midichannel, cc, value);
MIDI1.sendControlChange(cc, value, midichannel);
change_midi_state(midichannel, cc, value);
}
@ -293,13 +297,13 @@ void OSCToMidiCC(OSCMessage & msg, int offset)
cc = getVar(address, 1);
value = round(msg.getFloat(0));
value = constrain(value, 0, 127);
DEBUG_MSG("MSG: % s\tChannel: % u\t\tCC: % u\tValue: % u\n", address, midichannel, cc, value);
DEBUG_MSG("MSG: %s\tChannel: %u\t\tCC: %u\tValue: %u\n", address, midichannel, cc, value);
MIDI1.sendControlChange(cc, value, midichannel);
change_midi_state(midichannel, cc, value);
cc = getVar(address, 2);
value = round(msg.getFloat(1));
value = constrain(value, 0, 127);
DEBUG_MSG("MSG: % s\tChannel: % u\t\tCC: % u\tValue: % u\n", address, midichannel, cc, value);
DEBUG_MSG("MSG: %s\tChannel: %u\t\tCC: %u\tValue: %u\n", address, midichannel, cc, value);
MIDI1.sendControlChange(cc, value, midichannel);
change_midi_state(midichannel, cc, value);
}
@ -309,6 +313,33 @@ void OSCToMidiCC(OSCMessage & msg, int offset)
}
}
void OSCMixerMuteToMidiCC(OSCMessage &msg, int offset)
{
char address[100] = { 0 };
uint8_t value;
uint8_t midichannel;
msg.getAddress(address, offset, sizeof(address));
if (msg.size() == 1 && msg.isFloat(0))
{
// Single or multi control with sending one value
midichannel = getVar(address, 0);
value = constrain(msg.getFloat(0), 0, 1);
DEBUG_MSG("MixerMute MSG: %s\t Channel: %u\tMute \tValue: %u\n", address, midichannel, value);
if (value == 1)
MIDI1.sendControlChange(7, 0, midichannel);
else
MIDI1.sendControlChange(7, midistate[(midichannel - 1) * 128 + 6], midichannel);
//change_midi_state(midichannel, cc, value);
}
}
void OSCMixerSoloToMidiCC(OSCMessage &msg, int offset)
{
;
}
void MidiCCToOSC(uint8_t channel, uint8_t number, uint8_t val)
{
char buffer[1024];

Loading…
Cancel
Save