[alsa-devel] driver silence callback

Clemens Ladisch clemens at ladisch.de
Thu Mar 24 08:21:36 CET 2011


Eliot Blennerhassett wrote:
> Is the driver's silence callback meant to be able to *overwrite* some
> part of the audio buffer that has already been written e.g. via the
> playback *copy* callback?

No.

> I'm looking at the case in pcm_lib.c snd_pcm_playback_silence() where
> "when runtime->silence_size >= runtime->boundary - fill processed area
> with silence immediately"

When underrun detection is disabled, this mechanism can be used to fill
some part of the buffer with silence immediately after the hardware has
read from this part of the buffer, so that in case of an underrung, not
the old data but silence is played.

In other words, the silence callbacks initializes the buffer, while the
copy callback later fills the same part of the buffer with actual data.

> In the case of my (older) hardware, once audio has been written via the
> copy callback, it is gone (into a fifo), there is no way to overwrite
> with silence.

Ensure that on a FIFO underrun, silence is played.  This might be the
default on your hardware anyway.  :)


Regards,
Clemens


More information about the Alsa-devel mailing list