AudioDeviceManager not calling changelistener when Midi ports change on mac

This is specific to the Mac. It affects Macos 12 and probably other versions. Windows 11 works fine.

The AudioDeviceManager notifies ChangeListeners the first time a device connects but not for subsequent connetions or disconnections.

In my class I have something like this going on:

MyAudioManager (AudioDeviceManager& audioDeviceManager)
{
    audioDeviceManager.addChangeListener (this);
}

void changeListenerCallback (ChangeBroadcaster* source) override
{
    // called reliably on the PC but only seems to work once per device on the Mac
}

looking at juce_mac_CoreMidi.mm, static void globalSystemChangeCallback(...) contains a todo which I think is relevant.
It probably needs to act on these messages: Apple Developer Documentation

HTH

It looks like this was only accidentally ‘working’ on Windows.

I’ve fixed our WASAPI support so that it will only send notifications when a WASAPI device is added or removed. Previously, it notified whenever any devices, including MIDI devices, changed.

I’ve now updated the MIDI backends to send change notifications when devices are added and removed. These notifications can be received by listening to the AudioDeviceManager.

1 Like