Hey
I'm attempting to use an AudioDeviceManager object along with the AudioDeviceSelectorComponent to allow the user to select a device to send MIDI to.
Currently I'm using the following code to send a MIDI message:
MidiMessage midiMessage = MidiMessage::programChange(1, 10);
//If midi output exists (it won't if the user hasn't chosen an output device...)
if (audioDeviceManager.getDefaultMidiOutput())
{
audioDeviceManager.getDefaultMidiOutput()->startBackgroundThread();
audioDeviceManager.getDefaultMidiOutput()->sendBlockOfMessages(MidiBuffer(midiMessage),
Time::getMillisecondCounter(),
44100);
}
All works fine until I try to change the output device using the device selector component, which causes a Thread assertion error complaining that I'm trying to delete the MidiOutput object while it's thread is still running. However as this is handled within the AudioDeviceSelectorComponent, I don't know where I should be stopping the thread to prevent this error.
Where am I going wrong?
Thanks.
