On Sun, 2001-12-02 at 14:21, Christophe Baillon wrote:
> Hi,
>
> I have modified an example programm of the alsa website, in fact
> to test reading a wave file.
>
> The behaviour of my program is very strange !
> It works fine, the sample is played until the end, except when
> I change virtual screen in Window Maker !! When i do it,
> the program exit without error before the end of the sample.
>
> Very strange ....
>
> Is there something wrong in the program ?
>
> This is the source code :
>
Sounds like you aren't handling xruns (buffer underruns in this case).
There are some software parameters for controlling what happens when an
xrun occurs.
snd_pcm_sw_params_set_stop_threshold
PCM is automatically stopped in SND_PCM_STATE_XRUN state when available
frames is >= threshold
snd_pcm_sw_params_set_silence_threshold
A portion of playback buffer is overwritten with silence (see
snd_pcm_sw_params_set_silence_size) when playback underrun is nearer
than silence threshold
I'm not really sure how to use these myself. But you either want to
handle the XRUN (which is what I have normally done) or make it so it
never stops (set stop_threshold really high 0xFFFFFFFF, or something)
and the silence parameters correctly so that silence will be sent rather
than looping part of the buffer again. I might be wrong about all this,
so someone who really knows about ALSA XRUN handling should then step in
:)
--
Josh Green
Smurf Sound Font Editor (http://smurf.sourceforge.net)
_______________________________________________
Alsa-devel mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/alsa-devel