Fix for uaudio driver, so it can be used on DragonFly
Added by shamaz almost 9 years ago.
Updated over 8 years ago.
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.
Can you please make sure that the mixer is properly protected using snd_mtxlock/snd_mtxunlock when modifying it?
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
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?
- Tracker changed from Bug to Submit
- Category set to Kernel
- Target version set to 3.9.x
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.
I haven't forgotten about your patch, I am just rather busy fumbling with other issues at the moment. I'll integrate it this weekend. Cheers for submitting!
- Status changed from New to Feedback
I applied your patch to master.
- Status changed from Feedback to Closed
Also available in: Atom