How to check a correct input device was selected?

Hello!

We first tried getCurrentAudioDevice, but that sometimes gives null, if the user has not selected anything apparently…

So, what should we check to see if an input audio device was selected?

AudioDeviceManager::AudioDeviceSetup setup;
m_AudioDeviceManager->getAudioDeviceSetup(setup);
if (setup.inputDeviceName.isNotEmpty())
{
}

Like this? Isn’t there a shortcut to this, or something like ???.isInputDeviceValid()

  • bram

I don’t really understand what you mean by “correct”… Personally, I’d say that if the current device is non-null, then they’ve selected a device (?)

Well sometimes getCurrentAudioDevice is not null, but getting the getAudioDeviceSetup gives values anyway. Sometimes it’s a previous device (or some default?), sometimes the inputDeviceName is not set.

Should we assume that if getCurrentAudioDevice is null, the getAudioDeviceSetup values are not correct?

I’m just wondering what the correct time is to initialize everything for the first time: for example with the samperate of the input device.

  • bram

I think getAudioDeviceSetup will attempt to give you some defaults, or the last settings that you gave it. So I guess you could say that if there’s no device open, that’d be a good time to initialise any settings that you need to change.