badaix / snapcast

Synchronous multiroom audio player
GNU General Public License v3.0
6.21k stars 456 forks source link

Support for ALSA floating point samples? #1179

Open dustin-richards-was-here opened 1 year ago

dustin-richards-was-here commented 1 year ago

Is your feature request related to a problem? Please describe. Attempting to use an ALSA plugin (an equalizer) that doesn't support any sample format other than floating point little endian, at least that's my interpretation of this snapclient log snippet after skimming the source.

2023-11-22 23-14-59.825 [Info] (Player) Player name: alsa, device: plugequal, description: <none>, idx: 8, sharing mode: unspecified, parameters: <none>
2023-11-22 23-14-59.825 [Info] (Player) Mixer mode: software, parameters: <none>
2023-11-22 23-14-59.825 [Info] (Player) Sampleformat: 44100:16:2, stream: 44100:16:2
2023-11-22 23-14-59.825 [Info] (Alsa) Using default buffer_time: 80 ms, default fragments: 4
2023-11-22 23-15-00.101 [Error] (Alsa) Exception: Can't set format: Invalid argument, supported: FLOAT_LE , code: 0
2023-11-22 23-15-00.102 [Fatal] (Snapclient) Exception: Can't set format: Invalid argument, supported: FLOAT_LE 
2023-11-22 23-15-00.102 [Notice] (Snapclient) Snapclient terminated.

Describe the solution you'd like Add support for floating point ALSA PCM sample types SND_PCM_FORMAT_FLOAT_LE, SND_PCM_FORMAT_FLOAT_BE, SND_PCM_FORMAT_FLOAT64_LE, and SND_PCM_FORMAT_FLOAT64_BE. Enum is here in the ALSA docs.

Describe alternatives you've considered Alternate solution is attempt to get support for ALSA integer types into alsaequal, but the project seems like it hasn't been touched in a while and it seems like a decent goal (in my possibly naive opinion) for snapclient to be highly compatible.

Additional context I am willing to work on this!