MIDI input detection AFTER AudioDeviceSelectorComponent

I’m using AudioDeviceSelectorComponent to select a MIDI input, from the GUI, but once that’s done, how do I use that input from code. I don’t see an interface written for it. AudioDeviceSelectorComponent or here AudioDeviceManager
the documentation doesn’t even seem to tell you what happens once the device input is checked.
Does this mean i have to do something with changeListenerCallback? Can i immediately start using MIDIKeyboardState as if i already had a device detected?

I’m fairly confused, could someone give me some pointers?

AudioDeviceManager::addMidiInputCallback ?

Ok gotcha, thanks.
but here’s the part hat confuses me, it seems that in order to use this you need to call MidiInput::getName() because a string is required. Doesn’t that, at least from a the perspective of the programmer, defeat the purpose of AudioDeviceSelectorComponent? probably not, cause i can see how making that dialog would be a PITA(thanks).

SO ANYWAY, will MidiInput::getName() automatically detect what the user has chosen? :slight_smile:

originally wrote getDevices() instead of getName()

I hate to say “RTFM”, but surely this explains it pretty well?

[code] /** Registers a listener for callbacks when midi events arrive from a midi input.

    The device name can be empty to indicate that it wants events from whatever the
    current "default" device is. Or it can be the name of one of the midi input devices
    (see MidiInput::getDevices() for the names).

    Only devices which are enabled (see the setMidiInputEnabled() method) will have their
    events forwarded on to listeners.
void addMidiInputCallback (const String& midiInputDeviceName,
                           MidiInputCallback* callback);


ugh i’m such a dork, sorry to take up your time. I saw “String” in the parameter list and s#47 myself, reading every and anything to do with midi except the member you’d already mentioned!!
jeez. terribly sorry. thanks again :slight_smile: :oops:

honestly i’ve been afraid to ask cause i’ve been branded the JUCENoob but after almost a month of not figuring out how(maybe spending 30 minutes to an hour almost every day trying to figure it out), I’ve decided that maybe i should ask.

your example code only shows MidiMessageCollector used as a parameter in addMidiInputCallback().
I’m not even sure how or why this works to be honest. I don’t know why passing this as a reference would allow it to be used as a MidiInputCallback. but when i use:

//my header
MidiInputCallback* midiInCall;

//my source
deviceManager.addMidiInputCallback(String::empty , midiInCall);[/code]
My program will compile, but will give me a runtime error as soon as i check my midi input device.
I’m guessing I need to do something with midiInCall before i use addMidiInputCallback()?

You need to write your own MidiInputCallback, look at the class and it’s virtual methods: http://www.rawmaterialsoftware.com/juce/api/classMidiInputCallback.html
Write the class, create it and pass a pointer to it when adding a callback.

Hey atom :slight_smile:
Thanks for the reply!! I didn’t realize that!!
I’ll get to work thanks :slight_smile: