MidiOut GetDevice Issue

Hi all,

I just started using JUCE about a month ago and its been great!

For my application, I wanted to create a new MIDIOut Device and display it in a comboBox along with the other available MIDI devices. What is completely perplexing me is that the created device always shows up as an Input Device and not Output!

If I open MaxMSP or Ableton Live or any other application, this new MIDIOut device shows up correctly however. I’m able to use the AudioDeviceManager to setDefaultMIDIOutDevice as this created device and it all works great! The only problem is I wanted to fill a comboBox with the list of devices but that is just not happening. Here’s the code snippet:

    midiOut = MidiOutput::createNewDevice("from MyApplication");
    if(midiOut) {
    } else {
        std::cout<<"Failed to create virtual MIDI Device"<<std::endl;
    StringArray inputDevices = midiIn->getDevices();
    StringArray outputDevices = midiOut->getDevices();
    std::cout<<"Input Devices: ";
    for (int i=0; i<inputDevices.size(); i++) {
        std::cout<<inputDevices[i]<<", ";
    std::cout<<"Output Devices: ";
    for (int i=0; i<outputDevices.size(); i++) {
        std::cout<<outputDevices[i]<<", ";
    deviceManager.setDefaultMidiOutput("from MyApplication");
    std::cout<<"Default MIDI Output Device: "<<deviceManager.getDefaultMidiOutputName()<<std::endl;

And the console output:
JUCE v2.0.40
Input Devices: from Max 1, from Max 2, from MyApplication,
Output Devices: to Max 1, to Max 2,
Default MIDI Output Device: from MyApplication

You see, it shows up as an “Input Device” and not output. But it does get selected when I use the set and get DefaultMidiOutput!

Could someone please point why?


Well… the reason is in the Juce’s documentation related to MidiOutput::createNewDevice:

This is creating a MIDI port for MIDI tunneling purpose. So if you create a MIDI Out in an application, another one will see it as a MIDI In. :wink:

Thank you CopperPhil.

Yes, other devices see this created virtual device properly, ie. as their input device (which is my application’s output device). It works with no problems. I only want to fill a combo box in my application with the list of MIDI output devices and include this created device in it. That does not seem to happen. It shows up in the list of input devices.

Did you ever figure this out? I’ve been having the exact same issue.