[wdmaudiodev] WaveRT event driven Capture in exclusive mode

  • From: "Markus Bollinger" <bollinger@xxxxxxxxxxxx>
  • To: <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Fri, 13 Mar 2009 18:27:31 +0100

Hello,

I try to implement the Event driven mode in my WaveRT driver for a
Playback and Capture device.

Playback works as expected, but with capture I found some strange
behaviour :

When my driver notifies the first time the capture event after Start
(the DMA has passed the middle of the circular buffer),

A Wasapi application then gets out of its WaitFor***Object and tries to
do : pCaptureClient->GetBuffer(&pDataIn, &packetLength, &flags,
&position, NULL); and gets as result AUDCLNT_S_BUFFER_EMPTY which is NOT
as expected !!!

On the following notifications, GetBuffer() works, but the application
is getting back the wrong half of the circular (pin-pong) buffer !!!
On the second notification it gets the first buffer back that is at this
moment newly getting filled by the DMA !!!

To avoid this Error, I tried following:

- returning error in CMiniportWaveRTStream::GetPositionRegister()
- adding offset to Position->PlayOffset=Position->WriteOffset in the
CMiniportWaveRTStream::GetPosition() method

Result : When the position returned by GetPosition() is 512 bytes (64
stereo samples offset) or more behind the middle of the circular buffer,
everything gets working : the app is getting back the first half of the
circular buffer after the first notification.

YES, I know there is a function called
CMiniportWaveRTStream::GetHWLatency(), where the hwLatency->FifoSize
should indicate some offset,
But all values that I put there don't change anything.

In http://msdn.microsoft.com/en-us/library/ms678736.aspx I found that
exclusive-mode event-driven capture is broken on Vista RTM, but it
should be fixed in SP1, not ?

Who knows what goes wrong ???


Markus.

P.S. my adapter can be configured with DMA size = 8,16 or 32 samples, so
it would not be nice to abandon the GetPositionRegister() method and add
some offset that increases the latency !!!
******************

WDMAUDIODEV addresses:
Post message: mailto:wdmaudiodev@xxxxxxxxxxxxx
Subscribe:    mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=subscribe
Unsubscribe:  mailto:wdmaudiodev-request@xxxxxxxxxxxxx?subject=unsubscribe
Moderator:    mailto:wdmaudiodev-moderators@xxxxxxxxxxxxx

URL to WDMAUDIODEV page:
http://www.wdmaudiodev.com/

Other related posts:

  • » [wdmaudiodev] WaveRT event driven Capture in exclusive mode - Markus Bollinger