From e964c7df890a3fc790badec24872b0f6065a9c37 Mon Sep 17 00:00:00 2001 From: Edmund Blackaddr Date: Sat, 17 Mar 2018 23:08:37 -0400 Subject: [PATCH] updated AnalogDelayDemo to work with Teensyduino 1.41 --- examples/Delay/AnalogDelayDemo/AnalogDelayDemo.ino | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/examples/Delay/AnalogDelayDemo/AnalogDelayDemo.ino b/examples/Delay/AnalogDelayDemo/AnalogDelayDemo.ino index 3cb413a..1083140 100644 --- a/examples/Delay/AnalogDelayDemo/AnalogDelayDemo.ino +++ b/examples/Delay/AnalogDelayDemo/AnalogDelayDemo.ino @@ -1,6 +1,7 @@ #include #include "BAGuitar.h" +using namespace midi; using namespace BAGuitar; AudioInputI2S i2sIn; @@ -8,6 +9,7 @@ AudioOutputI2S i2sOut; BAAudioControlWM8731 codec; /// IMPORTANT ///// +// YOU MUST USE TEENSYDUINO 1.41 or greater // YOU MUST COMPILE THIS DEMO USING Serial + Midi //#define USE_EXT // uncomment this line to use External MEM0 @@ -128,10 +130,12 @@ void loop() { // this code entered only if new MIDI received byte type, channel, data1, data2, cable; type = usbMIDI.getType(); // which MIDI message, 128-255 - channel = usbMIDI.getChannel(); // which MIDI channel, 1-16 - data1 = usbMIDI.getData1(); // first data byte of message, 0-127 - data2 = usbMIDI.getData2(); // second data byte of message, 0-127 - if (type == 3) { + channel = usbMIDI.getChannel(); // which MIDI channel, 1-16 + data1 = usbMIDI.getData1(); // first data byte of message, 0-127 + data2 = usbMIDI.getData2(); // second data byte of message, 0-127 + Serial.println(String("Received a MIDI message on channel ") + channel); + + if (type == MidiType::ControlChange) { // if type is 3, it's a CC MIDI Message // Note: the Arduino MIDI library encodes channels as 1-16 instead // of 0 to 15 as it should, so we must subtract one.