diff options
author | Christian Pointner <equinox@helsinki.at> | 2014-06-03 18:12:07 (GMT) |
---|---|---|
committer | Christian Pointner <equinox@helsinki.at> | 2014-06-03 18:12:07 (GMT) |
commit | 488657188fda872c5d284e8d669ec940346c99e7 (patch) | |
tree | e74fc60f0ccb7e1354de6d5858640777f5072d10 /software/rhmixxx | |
parent | 0e0b43840b2662047f14a1f96a42f430adeeac73 (diff) |
imporved midi command mapping
Diffstat (limited to 'software/rhmixxx')
-rw-r--r-- | software/rhmixxx/rhmixxx.c | 22 |
1 files changed, 13 insertions, 9 deletions
diff --git a/software/rhmixxx/rhmixxx.c b/software/rhmixxx/rhmixxx.c index a9d3fcc..fd91361 100644 --- a/software/rhmixxx/rhmixxx.c +++ b/software/rhmixxx/rhmixxx.c @@ -77,6 +77,8 @@ void EVENT_USB_Device_ControlRequest(void) #include "gpio.h"
#include "analog.h"
+#define MIDI_COMMAND_CONTROL_CHANGE 0xB0
+
static void process_incoming_midi(void)
{
MIDI_EventPacket_t ReceivedMIDIEvent;
@@ -93,7 +95,9 @@ static void process_incoming_midi(void) case 2: keypad_led_toggle(note - KEYPAD_MIDI_NOTE_OFFSET); break;
default: keypad_led_blink(note, value); break;
}
- }
+ } else if(cmd == MIDI_COMMAND_NOTE_OFF)
+ keypad_led_off(note - KEYPAD_MIDI_NOTE_OFFSET);
+
} else if((note >= GPIO_MIDI_NOTE_OFFSET && note < GPIO_MIDI_NOTE_OFFSET + GPIO_NUM_OUTPUTS) || // GPIO
note == GPIO_MIDI_NOTE_ALL_OUTPUTS) {
if(cmd == MIDI_COMMAND_NOTE_ON) {
@@ -102,14 +106,14 @@ static void process_incoming_midi(void) case 1: gpio_out_on(note - GPIO_MIDI_NOTE_OFFSET); break;
case 2: gpio_out_toggle(note - GPIO_MIDI_NOTE_OFFSET); break;
}
- }
+ } else if(cmd == MIDI_COMMAND_NOTE_OFF)
+ gpio_out_off(note - GPIO_MIDI_NOTE_OFFSET);
+
} else if((note >= ANALOG_MIDI_NOTE_OFFSET && note < ANALOG_MIDI_NOTE_OFFSET + ANALOG_NUM_INPUTS) || // ANALOG
note == ANALOG_MIDI_NOTE_ALL_INPUTS) {
- if(cmd == MIDI_COMMAND_NOTE_ON) {
- switch(value) {
- case 0: analog_disable_channel(note - ANALOG_MIDI_NOTE_OFFSET); break;
- case 1: analog_enable_channel(note - ANALOG_MIDI_NOTE_OFFSET); break;
- }
+ switch(cmd) {
+ case MIDI_COMMAND_NOTE_OFF: analog_disable_channel(note - ANALOG_MIDI_NOTE_OFFSET); break;
+ case MIDI_COMMAND_NOTE_ON: analog_enable_channel(note - ANALOG_MIDI_NOTE_OFFSET); break;
}
}
}
@@ -136,8 +140,8 @@ static void process_outgoing_midi(void) MIDI_EventPacket_t MIDIEventAnalog = (MIDI_EventPacket_t)
{
.CableNumber = 0, // TODO: hardcoded value
- .Command = (MIDI_COMMAND_NOTE_ON >> 4),
- .Data1 = MIDI_COMMAND_NOTE_ON | 0,
+ .Command = (MIDI_COMMAND_CONTROL_CHANGE >> 4),
+ .Data1 = MIDI_COMMAND_CONTROL_CHANGE | 0,
.Data2 = 0,
.Data3 = 0,
};
|