diff options
author | Jack Humbert <jack.humb@gmail.com> | 2015-08-29 11:54:38 -0400 |
---|---|---|
committer | Jack Humbert <jack.humb@gmail.com> | 2015-08-29 11:54:38 -0400 |
commit | 91176d854b8c9e49e88d494ba02c8e9c54fec914 (patch) | |
tree | e21a68fbcd4e1d2c9d1b0d0d74d8ab47140d4847 /protocol | |
parent | d63c2e3995ae464c4266a7bd348ffb2f43cf7377 (diff) | |
download | firmware-91176d854b8c9e49e88d494ba02c8e9c54fec914.tar.gz firmware-91176d854b8c9e49e88d494ba02c8e9c54fec914.tar.bz2 firmware-91176d854b8c9e49e88d494ba02c8e9c54fec914.zip |
speaker working, midi out
Diffstat (limited to 'protocol')
-rw-r--r-- | protocol/lufa/lufa.c | 17 |
1 files changed, 14 insertions, 3 deletions
diff --git a/protocol/lufa/lufa.c b/protocol/lufa/lufa.c index e9f335a63..3ec476928 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, |