Lex Nahumury wrote:
That might be too small. I found I needed a larger buffer than this for playback/record operations involving high sample rates, sample widths and number of channels. In the end I ended up computing a size relative to nAvgBytesPerSec.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.
That's not quite right for a HD audio device (at least in my experience). For GetPosition you need the position of the current sample actually being played or recorded. To do this for HD Audio you need to to adjust the link position register value using the FifoSize (you can get this from the HD Audio interface). For Capture streams return LinkPosition - FifoSize, for render streams return LinkPosition + FifoSize. Return 0 if the stream is stopped.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 )
Mike -- Mike Pumford, Senior Software Engineer MPC Data Limited e-mail: mpumford@xxxxxxxxxxxxxx web: www.mpc-data.co.uk tel: +44 (0) 1225 710600 fax: +44 (0) 1225 710601 ddi: +44 (0) 1225 710635 MPC Data Limited is a company registered in England and Wales with company number 05507446 Registered Address: County Gate, County Way, Trowbridge, Wiltshire, BA14 7FJ VAT no: 850625238 The information in this email and in the attached documents is confidential and may be legally privileged. Any unauthorized review, copying, disclosure or distribution is prohibited and may be unlawful. It is intended solely for the addressee. Access to this email by anyone else is unauthorized. If you are not the intended recipient, please contact the sender by reply email and destroy all copies of the original message. When addressed to our clients any opinions or advice contained in this email is subject to the terms and conditions expressed in the governing contract. ****************** 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/