speaker working, midi out
This commit is contained in:
parent
d63c2e3995
commit
91176d854b
7 changed files with 130 additions and 124 deletions
|
@ -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,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue