[alsa-devel] arecord: does hardware or software throw away unused

Clemens Ladisch clemens at ladisch.de
Wed Sep 21 09:01:34 CEST 2016


Rob Nertney wrote:
> I'm building the hardware, so I can technically do whatever I want. I
> didn't want to add more to the hardware if ALSA can handle this.
>
> The hardware is spec-ed to *always* have 16 channels worth of data being
> written into DDR. I think this comes full-circle to my original question of
> whether arecord can filter out channels.

When the ALSA library automatically converts sample formats, it can also
adjust the number of channels.  (This does not happen if some program
decides to use the "hw" device to bypass all conversions.)

> It sounds like arecord can handle multiple channels, but its under the
> assumption that the hardware itself changes (in the pcm_open function) to
> only copy in the requested channels worth of data; i.e. arecord assumes
> that the data in dma_area is exactly as requested by arecord.

The ALSA kernel framework assumes that the snd_pcm_hw constraints correctly
describe the capabilities of your hardware.  Any conversions happen in
userspace.

Your driver never sees what happens in userspace; the values to be set by
the .hw_params callback are guaranteed to fit into your driver's constraints.


Regards,
Clemens


More information about the Alsa-devel mailing list