UHF
Well-known member
I have a Teensy-based synth and when my MIDI controller is plugged-in to the T4.1 USB Host, it automatically sends several CC data messages that I want to ignore as it affects the settings on the synth. I can detect when the controller is plugged-in to the port but I can't see a way to read-off the incoming data and discard it. Any ideas what I should use? The basic code is below with the section where the read-off should be:
Thanks.
Code:
#include <USBHost_t36.h>
#include <MIDI.h>
// USB HOST MIDI Class Compliant
USBHost myusb;
USBHub hub1(myusb);
USBHub hub2(myusb);
MIDIDevice midi1(myusb);
boolean usbHostPluggedIn = false;
void checkUSBHostStatus()
{
if (midi1 && !usbHostPluggedIn)
{
usbHostPluggedIn = true;
Serial.println("usbHostPluggedIn");
//REMOVE DATA FROM MIDI DEVICE
}
else if (!midi1 && usbHostPluggedIn)
{
usbHostPluggedIn = false;
Serial.println("usbHostUnplugged");
}
}
void setup() {
myusb.begin();
}
void loop(){
checkUSBHostStatus();
//USB Host MIDI Class Compliant
myusb.Task();
if (usbHostPluggedIn)
midi1.read(MIDI_CHANNEL_OMNI);
}
Thanks.