WASAPI in exclusive mode?


#1

Any way it’s possible to get exclusive WASAPI to work in Juce? I’ve tried enabling it in the Juce code, but this leads to consistent crashes. Is it supposed to work if I manually enable the useExclusive flag? This is in Juce 1.51 by the way.


#2

It seemed to work ok when I wrote it… Where are you getting crashes?


#3

WASAPI exclusive crashes every time you setup a non-default buffersize.


#4

I guess that’s because when you’re using the hardware buffer, it won’t be able to change the size. Where’s it crashing though? Is this in a driver?


#5

I haven’t actually checked (blush). Will experiment with different buffer sizes first. Any reason it can’t be enabled easily without modifying Juce code though?


#6

Debugger breaks consistently on line 844 of juce_win32_WASAPI.cpp. Seems like inputDevice is a 0 pointer. No problem whatsoever with the same code using ASIO, DirectSound and CoreAudio on Mac.


#7

Just looks like a simple mistake to me. The line should probably be:

const DWORD result = useExclusiveMode ? (inputDevice != 0 ? WaitForSingleObject (inputDevice->clientEvent, 1000) : S_OK)

The exclusive mode stuff was only ever experimental, which is why there’s no public switch for it (and why it’s not 100% stable!)


#8

Thanks for the answers.


#9

When using exclusive mode I get consistently a logFailure here (line 289):

    HRESULT hr = client->IsFormatSupported (useExclusiveMode ? AUDCLNT_SHAREMODE_EXCLUSIVE : AUDCLNT_SHAREMODE_SHARED,
                                            (WAVEFORMATEX*) &format, useExclusiveMode ? 0 : (WAVEFORMATEX**) &nearestFormat);
    logFailure (hr);

It seems hr is AUDCLNT_E_UNSUPPORTED_FORMAT…


#10

Sounds like your driver doesn’t support exclusive mode…


#11

Hi Jules,

Happy Holidays and congrats on the merger with ROLI! Speaking of which, there is still the issue with WASAPI exclusive mode, as it is one of the final things I need in order to switch from Portaudio. That together with device specific volume control (which I'll provide patches for). Any issues filed in the roadmap for this one ? ;)

Regards

/Rob

 


#12

+1 for WASAPI Exclusive mode support

No need to merge it into "Windows Audio" somehow with an extra checkbox, just have another audio device type called "WASAPI Exclusive Mode".

Plus it is a 2 for 1 special. Add support for JUCE and get a new feature for Tracktion too. It can support exclusive mode like Reaper, Sonar and other DAWs.


#13

I've no idea what the bug above was about - this thread's 4 years old! I assume it must have been fixed though, as the thread seems to stop..


#14

That's actually a really good idea...


#15

FYI, I've added this now - would welcome some feedback, as I don't have any devices on my Windows set-up that support it..