madenvel / KalinkaPlayer

Audio Player for Linux based SBC
GNU General Public License v3.0
0 stars 0 forks source link

Fall back to S32_LE if S24_LE is not available to support wider range of audio equipment #7

Closed madenvel closed 1 week ago

madenvel commented 4 weeks ago

https://audiosciencereview.com/forum/index.php?threads/opening-up-dyi-streaming-solution.56766/post-2074206

selecting fixed S24_LE soundcard format for bitsPerSample > 16 works OK for the RPi I2S soundcard you use https://github.com/raspberrypi/linu...1847112/sound/soc/bcm/bcm2835-i2s.c#L770-L772 . Other soundcards support S32_LE instead, or even the 24-bit S24_3LE only. While supporting S24_3LE is quite complex as it would require passing a 24bit stream, perhaps a check in https://github.com/madenvel/Kalinka...8e4a9b/native_player/AlsaAudioEmitter.cpp#L39 could check whether S32_LE is available should trying S24_LE fail.

Ideally, S24_3LE should also be supported but that is quite tricky.

Currently FlacStreamDecoder produces 24bit audio in S24_LE but natively libFLAC returns S32_LE and then FlacStreamDecoder convert it to S24_LE, so the conversion logic needs to go to AlsaAudioEmitter instead as the equipment parameters are not known at decoder level.