WASAPI Shared mode

Post Reply
User avatar
xenobioz
Posts: 117
Joined: Wed Nov 23, 2011 11:20 am
Contact:

WASAPI Shared mode

Post by xenobioz »

Does anyone use WASAPI in shared mode? I would want to but the sound gets completely distorted. In exclusive mode it sounds ok.
Shared WASAPI does work well in other programs though. Maybe the wave out driver for buzz needs to updated.
I often need the shared mode.

The configuration window shows some that might have something to do with it.
*** CAudioDriver::Configure ***
*** CAudioDriver::Stop ***
*** CAudioDriver::Start ***
GetMixFormat: sr 48000 bps 32 nch 8
Using WAVE_FORMAT_EXTENSIBLE, KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
GetDevicePeriod: def 10ms min 3ms
Initialize: sr 48000 bps 32 nch 8
*** CAudioDriver::WriteConfig ***
GetBufferSize: 1056
GetStreamLatency: 0ms
*** CAudioDriver::Configure ***


Could 0ms on GetStreamLatency be the problem. on exclusive it's 3ms. If it's the latency for the sound then 0 sounds too small. :lol:
User avatar
IXix
Posts: 1113
Joined: Wed Nov 23, 2011 3:24 pm

Re: WASAPI Shared mode

Post by IXix »

I've been using shared WASAPI since Buzz got WASAPI output. Never noticed any problems with it though perhaps I don't push it very hard. I happen to be using 16/44.1 right now but it seems to work fine at different sample rates and bit depths too.

Code: Select all

*** CAudioDriver::CAudioDriver ***
*** CAudioDriver::Initialize ***
*** CAudioDriver::ReadConfig ***
*** CAudioDriver::Start ***
GetMixFormat: sr 44100 bps 32 nch 2
Using WAVE_FORMAT_EXTENSIBLE, KSDATAFORMAT_SUBTYPE_IEEE_FLOAT
GetDevicePeriod: def 10ms min 3ms
Initialize: sr 44100 bps 32 nch 2
GetBufferSize: 896

GetStreamLatency: 11ms

*** CAudioDriver::Configure ***
I generally just use it when I'm using my laptop's internal sound but it seems to work with my old FastTrack Pro too IIRC.
User avatar
mcbpete
Posts: 381
Joined: Tue Nov 22, 2011 9:45 pm

Re: WASAPI Shared mode

Post by mcbpete »

Are you running Windows (or whatever apps you're running simultaneously) at 48khz too ? Maybe it's freaking out trying to output different sample-rates at the same time if not ?
User avatar
UNZ
Posts: 808
Joined: Mon Nov 21, 2011 9:42 pm
Contact:

Re: WASAPI Shared mode

Post by UNZ »

xenobioz wrote:Maybe the wave out driver for buzz needs to updated.
having recently written a wasapi driver, yes, the one in buzz is not ideal and doesn't handle all the corner cases correctly. for example it frequently defaults to 16bit when 32bit would actually be possible / correct. i suspect your distortion is a bitrate conversion issue actually (i think the buzz driver doesn't support 32bit int at all, or was it float, can't remember, but there's no reason not to). i also remember some issue with distortion in 32bit (or 24bit not sure anymore) output where the output level was slightly too high after (seemingly correct) clamping which i had to take care of. they also worked around this issue in the psycle wasapi driver btw.

another thing that could go wrong is the channel count (it shows 8 in your case, and i specifically had to handle cases > 2 in my code to get it to route to the right channels and interleave correctly), not sure if this is handled correctly in the buzz driver now.

one problem that has no workaround sadly: in shared mode on my RME, if the buffersize in wasapi is bigger than what i set in the device settings for my RME audio driver, i get completely garbled output. the only fix is to adjust the WDM buffer size in the RME control panel, wasapi doesn't expose any api to do this (unlike ASIO for example). this leads to the absurd situation that on professional cards, wasapi is actually less "integrated" than on onboard stuff (where there simply are no such settings and the defaults magically work). so, if getbuffersize reports for example 512, then try to set your card's buffers size to that too, or just try different sizes... however if shared mode works well in other apps, most likely this is not the issue, but the buzz driver is at fault.

(no wonder, implementing wasapi is far messier than i expected from a new and generally pretty good api, i needed to test on lots of different hardware to get out all the kinks... the problems stem more from the underlying hardware drivers and lack of integration with the device driver than wasapi itself).
User avatar
xenobioz
Posts: 117
Joined: Wed Nov 23, 2011 11:20 am
Contact:

Re: WASAPI Shared mode

Post by xenobioz »

I'm using windows at 48khz and with an integrated sound card. If set to 44.1 in buzz it jumps back to 48khz IIRC. CPU is not a problem. The garbled sound reminds a bit like running through a really short delay, but rougher.
Hopefully the driver can be updated.
User avatar
IXix
Posts: 1113
Joined: Wed Nov 23, 2011 3:24 pm

Re: WASAPI Shared mode

Post by IXix »

Just had my first real music making (rather than machine testing) session on my new Win10 laptop and I noticed some almost vinyl like crackling on the output. Eventually discovered (after trying everything else!) that switching the WASAPI driver to exclusive solved the problem. Tried in both 32 and 64 bit Buzz with the same result.
Post Reply