thestk / rtaudio

A set of C++ classes that provide a common API for realtime audio input/output across Linux (native ALSA, JACK, PulseAudio and OSS), Macintosh OS X (CoreAudio and JACK), and Windows (DirectSound, ASIO, and WASAPI) operating systems.
Other
1.49k stars 318 forks source link

WASAPI hang while waiting for buffers to get rolling in DUPLEX mode #371

Closed ddf closed 1 year ago

ddf commented 1 year ago

It appears to be the case that when the sample rates of the default Playback and Recording devices are different in the Windows Sound properties, that either one or the other will never start rolling and the callbackEvent hangs here:

https://github.com/thestk/rtaudio/blob/a3e9aa621e65a0744f125e9740d057a4d088e0e9/RtAudio.cpp#L7394

I'm encountering this when using the Primary Sound Device for both input and output. In my particular test case, it's typically the input that never starts rolling. I encountered this using RtAudio 5.0.0 but the same thing occurs on 5.2.0. The only difference as far I can tell is that when enumerating device info using 5.0.0 there is a Default Device with input and output channels, but in 5.2.0 there are separate Primary Sound Driver and Primary Sound Capture Driver devices. In both cases, devices with only inputs report far fewer sampleRates and the preferredSampleRate is 0. I am attempting to open a stream with the two default devices as input and output and a sample rate that both of them claim to support (44100 in my case).

MarcusTomlinson commented 1 year ago

Can you please write some minimal example code that reproduces this and share here. Thanks.

garyscavone commented 1 year ago

This was reported a while ago and as far as I can tell, no code snippet was provided, so I am closing this.