[Development report #34] Audio Stack Improvements

From: Christos Margiolis <christos_at_freebsd.org>
Date: Tue, 01 Apr 2025 14:22:53 UTC
Automatic sound redirection

	- sound: Implement /dev/dsp as a router device: https://reviews.freebsd.org/D49216
		- Further discussion with mav@ about triggering
		  hot-swaps from outside the cdev context.
		- Discussion with kib@. Addressing his recent comments.
		- Use dev_ref() and dev_rel().
		- Use dev_refthread() and dev_relthread() in vdsp cdev
		  calls.
		- Preserve device (flags, mode) and channel (rates,
		  formats) configs across hot-swaps. This also fixes a
		  bug with duplex -> simplex -> duplex hot-swaps.
	- Split default device into playback and recording
		- Adapted to work with recent changes in D49216. Will
		  submit for review ASAP.

Laptop project

	- snd_hda: Patch Framework 16 AMD:
	  https://cgit.freebsd.org/src/commit/?id=2f1f523a45fb7f9fddd36a3402edbf7b111996c3
	- Porting fixes for Macbook Air 6.1 and 6.2 over from Linux.
	  adrian@ does the testing:
	  https://people.freebsd.org/~christos/cs4208.diff

audio(8): Initial revision:
https://reviews.freebsd.org/D46227

	adrian@ suggested that we commit this ASAP and work on it
	incrementally (see comment in review). I am planning to commit
	it but first I want to first address some issues and improve
	some parts, and also re-test it (haven't touched it for months)
	to make sure things work fine.

sound: Fix vchanrate and vchanformat:
https://cgit.freebsd.org/src/commit/?id=e372211be5c56e218e974a4478be9aa80bfca064

sound: Implement AFMT_FLOAT support:
https://cgit.freebsd.org/src/commit/?id=e1bbaa71d62c8681a576f9f5bedf475c7541bd35

	Encode/decode IEEE754s instead of using fpu_kern(9).
	Implementation by Ariff:
	https://people.freebsd.org/~ariff/utils/ieee754.c

beep(1): Use AFMT_FLOAT:
https://cgit.freebsd.org/src/commit/?id=1166cfd96f3403edb082387fbc3a4d4aa249bce8

sound: Improve afmt_tab:
https://cgit.freebsd.org/src/commit/?id=a4aff024fd53a38ba08bbf5309589e1865ffe024

sound: Use bus_topo_lock() where appropriate:
https://cgit.freebsd.org/src/commit/?id=35400672df83e337f8792df1972a15003b603930

sound: Fix regression in pcm/feeder_mixer.c:
https://cgit.freebsd.org/src/commit/?id=b6420b5ea5bcdeb859a2b3357e5dbaafe7aaff88

	- Reported by glebius@ and debugged together on IRC.

audio/virtual_oss: Remove post-patch:
https://cgit.freebsd.org/ports/commit/?id=54d4fd4df4b7d176951c895acdfc93d4206ec72f

Status/2025Q1/audio.adoc: Add report:
https://reviews.freebsd.org/D49524

MFC'd some recent patches to stable/14.

Requested some new LV2 ports from yuri@ which are very useful for
recording guitars, and I know people (including me) relied on hacks to
get them to work on FreeBSD. He very kindly ported them almost
immediately.

	- audio/guitarix-lv2: Re-add port: Virtual versatile
	  amplification for Jack and set of LV2 plugins:
	  https://cgit.freebsd.org/ports/commit/?id=df1db9a95026854133ed59b040b9f909e8c9ee6e
	- audio/ratatouille-lv2: New port: Neural model loader and
	  mixer:
	  https://cgit.freebsd.org/ports/commit/?id=c4e6e4751c3c46b949d47ee459db662745a201e7
	- audio/neuralrack-lv2: New port: NeuralRack is a Neural Model
	  and Impulse Response File loader:
	  https://cgit.freebsd.org/ports/commit/?id=d9d1869011d9e62fa21649d1dce6e60949285e63

Work unrelated to the audio contract

	- libdtrace: Implement inline function tracing for kinst:
	  https://reviews.freebsd.org/D38825
		- Successful tinderbox build on universe15a.freebsd.org.
		- Linked AsiaBSDCon 2024 paper in review.
		- Domagoj Stolfa said he will start reviewing the patch
		  ASAP.
	- pkg.7: Add example for fetching package for different FreeBSD
	  versions:
	  https://cgit.freebsd.org/src/commit/?id=8900283fa37f6555055d8af5ffa1a5a2fbe2940e
	- net-p2p/py-nicotine-plus: Update to 3.3.10:
	  https://reviews.freebsd.org/D49593

This work is sponsored by the FreeBSD Foundation.

Christos