[hpsdr] buffer over/underflow (was Mercury sampling rate)

Chris Stratton cs11102 at yahoo.com
Mon Apr 14 14:02:12 PDT 2008


I2PHD wrote:

>Have you ever written a program that talks to a sound

>card under Windows, using the MME subsystem ?

Using the windows WAVEHDR mechanism, yes.  And I
believe you have the option to change the size of the
buffers: to quote from MSDN's commentary on
waveOutPrepareHeader:

"The dwFlags, dwBufferLength, and dwLoops members of
the WAVEHDR structure can change between calls to this
function and the waveOutWrite function. (The only
flags that can change in this interval for the dwFlags
member are WHDR_BEGINLOOP and WHDR_ENDLOOP.) If you
change the size specified by dwBufferLength before the
call to waveOutWrite, the new value must be less than
the prepared value."

But even if you can't there are still some choices:

1) Prepare yourself an undersize buffer.  Only put it
in the queue when you need to get ahead or behind,
otherwise use only your standard size ones.

2) Make something that repackages the data into
standard size buffers.  Yes, it's not elegant, but not
as bad as a variable resampler - it's just a pair of
less than megaword aligned memcopies and a little
logic.

But I think using the audio DAC on the custom hardware
is the cleanest approach anyway - for one thing, it
gets soundcard variability and drivers out of the
picture.



      ____________________________________________________________________________________
Be a better friend, newshound, and 
know-it-all with Yahoo! Mobile.  Try it now.  http://mobile.yahoo.com/;_ylt=Ahu06i62sR8HDtDypao8Wcj9tAcJ

 1208206932.0


More information about the Hpsdr mailing list