AudioDeviceSelctorComponent triggers win32_WASAPI read acces violation


Trying to modify/create our own implementation of AudioDeviceSelectorComponent we stumpled across an error. Our app started crashing with the “read acces violation” in the juce_win32_WASAPI.cpp.

We tested the DemoRunner for 5.4.5 and 5.4.7 and it is easy to reproduce the error. It might be a bug in the WASAPI code, related to thread safety.

How to reproduce in DemoRunner:

  1. Navigate to AudioSettingsDemo.h or the gear knob/settings where the AudioDeviceSelectorComponent is present.
  2. Set audio device type to Windows Audio.
  3. Set output: Speakers/Headphones(Realtek® Audio)
  4. Set input: Microphone (Realtek® Audio)
  5. Enable/Disable Active input channels a few times and the error occurs.

On my Win10 PC the error occurs first time I disable the input, but on my colleagues Win10 PC we have to enable/disable few times before the error occurs.

Setup screenshot:


When breaking and hovering the outputDevice in line 1295, Visual Studio tells us that the outputDevice is empty. We guess that means it is a nullptr?

Call Stack:

DemoRunner.exe!juce::WasapiClasses::WASAPIAudioIODevice::run() Line 1297	C++
DemoRunner.exe!juce::Thread::threadEntryPoint() Line 96	C++
DemoRunner.exe!juce::juce_threadEntryPoint(void * userData) Line 119	C++
DemoRunner.exe!juce::threadEntryProc(void * userData) Line 62	C++

Hope you can help os identify/solve the problem.


This should now be fixed on develop with commit 0ff16dd. Thanks for reporting!

1 Like