Re: Mystic 'Playback stops' problem with waveInPrepareHeader, waveInAddBuffer etc.

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: Kurt Grittner (grittkmg_NO_SPAM__at_mailbag.com)
Date: 04/12/04


Date: Mon, 12 Apr 2004 10:51:18 -0500

Hi Chris,

Yes, the docs are vague. The critical sentence is:

"This function MUST<my caps> be called after the device driver fills a
buffer and returns it to the application."

But unfortunately, it doesn't say how soon this must be done. This
has led device driver writers towards incompatible implementations
with regards to the reuse issue. I agree that if you are only using
modern sound cards you are probably ok reusing accross AddBuffer
boundaries. If you are targeting every win32 implementation and sound
card on the entire planet, then it is wise to play it safe.

If you use a thread for wavein and another thread for waveout, and you
have a sufficiently deep record buffer pool, then you should not get
into any performance issues when preparing/unpreparing with every use.

Kurt

On Mon, 12 Apr 2004 11:33:59 -0400, "Chris P. [MVP]"
<msdn@chrisnet.net> wrote:

>
>Yes, waveInUnprepareHeader cleans up after waveInPrepareHeader. The
>documentation simply says you must wait until the driver is finished with
>the buffer before calling, i.e. "not playing the buffer" and that you should
>call before freeing the buffer. There is nothing that says you must call
>after each and every call to waveInAddBuffer, but rather when you are "done"
>with the buffer.
>
>This is going to continue to be a point of contention until the docs
>explicitly say one way or the other. Nor will it help in the case of buggy
>Windows 98 drivers.
>
>-Chris
>



Relevant Pages

  • Re: Lock memory ?
    ... use FILE_FLAG_NO_BUFFERING to avoid file cache bloat (which can ... to make sure the buffer is properly aligned. ... > The written data is first buffered in memory, ... > Maybe they use a device driver? ...
    (microsoft.public.vc.mfc)
  • Re: input as well output through DeviceIoControl
    ... > buffer of information to the device driver and then get some ... > driver's ioctl processor in the following: ... You must never touch the buffer ... the InputBufferLength in it are filled from the app's ...
    (microsoft.public.development.device.drivers)
  • DMA cause system crash/hang (I think)
    ... the user calls the ioctl first specifying a buffer for the receive ... caculate number of DMA pages required for operation. ... mmchainto retrieve physical address of output DMA pages. ... I'm a Windows Device Driver ...
    (comp.os.lynx)
  • Re: Why is my recording so distorted?
    ... Allright, the errors in this one are not as severe as what I got last night, but there's quite a number of them--fuzzy skips and blips, beginning sometime after the first several seconds. ... This can happen if the system is under heavy load, but it's more likely to be the device driver. ... Chipset issues can also cause this.. ... although it is lessened by increasing the latency (and thus the buffer size). ...
    (rec.games.computer.ultima.dragons)
  • Re: Mystic Playback stops problem with waveInPrepareHeader, waveInAddBuffer etc.
    ... > modern sound cards you are probably ok reusing accross AddBuffer ... > If you use a thread for wavein and another thread for waveout, ... > have a sufficiently deep record buffer pool, ... > into any performance issues when preparing/unpreparing with every use. ...
    (microsoft.public.win32.programmer.mmedia)