How to add support for A_LAW pcm format to ALSA Loop driver ?

Christophe Leroy christophe.leroy at csgroup.eu
Wed Feb 2 18:47:52 CET 2022


Hi,

I see that the ALSA Loop driver supports only the following formats:

	.formats =	(SNDRV_PCM_FMTBIT_S16_LE | SNDRV_PCM_FMTBIT_S16_BE |
			 SNDRV_PCM_FMTBIT_S24_LE | SNDRV_PCM_FMTBIT_S24_BE |
			 SNDRV_PCM_FMTBIT_S24_3LE | SNDRV_PCM_FMTBIT_S24_3BE |
			 SNDRV_PCM_FMTBIT_S32_LE | SNDRV_PCM_FMTBIT_S32_BE |
			 SNDRV_PCM_FMTBIT_FLOAT_LE | SNDRV_PCM_FMTBIT_FLOAT_BE),


I'd like to have Loopback service with A_LAW format, I though it would 
just require to add SNDRV_PCM_FMTBIT_A_LAW to the format above as the 
Loopback driver just loops the samples.

But it doesn't work, I still get only the following formats:

ALSA ERROR hw_params: set (FORMAT)
            value = A_LAW : Invalid argument
ACCESS:  RW_INTERLEAVED
FORMAT:  S16_LE S16_BE S24_LE S32_LE S32_BE S24_3LE
SUBFORMAT:  STD
SAMPLE_BITS: [16 32]
FRAME_BITS: [16 1024]
CHANNELS: [1 32]
RATE: [8000 192000]
PERIOD_TIME: (5 65536000]
PERIOD_SIZE: [1 524288]
PERIOD_BYTES: [2 67108864]
PERIODS: [1 1024]
BUFFER_TIME: (5 131072000]
BUFFER_SIZE: [1 1048576]
BUFFER_BYTES: [2 134217728]
TICK_TIME: ALL
ALSA lib pcm.c:8644:(snd_pcm_set_params) Sample format not available for 
CAPTURE: Invalid argument


What am I missing, what needs to be added to the Loop driver to support 
A_LAW format ?

Thanks for your help
Christophe


More information about the Alsa-devel mailing list