AudioDeviceManager - How do I add an AudioIODeviceType?


#1

Hi Jules,

When adding a custom AudioIODeviceType to an AudioDeviceManager, I can’t use it because the “AudioDeviceManager::lastDeviceTypeConfigs” crashes due to it trying to get a configuration for it, when there isn’t one!

It seems that the configs only get added in AudioDeviceManager::createDeviceTypesIfNeeded(), which is useless when using a custom type…

Unless I’m missing something very important, I think AudioDeviceManager::addAudioDeviceType() needs to be tweaked to something like this:

void AudioDeviceManager::addAudioDeviceType (AudioIODeviceType* newDeviceType)
{
    jassert (newDeviceType != nullptr);
    availableDeviceTypes.add (newDeviceType);
    lastDeviceTypeConfigs.add (new AudioDeviceSetup());
    newDeviceType->addListener (callbackHandler); //The new type also doesn't add the ADM as a Listener...
}

#2

Hmm, that does seem to be a bit of an oversight. Thanks!