[alsa-devel] mono/stereo translation & number of frames per period

Clemens Ladisch clemens at ladisch.de
Tue Apr 4 11:18:13 CEST 2017


Paul Stone wrote:
> I thought that simply by reporting that my driver only supports two
> channels, that I could simply utilize a mixer or that ALSA would
> automatically support sending and receiving monaural data to/from my
> stereo-only driver. Ultimately, I wasn't able to make it work. Is this
> a mode of operation that ALSA supports, or does ALSA require the
> driver to support single-channel operation in order to send/receive
> monaural data?

The driver should report only those sample formats that the hardware
actually supports.

The ALSA library can do automatic sample rate/format conversions (with
the "default" or "plughw" devices).  However, this does not work if you
bypass it with the "hw" device.

> It appears that ALSA looks at the minimum period size and
> decides to send that much audio data for playback.

No; it tells you how large the buffer is, and your driver programs the
hardware to play from that buffer.  The application is responsible for
keeping the buffer filled.

Periods are where your hardware raises interrupts, to report progress.

> The minimum period size is in bytes

The fields in the snd_pcm_hw structure are for commonly-used constraints.
But you can put other constraints on the period size, if you need to.

But do you actually need it?  (Does your hardware support mono?)


Regards,
Clemens


More information about the Alsa-devel mailing list