Woow, no replies, and then lots of them..

Thank you.
At the moment, for the project I am trying to accomplish I am using the callbacks from the USB Composite library. The problem is that I have to use a "virtual void" for every midi event I want to handle. This will make the code extremely big and moire complex

With the other MIDI library it is much easier. This project is a MIDI Router, which interconnects 4 different MIDI inputs and Outputs. 3 serial and 1 USB. I am using the Blue Pill board with an STM32F103C8 chip, and Roger's core. Here is part ( one input) of my code's main loop. Please see the difference on the sending a serial input "midiA" to the outputs of midiB, midiC, and midiD, which is the USB. On the first 3 I just handle the data. For the USB, I need to handle every single event.
And this will complicate more when I get to send the USB input to the others, as I will have to code it inside the callback functions for each event

This is why I am wondering if this library has something similar.
Code: Select all
if (midiA.read())
{
if ((Send_A_To == 1) || (Send_A_To == 4) || (Send_A_To == 5) || (Send_A_To == 7)) {
midiB.send(midiA.getType(),
midiA.getData1(),
midiA.getData2(),
midiA.getChannel());
}
if ((Send_A_To == 2) || (Send_A_To == 4) || (Send_A_To == 6) || (Send_A_To == 7)) {
midiC.send(midiA.getType(),
midiA.getData1(),
midiA.getData2(),
midiA.getChannel());
}
// Now send midiD (USB)
if ((Send_A_To == 3) || (Send_A_To == 5) || (Send_A_To == 6) || (Send_A_To == 7)) {
unsigned int data1 = midiA.getData1();
unsigned int data2 = midiA.getData2();
unsigned int channel = midiA.getChannel();
if (midiA.getType() == 0xC0) midiUSB.sendProgramChange(channel - 1, data1);
if (midiA.getType() == 0x80) midiUSB.sendNoteOff(channel - 1, data1, data2 );
if (midiA.getType() == 0x90) midiUSB.sendNoteOn(channel - 1, data1, data2 );
if (midiA.getType() == 0xA0) midiUSB.sendVelocityChange(channel - 1, data1, data2 );
if (midiA.getType() == 0xB0) midiUSB.sendControlChange(channel - 1, data1, data2);
if (midiA.getType() == 0xD0) midiUSB.sendAfterTouch(channel - 1, data1);
// if(midiA.getType() == 0xE0) midiUSB.sendPitchChange(channel - 1, data1);
if (midiA.getType() == 0xF3) midiUSB.sendSongSelect(data1);
if (midiA.getType() == 0xF2) midiUSB.sendSongPosition(data1);
if (midiA.getType() == 0xF8) midiUSB.sendSync();
if (midiA.getType() == 0xFA) midiUSB.sendStart();
if (midiA.getType() == 0xFB) midiUSB.sendContinue();
if (midiA.getType() == 0xFC) midiUSB.sendStop();
}
}