Fix for uaudio driver, so it can be used on DragonFly
Hello. A new uaudio driver for usb4bsd (sys/bus/u4b/audio) needs some care
and love. Currently it can only probe audio devices, that is all. So I
propose a patch which makes this driver useful.
What works: playback with different audio formats and sample rates (8/16
bit pcm, 44.1kHz, 8kHz and so on). Up to 2 channels (what most people need
;). Module loading/unloading.
What does not: multichannel environments, mixer master output level ("vol")
affects only left channel, I really do not know why.
What was not tested: recording
Is it good enough to be committed?
With best regards, Vasily.
#2 Updated by profmakx over 3 years ago
I also get the following errors when I try building with the patch applied:
/home/makx/src/sys/bus/u4b/audio/uaudio_pcm.c:76:1: error: 'ua_chan_setfragments' defined but not used [-Werror=unused-function]
/home/makx/src/sys/bus/u4b/audio/uaudio_pcm.c:107:1: error: 'ua_chan_getmatrix' defined but not used [-Werror=unused-function]
cc1: all warnings being treated as errors
*** [uaudio_pcm.o] Error code 1
#4 Updated by shamaz over 3 years ago
Here is the new patch. It fixes mixer problem (so you can control volume of both channels). Please note, that it affects both pcm (sound) and uaudio drivers. Also, MIXER_UNINIT is called with mixer lock released now, as it is in FreeBSD. Is it ok? Or maybe do I need to release/unsetup usb transfer/acquire mixer lock in mixer_uninit method explicitly?
#6 Updated by shamaz over 3 years ago
This is a variation I use now, if someone is still interested. I moved new functionality from pcm driver to uaudio (only round_bufdz in dev/sound/pcm/channel.c was left modified to accept any values of min and max, not just power of 2). Now I am sure it will not break anything else.