Bug 157050 - OSS implementation lacks AFMT_FLOAT
Summary: OSS implementation lacks AFMT_FLOAT
Status: Closed FIXED
Alias: None
Product: Base System
Classification: Unclassified
Component: kern (show other bugs)
Version: 9.0-CURRENT
Hardware: Any Any
: Normal Affects Only Me
Assignee: freebsd-multimedia (Nobody)
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2011-05-15 04:20 UTC by gerald
Modified: 2025-04-06 00:29 UTC (History)
7 users (show)

See Also:


Attachments
Basic AFMT_FLOAT support (919 bytes, patch)
2016-08-08 16:39 UTC, Hans Petter Selasky
no flags Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description gerald 2011-05-15 04:20:03 UTC
	AFMT_FLOAT, as described by
	  http://manuals.opensound.com/developer/AFMT_FLOAT.html
	is currently not present in FreeBSD which broke recent
	versions of Wine until I patched those myself and my cause
	problems with other applications.
Comment 1 Pedro F. Giffuni freebsd_committer freebsd_triage 2012-02-03 23:55:43 UTC
Responsible Changed
From-To: freebsd-standards->freebsd-multimedia

Assign to multimedia. 
This is more likely to get some attention there.
Comment 2 Hans Petter Selasky freebsd_committer freebsd_triage 2016-08-08 15:30:10 UTC
This looks good to me. Do you have a patch?

--HPS
Comment 3 Hans Petter Selasky freebsd_committer freebsd_triage 2016-08-08 16:39:55 UTC
Created attachment 173412 [details]
Basic AFMT_FLOAT support

Hi,

Can you test the attached patch?

PCM subsystem still doesn't support mixing of AFMT_FLOAT through its feeder subsystem, so any use of AFMT_FLOAT will fail!

Maybe that needs to be added too when we provide support for AFMT_FLOAT ?

--HPS
Comment 4 Eitan Adler freebsd_committer freebsd_triage 2018-05-28 19:42:21 UTC
batch change:

For bugs that match the following
-  Status Is In progress 
AND
- Untouched since 2018-01-01.
AND
- Affects Base System OR Documentation

DO:

Reset to open status.


Note:
I did a quick pass but if you are getting this email it might be worthwhile to double check to see if this bug ought to be closed.
Comment 5 Warner Losh freebsd_committer freebsd_triage 2024-01-13 23:07:19 UTC
It's time to close this...  Hans Petter isn't going to commit this patch, and it's simple enough if someone wants to pick up the ball and implement mixing with AFMT_FLOAT support. It's not complete enough to commit as is, though. Please file a new bug if there's something more complete.
Comment 6 Warner Losh freebsd_committer freebsd_triage 2024-01-13 23:07:19 UTC
It's time to close this...  Hans Petter isn't going to commit this patch, and it's simple enough if someone wants to pick up the ball and implement mixing with AFMT_FLOAT support. It's not complete enough to commit as is, though. Please file a new bug if there's something more complete.
Comment 7 commit-hook freebsd_committer freebsd_triage 2025-03-30 17:48:55 UTC
A commit in branch main references this bug:

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(-)
Comment 8 commit-hook freebsd_committer freebsd_triage 2025-04-06 00:29:14 UTC
A commit in branch stable/14 references this bug:

URL: https://cgit.FreeBSD.org/src/commit/?id=1728d26682c65cb878971f55b4e87e24d0050524

commit 1728d26682c65cb878971f55b4e87e24d0050524
Author:     Christos Margiolis <christos@FreeBSD.org>
AuthorDate: 2025-03-30 17:45:38 +0000
Commit:     Christos Margiolis <christos@FreeBSD.org>
CommitDate: 2025-04-06 00:28:14 +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

    (cherry picked from commit e1bbaa71d62c8681a576f9f5bedf475c7541bd35)

 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(-)