[wdmaudiodev] HD Audio WaveCyclic timing problems

  • From: Lex Nahumury <nahumury.l@xxxxxxxxx>
  • To: wdmaudiodev@xxxxxxxxxxxxx
  • Date: Tue, 12 Jan 2010 10:14:59 +0100

Hello,
This is my first post here and I hope some of you fine people can help
me out here.

I'm developing a HD Audio function driver targeting WIN XP SP3.
Everything so far works fine but I can't get the stream's position timing right.
That is, although the playback rate sounds ok, the rendered sound is
always garbled and I can't seem to find the solution.

Here is what I do;
Based on the "Microsoft Device Driver Interface for HD Audio" documentation I
use WaveCyclic and obtain a HDAUDIO_BUS_INTERFACE_BDL from the HD Audio DDI.
Since the function driver doesn't have a physical DMA object itself,
my stream class inherits from IDmaChannel and implements the
IMP_IDmaChannel member functions. (pretty much how it is done in the
MSVAD sample)

At pin creation time I do AllocateRenderDmaEngine() followed by
AllocateContiguousDmaBuffer() to create a PAGE_SIZE sized buffer.

In SetNotificationFreq() I compute the needed 10msec FramingSize,
  FramingSize_in_bytes = nBlockAlign * sampleRate * Interval / 1000;

I use that FramingSize;
- to set the current buffersize via SetBufferSize(FramingSize_in_bytes)
- to program the length of the first (and only) BDL entry
- and in the call to SetupDmaEngineWithBdl() with LVI = 1


In GetPosition() I readout the address I obtained earlier via
GetLinkPositionRegister().

  *Position = READ_REGISTER_ULONG( pPositionRegister )

I think I've done everything as described in the available HD Audio
documentation
but obviously I miss something.
Is there perhaps any additional work involved regarding the position timing?
I have tried compensating for the Fifo size but no luck so far.

Regards,
/Lex

Target;
- Win XP
- Intel ICH7 controller
- RealTec ALC272
******************

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: