The sample code Interface_3x3 is a good sample.
But there is some i dont understand.
There are 3 midi instances created
then we get :
etc.
Now if i have 8 or 16 instances i would need to copy that code.
So i wonder why i can not pass this instance to a procedure.
Coming from pascal i have little knowledge about arduino. I am used to create an object and pass it(or a pointer).
I tried some things but all failed with cryptic error messages.
The Interface_16x16 sample shows an attempt : //midi::MidiInterface &SerialMidiList[6] = {MIDI1, MIDI2, MIDI3, MIDI4, MIDI5, MIDI6};
but it is remarked and not used. So it is either not simple, or not working.
Anyone an idea to get it work using a loop with a procedure/function?
But there is some i dont understand.
There are 3 midi instances created
Code:
// Create the Serial MIDI ports
MIDI_CREATE_INSTANCE(HardwareSerial, Serial1, MIDI1);
MIDI_CREATE_INSTANCE(HardwareSerial, Serial2, MIDI2);
MIDI_CREATE_INSTANCE(HardwareSerial, Serial3, MIDI3);
then we get :
Code:
if (MIDI1.read()) {
// get a MIDI IN1 (Serial) message
byte type = MIDI1.getType();
byte channel = MIDI1.getChannel();
byte data1 = MIDI1.getData1();
byte data2 = MIDI1.getData2();
// forward the message to USB MIDI virtual cable #0
if (type != midi::SystemExclusive) {
// Normal messages, simply give the data to the usbMIDI.send()
usbMIDI.send(type, data1, data2, channel, 0);
} else {
// SysEx messages are special. The message length is given in data1 & data2
unsigned int SysExLength = data1 + data2 * 256;
usbMIDI.sendSysEx(SysExLength, MIDI1.getSysExArray(), true, 0);
}
activity = true;
}
if (MIDI2.read()) {
Now if i have 8 or 16 instances i would need to copy that code.
So i wonder why i can not pass this instance to a procedure.
Coming from pascal i have little knowledge about arduino. I am used to create an object and pass it(or a pointer).
I tried some things but all failed with cryptic error messages.
The Interface_16x16 sample shows an attempt : //midi::MidiInterface &SerialMidiList[6] = {MIDI1, MIDI2, MIDI3, MIDI4, MIDI5, MIDI6};
but it is remarked and not used. So it is either not simple, or not working.
Anyone an idea to get it work using a loop with a procedure/function?