Retrieve the current selected MIDI input?


#1

I have code that enables midi input which looks like this:

audioDeviceManager->setMidiInputEnabled(devices[1], true);

What I would like to do is pass the number of the MIDI device selected in the Audio Setting dialog window. Is there a method I can use to retrieve this number?


#2

I guess you’d just find its name, and find the index of that string in the list of midi device names.


#3

Of course, but how do I get the name of the selected midi device to compare with what’s in the list of devices returned by MidiOutput::getDevices()? Does the AudioDeviceManager class have a method for retrieving the MIDI device selected by the user?


#4

It lets you get the current midi device, doesn’t it?


#5

It lets you retrieve the current Audio Device but I don’t see any method in the docs for getting the current MIDI device. Perhaps it’s there but not documented?


#6

getDefaultMidiOutput()?


#7

Yup, if I wanted to get the default MIDI ‘output’ I would use that method. It’s the selected MIDI ‘input’ I am looking for?


#8

Doh! Sorry, misread that… Well, no, because you can enable any number of midi inputs - there’s no concept of a “selected” one. You could go through them all and find out which ones are enabled?


#9

Thanks Jules, I’ll try your suggestion.


#10

Jules, why the asymmetry on inputs vs. outputs? That is, why is there only one selectable MIDI output, instead of any number, like the inputs?


#11

Just because that’s how most people would want to use it, I guess. You might have a couple of different controllers, but won’t tend to play the same thing through more than one synth. If you need to do anything more complex, it’s easy enough to create the devices yourself.