[alsa-devel] Asynchronous ALSA - callback and latency questions

Clemens Ladisch clemens at ladisch.de
Tue Sep 9 10:24:55 CEST 2014


Bram Bos wrote:
> I’m using ALSA for building a performance musical instrument, so I’m after
>  low-latency audio output.
>
> 1. I’m using asynchronous audio output (i.e. using a callback).

Don't.  Many devices do not support this, and asynchronous callbacks run
in a signal handler, where you must use only signal-safe functions.

> 2. What does “File descriptor is in a bad state” mean, when it is returned by
> snd_pcm_writei?

That the device is neither running, nor in an underrun state.

> 4. what determines the playback latency of my audio stream?

The buffer size.  When you fill the buffer completely, the last sample
must wait for all previous samples to be played.


Regards,
Clemens


More information about the Alsa-devel mailing list