ALSA: Call snd_pcm_drain instead of a buggy homegrown version

Vitaliy Margolen wine-devel at kievinfo.com
Mon Jul 25 12:02:18 CDT 2005


Monday, July 25, 2005, 10:08:40 AM, Robert Shearman wrote:
> Vitaliy Margolen wrote:

>>Isn't WODM_RESET should stop playback/recording immediately? In which case
>>shouldn't we use snd_pcm_drop instead?
>>  
>>

>  From MSDN:
> The *waveOutReset* function stops playback on the given waveform-audio 
> output device and resets the current position to zero. All pending 
> playback buffers are marked as done and returned to the application.
Well that's the part that's not really clear to me. It doesn't say "what
playback/recording does with those buffers".
I could imagine a program (that's say winamp) playing a song. Not sure how big
of a buffers it's using, but that's say big enough to minimize cpu usage. You
hit a stop button.

>  From ALSA docs:
> snd_pcm_drop: Stop a PCM dropping pending frames. This function stops 
> the PCM /immediately/. The pending samples on the buffer are ignored.
> snd_pcm_drain: Stop a PCM preserving pending frames. For capture stop 
> PCM permitting to retrieve residual frames.

> To me it sounds like waveOutReset should call snd_pcm_drain, rather than 
> snd_pcm_drop.

I tried that with snd_pcm_drain and it has a small delay before it stops. I
would say that's try it and see what happens. It's still better then hanging
wine. And if people will start having some problems with it (sound artifacts in
games?) we can drop that all together (there is call to snd_pcm_drop few lines
bellow).

Vitaliy




More information about the wine-devel mailing list