Re: [Development report #16] Audio Stack Improvements

From: Alexandre Ratchov <alex_at_caoua.org>
Date: Wed, 03 Jul 2024 07:51:15 UTC
Hi,

I just noticed this thread.

I'm an OpenBSD audio contributor (uaudio(4) and envy(4) drivers,
generic audio(4) layer, sndio maintainer).

This may be off-topic, but feel free to contact me to discuss
audio-related topics that are not directly documented: mistakes we
did, things that work well, why we made certain decisions, the current
architecture, etc.

Alexandre

On Tue, Jul 02, 2024 at 09:09:38PM +0200, Christos Margiolis wrote:
> Work done since last report:
> 
> Most of my time was spent implementing audio(3):
> - Some time was wasted because I accidentally deleted all my WIP at some
>   point (no comment...) before I pushed it to GitHub, so I had to
>   re-write the whole library from scratch.
> - Not sure whether this will be the final design, but after research and
>   studying of other sound libraries, I decided to go with a simple
>   libsndio-like approach, meaning the library provides only a handful of
>   simple functions, instead of a full-blown complicated API:
> 	- audio_open(), audio_close()
> 	- audio_read(), audio_write(): Support blocking, non-blocking
> 	  and (soon) memory-mapped IO.
> 	- audio_set_vol(), audio_get_vol(): VPC functionality.
> 	- midi_open(), midi_close()
> 	- midi_read(), midi_write(): Support blocking and non-blocking
> 	  IO.
> - Still considering whether we need a few more functions.
> - Added syslog(3) logging for all failure points in the library.
> - Doing some test re-writes of MPV and other programs to make sure the
>   library can adapt to multiple different workflows.
> - Still experimening with different approaches regarding buffer size
>   assignments. Also discussing this with Florian.
> - We need better kernel MIDI support in order to provide more
>   MIDI-related functionality through audio(3). Many MIDI OSSv4 IOCTLs
>   are not supported at all. An idea I have is to convert midi/ to
>   function as a generic layer for MIDI device drivers (e.g umidi),
>   similar to pcm/. This way we can register a device to /dev/sndstat and
>   call OSS IOCTLs on it and expose all devices in a uniform way to /dev.
>   However, this requires careful planning and I am still not sure
>   whether this can fit within the scope of the project.
> 
> Commits/reviews:
> - snd_hda: Add Lenovo X1 Carbon Gen11 support
>   https://cgit.freebsd.org/src/commit/?id=ef659a2d041c01b747ae4605160c24156cae081b
> - snd_uaudio: Remove unused sc_sndstat sbuf
>   https://reviews.freebsd.org/D45771
> - sound: Simplify getchns()
>   https://reviews.freebsd.org/D45775
> - sound: Make DSP_FIXUP_ERROR() regular code:
>   https://reviews.freebsd.org/D45776
> - sound: Remove dead code in pcm_register()
>   https://reviews.freebsd.org/D45831
> - sound: Improve simplex handling in dsp_open()
>   https://reviews.freebsd.org/D45835
> - sound: Get rid of snd_sb16 workaround in vchan_create()
>   https://reviews.freebsd.org/D45662
> - sound: Fix min/max sample rate assignment for VCHANs
>   https://reviews.freebsd.org/D45664
> - sound: SNDCTL_AUDIOINFO: Do not skip physical channels if VCHANs are
>   disabled
>   https://reviews.freebsd.org/D45722
> - On-and-off debugging a (seemingly harmless) lock order reversal in
>   chn_syncstart().
> - sound: Support oss_audioinfo->cmd
>   https://cgit.freebsd.org/src/commit/?id=8e36d212594b542cb0c57d549e0b57fd0f7e307c
> - sound: Fix oss_audioinfo's card_number, port_number and legacy_device
>   https://cgit.freebsd.org/src/commit/?id=0f878cdfc5a46cc0dc198e12758f12558dfb1bf6
> - sound: Remove outdated comment in dsp_oss_engineinfo()
>   https://cgit.freebsd.org/src/commit/?id=914c2b3314e8f6e31833e33cfdcc4843f88fe31b
> - sound: Include sound(4) channel information in sndstat nvlist
>   https://cgit.freebsd.org/src/commit/?id=bbca3a75bb412f7106a569b82c616404103be084
> - sound: Fix lock order reversals in mseq_open()
>   https://reviews.freebsd.org/D45770
> - sound: Remove *MINOR from midi/
>   https://reviews.freebsd.org/D45772
> - sound: Remove MIDI_TYPE
>   https://reviews.freebsd.org/D45773
> - Status/2024Q2/audio.adoc: Add report
>   https://cgit.freebsd.org/doc/commit/?id=9f0942d1d52b8dff42a2822ef4f3bf27279f06eb
> 
> Also submitted EuroBSDCon abstract related to the project but was rejected.
> 
> This work is sponsored by the FreeBSD Foundation.
> 
>