I'm trying to implement audio streaming using the new Wasapi API.
I've managed to make shared mode for recording and playback work but I'm stuck with getting exclusive mode work (AUDCLNT_SHAREMODE_EXCLUSIVE flag).
Everything seems to work (i.e. all the calls to IAudioClient etc. return success) but after I call IAudioClient::Start() it seems that the actual streaming never begins, and the callback events are never set.
A similar problem happens when capturing in shared mode, the callback event is never set, but I get around that by polling GetCurrentPadding() to see if there's data ready. This doesn't work in exclusive mode because GetCurrentPadding() always reports 0 for capture and on rendering no sample gets 'consumed' by the driver (i.e. the padding count increases as I send a new buffer but it never decreases as frames are streamed by the driver).
Any help would be greatly appreciated.
at the bottom. It says that the current driver may not support exclusive_mode yet. Don't know when the Vista upgrade is available.
But even I use control panel to set my special device to be exclusive mode, the data send done to device still be DSP(ed). Any solution? Any small tool allow me to send my own data to my device without any processing? I tried many tools include cooledit. Could you help?
Exclusive mode isn't an attribute of an audio device, instead it's a description of how an application interacts with the audio solution.
So you can't "set a device to be exclusive mode", all you can do is to decide if you want an application to be able to USE your device in exclusive mode.
Simple question is how can I send audio data from a opened file to my device (an USB audio device) without been processed? I had some info coded in the audio data for some special purpose. My device works on XP etc. But for Vista, I found that the data is be processed.
That's exactly what I was doing, comipiling for x86 but running on x64 OS. I later discovered that exclusive playback seems to work in x64 Vista only for x64 native processes. Is that by design or is it a bug?
I'm also still having problems with Wasapi capture + event notification. It seems to work without event notification, but when I select the event notification flag the event is never raised. Event notification works ok on playback.
How do you set up your event when you call CreateEvent()? Is it auto or manual reset? The MSDN documentation does not discuss this issue at all.
I've not yet got my Vista system running so cannot actually try this out myself.
Please let me know if this makes a difference.
Jerry (jerry @ novadsp dot com)
I'd be interested to know if anyone has discovered a solution to the capture event problem. I'm seeing the same issue with either manual or auto-reset events. Will someone from MS please comment on this? It's obviously either broken or has a non-obvious solution. Thanks.
Thanks for the reply, Matthew, but I'm runing the 32-bit flavor of Vista. Am I incorrect in assuming that I'm not using WOW64?
Yes... I think I was conflating two issues.
Exclusive mode event-driven render across WOW64 is broken in Vista RTM.
All event-driven capture is broken in Vista RTM.
This is an interesting assertion. Is your conclusion based on first-hand experience or is it a fault acknowledged by Microsoft in Vista RTM? Please understand that I'm not dissing you, I just need to know that trying to get event based capture to work on existing Vista builds is futile :-)
OK, here's the scoop (note to self: research first, then post.)
On Vista RTM...
Exclusive mode render from an x86 app on Vista x64 to a non-WaveRT device is broken in Vista RTM.
Shared mode is OK; native x64 and native x86 are OK; HD Audio devices are OK.
Also on Vista RTM...
Event-driven capture doesn't work. Period. (The "data ready" event is never set.)
Both are (should be) fixed in Vista SP1.
I am a Software Development Engineer in Test for the Windows Sound Team, so you may consider this official Microsoft acknowledgement.
"Official"-er acknowledgement of the event-driven capture issue is here:
The initial release of Windows Vista supports event-driven buffering (that is, the use of the AUDCLNT_STREAMFLAGS_EVENTCALLBACK flag) for rendering streams only.