From 240089bcbc2a6359272391397f301fc7658d946e Mon Sep 17 00:00:00 2001 From: ed Date: Wed, 17 Feb 2021 18:21:00 +0000 Subject: [PATCH] AudioDeviceManager: Fixed backwards compatibility when passing an empty string to removeMidiInputCallback() --- .../audio_io/juce_AudioDeviceManager.cpp | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp index f613f16479..07903f3f2d 100644 --- a/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp +++ b/modules/juce_audio_devices/audio_io/juce_AudioDeviceManager.cpp @@ -1146,12 +1146,19 @@ void AudioDeviceManager::addMidiInputCallback (const String& name, MidiInputCall void AudioDeviceManager::removeMidiInputCallback (const String& name, MidiInputCallback* callbackToRemove) { - for (auto& device : MidiInput::getAvailableDevices()) + if (name.isEmpty()) { - if (device.name == name) + removeMidiInputDeviceCallback ({}, callbackToRemove); + } + else + { + for (auto& device : MidiInput::getAvailableDevices()) { - removeMidiInputDeviceCallback (device.identifier, callbackToRemove); - return; + if (device.name == name) + { + removeMidiInputDeviceCallback (device.identifier, callbackToRemove); + return; + } } } }