AudioDeviceManager bug


#1

I think the removeMidiInputCallback() call needs to be removed in here:

void AudioDeviceManager::addMidiInputCallback (const String& name, MidiInputCallback* callback) { // removeMidiInputCallback (name, callback); // <---- comment?!
because otherwise, if the same MidiInputCallback* is added for 3 different MIDI In devices, each time it will be removed again, and then in AudioDeviceManager::handleIncomingMidiMessageInt() you’ll have a problem in the line

because the midiCallbacks array size (=1) will not be the same as the midiCallbackDevices array size (=3), but in fact both must match the size!

This bug, already present in JUCE146, caused problems as soon as I used 2 MIDI Input Devices. I’m really astonished nobody noticed this before.


#2

I think you should instead add some check instead which checks if a given pair of MidiInputCallback & Device name already exists, and if so, exits.