# Some virtual MIDI Output ports non selectable on iOS

**URL:** <https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946>\
**Category:** MacOSX and iOS\
**Created:** [August 26, 2019, 10:34am UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946 "2019-08-26T10:34:50Z")\
**Posts on this page:** 14\
**Page:** 1

<div class="post-metadata">

**Author:** ![lelepar](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lelepar](https://forum.juce.com/u/lelepar)\
**Post date:** [August 26, 2019, 10:34am UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/1 "2019-08-26T10:34:50Z")

</div>

We have found that some virtual MIDI Output ports on iOS are no more selectable.  
It most likely happens since JUCE added the support to ID-based MIDI devices:

> <https://github.com/WeAreROLI/JUCE/commit/09ebd1d257614571c47af0d08a5f90ba01a7f5c0>

It is simple to check it with the AudioPluginHost example: in our case Ravenscroft 275 MIDI Output port is not selectable as MIDI Output port from the device manager, using a recent tip of JUCE, but it is selectable using a tip with name-based MIDI devices support.  
Indeed, other customers, using our Camelot host, experience the same issue with different virtual MIDI ports created by other Apps.

Any thoughts?

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [August 27, 2019, 2:16pm UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/2 "2019-08-27T14:16:17Z")

</div>

Can you provide some more details? I’ve tried to reproduce this by creating a new `MidiInput` device in a JUCE app on iOS and I’m able to select and use this device as a MIDI output in the AudioPluginHost. Does it only occur with MIDI ports created by other apps?

---

<div class="post-metadata">

**Author:** ![lelepar](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lelepar](https://forum.juce.com/u/lelepar)\
**Post date:** [August 27, 2019, 4:08pm UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/3 "2019-08-27T16:08:01Z")

</div>

It’s difficult to say exactly and difficult (at least for us) to debug. It happens under some circumstances when selecting MIDI ports created by other Apps. The problem is also that it is not systematically reproducible on any iPad.

Please check this video, as an example. It shows AudioPluginHosts on iPad Pro 2017, iOS 12.4.1, trying to select Ravenscroft275 virtual MIDI port:

[JUCE AudioPluginHost virtual MIDI out issue.zip](https://forum.juce.com/uploads/short-url/eq8v2rbKQl1WKSXEs3ulwQcaZ9Y.zip) (920.1 KB)

I use by purpose AudioPluginHost to exclude any issue in our implementation.  
Our software Camelot has the ability to select multiple MIDI outputs at the same time. Another issue has been reported when connecting an external MIDI device that exposes several MIDI ports: when the device is connected the virtual MIDI ports cannot be selected, when the device is disconnected the virtual MIDI ports can be selected (see the attached screenshot).

NOTE: the user did not experience those issues with Camelot build made before ID-based MIDI device support in JUCE.

 ![dgBtojhfT9%20QNij5zOVgyA_thumb_cee](https://us1.discourse-cdn.com/flex026/uploads/juce/original/2X/c/cd31cee91d6cb80c3d9181f96e3e8d3c989df841.jpeg)

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [September 3, 2019, 9:06am UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/4 "2019-09-03T09:06:54Z")

</div>

Do you see any CoreMidi errors in the log when you try and connect to one of these MIDI ports?

---

<div class="post-metadata">

**Author:** ![lelepar](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lelepar](https://forum.juce.com/u/lelepar)\
**Post date:** [September 3, 2019, 2:26pm UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/5 "2019-09-03T14:26:47Z")

</div>

Here is the CoreMIDI error we see when try to select the virtual MIDI port of Ravenscroft275:

**CoreMIDI error: 62 - ffffd5ac**

Note that it works fine with JUCE 5.4.3 (dc1cf29cae85992f282af5d6519ccdaf73b7f6af)

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [September 3, 2019, 2:38pm UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/6 "2019-09-03T14:38:44Z")

</div>

OK, that’s interesting. It seems like those ports aren’t working because they have been created with a `kMIDIPropertyUniqueID` which isn’t an integer. Can you change the `getMidiObjectInfo()` method in `juce_mac_CoreMidi.cpp` to the following and see if it fixes the issue:

```auto
static MidiDeviceInfo getMidiObjectInfo (MIDIObjectRef entity)
{
    MidiDeviceInfo info;

    {
        ScopedCFString str;

        if (CHECK_ERROR (MIDIObjectGetStringProperty (entity, kMIDIPropertyName, &str.cfString)))
            info.name = String::fromCFString (str.cfString);
    }

    SInt32 objectID = 0;

    if (CHECK_ERROR (MIDIObjectGetIntegerProperty (entity, kMIDIPropertyUniqueID, &objectID)))
    {
        info.identifier = String (objectID);
    }
    else
    {
        ScopedCFString str;

        if (CHECK_ERROR (MIDIObjectGetStringProperty (entity, kMIDIPropertyUniqueID, &str.cfString)))
            info.identifier = String::fromCFString (str.cfString);
    }

    return info;
}

```

---

<div class="post-metadata">

**Author:** ![lelepar](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lelepar](https://forum.juce.com/u/lelepar)\
**Post date:** [September 3, 2019, 3:35pm UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/7 "2019-09-03T15:35:41Z")

</div>

Seems better. The port can be selected now, but we still receive several “CoreMIDI error: 62 - ffffd5ac” after enabling or disabling the port:

```
:: Enabled output port: Ravenscroft275, net.uvi.Ravenscroft275.Ravenscroft275.input
CoreMIDI error: 62 - ffffd5ac
CoreMIDI error: 62 - ffffd5ac
CoreMIDI error: 62 - ffffd5ac
...
```

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [September 3, 2019, 3:40pm UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/8 "2019-09-03T15:40:12Z")

</div>

It is still technically an error as the docs state that `kMIDIPropertyUniqueID` should be an integer so I’d like to keep the `CHECK_ERROR` macro wrapper around the initial call to `MIDIObjectGetIntegerProperty()` but fall back to checking for a string property if this fails. Just to confirm, the port is working correctly with this change (albeit with those error messages)?

---

<div class="post-metadata">

**Author:** ![lelepar](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lelepar](https://forum.juce.com/u/lelepar)\
**Post date:** [September 3, 2019, 3:41pm UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/9 "2019-09-03T15:41:48Z")

</div>

Ok.

Yes! The port is working. Now we are preparing a beta-version of our software to be tested by those users that reported the problem… I’m afraid there are several Apps with that issue

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [September 3, 2019, 3:42pm UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/10 "2019-09-03T15:42:10Z")

</div>

OK, I’ll get that fix pushed to develop now.

---

<div class="post-metadata">

**Author:** ![ed95](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/ed95/32/7635_2.png) [@ed95](https://forum.juce.com/u/ed95)\
**Post date:** [September 3, 2019, 4:02pm UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/11 "2019-09-03T16:02:47Z")

</div>

> <https://github.com/WeAreROLI/JUCE/commit/405085144309654feb328933c0eba3e168160a50>

---

<div class="post-metadata">

**Author:** ![lelepar](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lelepar](https://forum.juce.com/u/lelepar)\
**Post date:** [September 13, 2019, 2:02pm UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/12 "2019-09-13T14:02:12Z")

</div>

Just seen commit aa219c5a0 “Fixed a typo in CoreMIDI that caused it to recognise the wrong the wrong number of input devices” … that explains the other part of my report

---

<div class="post-metadata">

**Author:** ![stephenk](https://sea2.discourse-cdn.com/flex026/user_avatar/forum.juce.com/stephenk/32/15198_2.png) [@stephenk](https://forum.juce.com/u/stephenk)\
**Post date:** [September 13, 2019, 6:40pm UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/14 "2019-09-13T18:40:25Z")

</div>

> [@lelepar](#):
>
> Just seen commit aa219c5a0 “Fixed a typo in CoreMIDI that caused it to recognise the wrong the wrong number of input devices”

I reported that bug and the title is wrong. It was reporting the wrong number of _OUTPUT_ devices. So it may or may not explain the other part of your report…

---

<div class="post-metadata">

**Author:** ![lelepar](https://avatars.discourse-cdn.com/v4/letter/l/c68b51/32.png) [@lelepar](https://forum.juce.com/u/lelepar)\
**Post date:** [September 13, 2019, 6:46pm UTC](https://forum.juce.com/t/some-virtual-midi-output-ports-non-selectable-on-ios/34946/15 "2019-09-13T18:46:24Z")

</div>

Yes, the title is wrong. I just mentioned the commit message. In our case, when a multi-output MIDI device was connected, it was impossible to select some other ports.
