[wdmaudiodev] Re: WaveRT weird problem

  • From: Matthew van Eerde <Matthew.van.Eerde@xxxxxxxxxxxxx>
  • To: "wdmaudiodev@xxxxxxxxxxxxx" <wdmaudiodev@xxxxxxxxxxxxx>
  • Date: Thu, 27 Oct 2011 16:06:37 +0000

WASAPI will use the default format specified in the Sound control panel, which 
can be anything the driver supports.  The inbox HD Audio class driver supports 
24 bits per sample only in 32-bit containers.

The KS client (typically the WASAPI audio engine) requests a buffer size, but 
the driver is free to change that buffer size to something that meets its 
alignment requirements:

http://msdn.microsoft.com/en-us/library/ff537494(VS.85).aspx
KSRTAUDIO_BUFFER_PROPERTY.RequestedBufferSize <-- what the KS client asks for 
(not necessarily aligned)

http://msdn.microsoft.com/en-us/library/ff537493(v=VS.85).aspx
KSRTAUDIO_BUFFER.ActualBufferSize <-- what the driver gives back (should be 
aligned)

The 128-byte alignment requirement comes from Intel's spec:
http://www.intel.com/content/www/us/en/standards/standards-high-def-audio-specs-general-technology.html

4.5.1 Stream Data in Memory
"Each individual buffer must contain an integer number of samples, but blocks 
and packets may be split across multiple buffers.  The buffer must start on a 
128-byte boundary and must contain at least one sample of data.  For highest 
efficiency, the following guidelines should be met in buffer allocation: 
The buffer should have a length which is a multiple of 128. 
The buffer should contain at least one full packet of information."

A 5.1 stream will thus have a buffer size which is a multiple of 128*3 = 384 
bytes; a 5.1 stream of 24-bit samples in 24-bit containers will have a buffer 
size which is a multiple of 128*3*3 = 1152 bytes.  (I suspect it is for this 
reason that hdaudio.sys favors 24-bit samples in 32-bit containers, but 
usbaudio.sys favors 24-bit samples in 24-bit containers.)

-----Original Message-----
From: wdmaudiodev-bounce@xxxxxxxxxxxxx 
[mailto:wdmaudiodev-bounce@xxxxxxxxxxxxx] On Behalf Of Robert Bielik
Sent: Wednesday, October 26, 2011 11:22 PM
To: wdmaudiodev@xxxxxxxxxxxxx
Subject: [wdmaudiodev] Re: WaveRT weird problem

Robert Bielik skrev 2011-10-27 06:15:
> But that's an interesting point though, the 128 byte alignment issue. Where 
> is that documented on MSDN ? I.e. it would be good to have a link to the 
> relevant HD audio spec with regard to the RequestedBufferSize field of 
> KSRTAUDIO_BUFFER_PROPERTY...

I'm curious though, since I query the buffer for 5292 bytes (6 byte 
nBlockAlign), I don't see how that'll work, since GCD(5292,128) = 4. How does 
the WASAPI backend handle this, does it use wBitsPerSample=32 & 
wValidBitsPerSample=24 ?

TIA
/Rob
******************

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/


******************

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: