Initialise AudioDeviceManager return empty result String when there’s no available audio device.
But it was failed actually. (No way it should succeed in this situation)
But the document said:
an error message if anything went wrong, or an empty string if it worked ok.
returning an empty String should mean that the initialisation have succeeded, but in this case it’s not.
So I think this might be a JUCE bug.
I still get the same error message as above when I run that code with the input and output devices disabled in the Windows sound preferences.
Can you try stepping through in the debugger and see what the values of outputIndex and inputIndex are at this line? They should both be 0 if no devices have been found. Also, I’m assuming that you are using the default juce_audio_devices settings and that you’re using WASAPI and not ASIO but please let me know if you have a different setting.
Hi ed,
I did some testing on different environments, and found that, in JUCE 5.4.1 release (is what we’re using in our project), this bug exits, and I can’t hit the breakpoint of the line you said.
But in current develop brunch, I do get the error message you said, but the “outputIndex” and “inputIndex” are in value of “-1”.
Functionally, this bug seems to have been fixed on the develop branch, but I don’t know if this “-1” is something that you don’t expect to see.
Anyway, we have workaround manually in our project (which is using JUCE 5.4.1) by checking whether the “currentDevice” is nullptr.
And because we want our project to be stable, and don’t need to update JUCE’s module code everyday, so we choose to use only the code in master brunch.
So, looking forward for your future release!
Sorry I meant -1, that all looks correct. There have been a number of improvements to the AudioDeviceManager and its associated classes since 5.4.1 which will make their way into the next stable release.
As the develop branch moves quite quickly it’s always worth checking bugs against it before posting on the forum as they may have already been fixed.