1
0
Fork 0
mirror of https://github.com/juce-framework/JUCE.git synced 2026-01-10 23:44:24 +00:00

AudioDeviceManager: Fix MidiOutput dangling pointer

Changed the lifetime of the default MIDI oputput.
Removed the need for Timer workaround in AudioDeviceSelectorComponent.
This commit is contained in:
Oli 2022-05-10 15:44:30 +01:00 committed by Tom Poole
parent 319da1608d
commit 2bca60e52c
3 changed files with 4 additions and 16 deletions

View file

@ -1044,7 +1044,6 @@ AudioDeviceSelectorComponent::AudioDeviceSelectorComponent (AudioDeviceManager&
deviceManager.addChangeListener (this);
updateAllControls();
startTimer (1000);
}
AudioDeviceSelectorComponent::~AudioDeviceSelectorComponent()
@ -1098,16 +1097,6 @@ void AudioDeviceSelectorComponent::resized()
setSize (getWidth(), r.getY());
}
void AudioDeviceSelectorComponent::timerCallback()
{
// TODO
// unfortunately, the AudioDeviceManager only gives us changeListenerCallbacks
// if an audio device has changed, but not if a MIDI device has changed.
// This needs to be implemented properly. Until then, we use a workaround
// where we update the whole component once per second on a timer callback.
updateAllControls();
}
void AudioDeviceSelectorComponent::updateDeviceType()
{
if (auto* type = deviceManager.getAvailableDeviceTypes() [deviceTypeDropDown->getSelectedId() - 1])