ALSA error: device doesn't support a compatible PCM format

Hello everyone,
Just got my embedded platform to run and now trying to run a Juce app on it.
The chip is a A8 ARM processor running a custom Kernel.

The soundCard is configured as follow:

ALSA device: hw:imxcs4271,0 outs=2-2 ins=2-2 rates=1
ACCESS: RW_INTERLEAVED
FORMAT: S24_LE
SUBFORMAT: STD
SAMPLE_BITS: 32
FRAME_BITS: 64
CHANNELS: 2
RATE: 48000
PERIOD_TIME: (10666 10667)
PERIOD_SIZE: 512
PERIOD_BYTES: 4096
PERIODS: 4
BUFFER_TIME: (42666 42667)
BUFFER_SIZE: 2048
BUFFER_BYTES: 16384
TICK_TIME: 0
tstamp_mode: NONE
period_step: 1
avail_min: 512
start_threshold: 512
stop_threshold: 1073741824
silence_threshold: 0
silence_size: 1073741824
boundary: 1073741824
ACCESS: RW_INTERLEAVED
FORMAT: S24_LE
SUBFORMAT: STD
SAMPLE_BITS: 32
FRAME_BITS: 64
CHANNELS: 2
RATE: 48000
PERIOD_TIME: (10666 10667)
PERIOD_SIZE: 512
PERIOD_BYTES: 4096
PERIODS: 4
BUFFER_TIME: (42666 42667)
BUFFER_SIZE: 2048
BUFFER_BYTES: 16384
TICK_TIME: 0
tstamp_mode: NONE
period_step: 1
avail_min: 512
start_threshold: 512
stop_threshold: 1073741824
silence_threshold: 0
silence_size: 1073741824
boundary: 1073741824

The app that cross compiled runs fine but when trying to output audio It can’t seems to find the right settings in the formatsToTry[] list in juce_linux_ALSA.cpp file. So I added up a line to match my embedded setting such as:
const int formatsToTry[] = { SND_PCM_FORMAT_FLOAT_LE, 32 | isFloatBit | isLittleEndianBit,
SND_PCM_FORMAT_FLOAT_BE, 32 | isFloatBit,
SND_PCM_FORMAT_S32_LE, 32 | isLittleEndianBit,
SND_PCM_FORMAT_S32_BE, 32,
SND_PCM_FORMAT_S24_3LE, 24 | isLittleEndianBit,
SND_PCM_FORMAT_S24_LE, 24 | isLittleEndianBit, // this is a new line that I’ve added
SND_PCM_FORMAT_S24_3BE, 24,
SND_PCM_FORMAT_S16_LE, 16 | isLittleEndianBit,
SND_PCM_FORMAT_S16_BE, 16 };
In this case I don’t have the error message (see subject) but the sineWave data are garbage in the headphones.
I’m worried that the converter that convers float data to the int soundcard format is not doing the right conversion basically.

Did anyone ever faced such a problem with embedded platforms before?

Many thanks for your help
Silvere

Just managed to write my own converter for my custom sample format in the end and it works.

So the missing format in the formatToTry list was:
SND_PCM_FORMAT_S24_LE, 24 | isLittleEndianBit

Maybe a quick update on the converter parameters for this format could be useful to others?

Silvere

That’s strange, because according to the docs, SND_PCM_FORMAT_S24_LE uses 4 bytes, so if you just added it to that list with 24 as its bit-depth, surely the audio would all be garbled?

Yes Jules the audio is all garbled indeed. That’s why I had to write my own converter to go from Float32 to int24 interleaved.
I’m not sure how the template function works really but it does not apply to my soundcard sound format.

I will try tomorrow to force the converter to use the 3 lowest bytes of a 32 bit words to see how it goes.

Will let you know
Cheers
Silvere