MidiInputCallback not responding


This question arose quite a few times in this forum already, but none of the previous threads were any helpful in this particular case, unfortunately. For the life of me, I don’t have the slightest clue why my MidiInputCallback doesn’t receive any messages. This is roughly the scheme of things: I have two classes AbstractPort and MidiPort (there are more siblings to MidiPort, but that doesn’t matter here):

class AbstractPort
    // shared stuff for managing ports in my project, e.g. port numbers, etc.

class MidiPort 
    : public AbstractPort,
      public MidiInputCallback
   void handleIncomingMidiMessage (MidiInput* source, const MidiMessage& message);
    ScopedPointer<MidiOutput> output;
    ScopedPointer<MidiInput>  input;    

In the member function MidiPort::start() the input gets launched as follows:

input = MidiInput::openDevice (whateverIndex, this);

No matter how many MIDI events I feed into the corresponding driver (a small USB keyboard “nanoKEY” by Korg), the input callback does not fire. I traced everything in the debugger, to no avail. Of course, the keyboard works fine with the PluginHost example project.

I should note that my project sits in a Framework/DLL and thus has no access to the message thread of the application it is linked to. As an experiment, I implemented and included a FakeMessageThread (a 100% copy of SharedMessageThread), but that wasn’t helpful either.

And yes, I am using virtual members and destructors in AbstractPort.

The project is developed on MacOS X 10.5.8 currently.

Any idea what I might have overlooked?


Hi !

Do you call AudioDeviceManager::addMidiInputCallback (const String &midiInputDeviceName, MidiInputCallback *callback) somewhere during init ?


My bad! Due to a stupid enumeration mistake, I messed with the device index numbers. This caused all ports to be opened on device 0. My fault was to remove device names from the top of the StringArray and then taking that “index” for the device number (always zero, of course). :oops:

Thanks so much to everyone who took the time to scratch their heads over my post. Thanks, dinaiz! I’m so sorry for wasting your time. I much appreciate this great support forum and all the friendly and helpful people here.