summaryrefslogtreecommitdiff
path: root/arduino
diff options
context:
space:
mode:
authorerdgeist <erdgeist@bauklotz.fritz.box>2016-08-12 22:51:59 +0200
committererdgeist <erdgeist@bauklotz.fritz.box>2016-08-12 22:51:59 +0200
commit6939254e2c75c39d80c9f1413305123871425396 (patch)
treee1ea5395129c552fcc26936d92575710c6b41bd5 /arduino
parentc89efc48e2204aa80035f0e24b2965e31a3f14b8 (diff)
Implement midi commands for MIDIUSB on arduino
Diffstat (limited to 'arduino')
-rw-r--r--arduino/Laserharfe/Laserharfe.ino19
1 files changed, 19 insertions, 0 deletions
diff --git a/arduino/Laserharfe/Laserharfe.ino b/arduino/Laserharfe/Laserharfe.ino
index 8ad5f56..9f0d025 100644
--- a/arduino/Laserharfe/Laserharfe.ino
+++ b/arduino/Laserharfe/Laserharfe.ino
@@ -200,6 +200,25 @@ void handle_midi(char *command) {
200 // MidiUSB.flush(); 200 // MidiUSB.flush();
201} 201}
202 202
203void midi_playnote(int channel, int note, int octave_offset ) {
204 midi_pitchbend(channel, 0);
205 midiEventPacket_t p = { 0x9, 0x90 | channel, note + 12 * octave_offset, 0x7f };
206 MidiUSB.sendMIDI(p);
207}
208
209void midi_silencenote( int channel, int note, int octave_offset ) {
210 midiEventPacket_t p = { 0x8, 0x80 | channel, note + 12 * octave_offset, 0x7f };
211 MidiUSB.sendMIDI(p);
212}
213
214void midi_pitchbend( int channel, int pitch ) {
215 pitch += 8192;
216 if (pitch < 0) pitch = 0;
217 if (pitch > 16383) pitch = 16383,
218 midiEventPacket_t p = { 0xe, 0xe0 | channel, 0x7f & pitch, 0x7f & (pitch>>7) };
219 MidiUSB.sendMIDI(p);
220}
221
203void handle_configure(char *command) { 222void handle_configure(char *command) {
204 223
205} 224}