summaryrefslogtreecommitdiffstats
path: root/protocol/lufa
diff options
context:
space:
mode:
Diffstat (limited to 'protocol/lufa')
-rw-r--r--protocol/lufa/lufa.c17
1 files changed, 14 insertions, 3 deletions
diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c
index e9f335a632..3ec476928c 100644
--- a/protocol/lufa/lufa.c
+++ b/protocol/lufa/lufa.c
@@ -51,6 +51,7 @@
#include "descriptor.h"
#include "lufa.h"
+#include <beeps.h>
// #include <LUFA/Version.h>
// #include <LUFA/Drivers/USB/USB.h>
@@ -877,11 +878,21 @@ int main(void)
}
#ifdef MIDI_ENABLE
-//echo data back
void fallthrough_callback(MidiDevice * device,
uint16_t cnt, uint8_t byte0, uint8_t byte1, uint8_t byte2){
- //pass the data back to the device, using the general purpose send data
- //function, any bytes after cnt are ignored
+ if (cnt == 3) {
+ switch (byte0 & 0xF0) {
+ case MIDI_NOTEON:
+ play_note(((double)261.6)*pow(2.0, -1.0)*pow(2.0,(byte1 & 0x7F)/12.0), (byte2 & 0x7F) / 8);
+ break;
+ case MIDI_NOTEOFF:
+ stop_note(((double)261.6)*pow(2.0, -1.0)*pow(2.0,(byte1 & 0x7F)/12.0));
+ break;
+ }
+ }
+ if (byte0 == MIDI_STOP) {
+ stop_all_notes();
+ }
}
void cc_callback(MidiDevice * device,