Re: git: e1bbaa71d62c - main - sound: Implement AFMT_FLOAT support
Date: Mon, 09 Jun 2025 19:32:50 UTC
On Sun, 30 Mar 2025, Christos Margiolis wrote:
> The branch main has been updated by christos:
>
> URL: https://cgit.FreeBSD.org/src/commit/?id=e1bbaa71d62c8681a576f9f5bedf475c7541bd35
>
> commit e1bbaa71d62c8681a576f9f5bedf475c7541bd35
> Author: Christos Margiolis <christos@FreeBSD.org>
> AuthorDate: 2025-03-30 17:45:38 +0000
> Commit: Christos Margiolis <christos@FreeBSD.org>
> CommitDate: 2025-03-30 17:45:38 +0000
>
> sound: Implement AFMT_FLOAT support
>
> Even though the OSS manual [1] advises against using AFMT_FLOAT, there
> are applications that expect the sound driver to support it, and might
> not work properly without it.
>
> This patch adds AFMT_F32_LE|BE (as well as AFMT_FLOAT for OSS
> compatibility) in sys/soundcard.h and implements AFMT_F32_LE|BE <->
> AFMT_S32_LE|BE conversion functions. As a result, applications can
> write/read floats to/from sound(4), but internally, because sound(4)
> works with integers, we convert floating point samples to integer ones,
> before doing any processing.
>
> The reason for encoding/decoding IEEE754s manually, instead of using
> fpu_kern(9), is that fpu_kern(9) is not supported by all architectures,
> and also introduces significant overhead.
>
> The IEEE754 encoding/decoding implementation has been written by Ariff
> Abdullah [2].
>
> [1] http://manuals.opensound.com/developer/AFMT_FLOAT.html
> [2] https://people.freebsd.org/~ariff/utils/ieee754.c
>
> PR: 157050, 184380, 264973, 280612, 281390
> Sponsored by: The FreeBSD Foundation
> MFC after: 1 week
> Reviewed by: emaste
> Differential Revision: https://reviews.freebsd.org/D47638
> ---
> sys/dev/sound/pcm/channel.c | 4 +++
> sys/dev/sound/pcm/feeder_chain.c | 2 ++
> sys/dev/sound/pcm/feeder_rate.c | 4 +++
> sys/dev/sound/pcm/feeder_volume.c | 2 ++
> sys/dev/sound/pcm/pcm.h | 67 +++++++++++++++++++++++++++++++++++++--
> sys/dev/sound/pcm/sound.h | 13 +++++---
> sys/sys/soundcard.h | 8 +++++
> tests/sys/sound/pcm_read_write.c | 6 ++++
> 8 files changed, 98 insertions(+), 8 deletions(-)
>
> diff --git a/sys/dev/sound/pcm/feeder_volume.c b/sys/dev/sound/pcm/feeder_volume.c
> index f72c6aa7ef4f..2d35bb56ef8f 100644
> --- a/sys/dev/sound/pcm/feeder_volume.c
> +++ b/sys/dev/sound/pcm/feeder_volume.c
> @@ -93,6 +93,8 @@ FEEDVOLUME_DECLARE(U, 32, LE)
> FEEDVOLUME_DECLARE(U, 16, BE)
> FEEDVOLUME_DECLARE(U, 24, BE)
> FEEDVOLUME_DECLARE(U, 32, BE)
> +FEEDVOLUME_DECLARE(F, 32, LE)
> +FEEDVOLUME_DECLARE(F, 32, BE)
> #endif
>
> struct feed_volume_info {
Could it be that they also need to be added to feed_volume_info_tab
below? Kernel LINT builds complain that they are unused.
/bz
--
Bjoern A. Zeeb r15:7