USB sound devices with FreeBSD-CURRENT
Samy Mahmoudi
samy.mahmoudi at gmail.com
Sun Sep 13 12:56:57 UTC 2020
Hi,
If reducing the audio buffer size in virtual_oss does not solve the issue
and you temporarily resort to use PulseAudio to achieve switching devices
on-the-fly (which does work very well with PulseAudio), you could indeed
'keep the devices connected' and use a variant of the following script:
#!/usr/local/bin/zsh
SINK_INDEX1=1
SINK_INDEX2=4
ACTIVE_SINK=$(pacmd list-sinks | grep '* index:' | /usr/local/bin/grep -o
'[0-9]*')
if [ "$ACTIVE_SINK" = $SINK_INDEX1 ] ; then
pacmd set-default-sink $SINK_INDEX2
pacmd list-sink-inputs | awk '/index:/{print $2}' | xargs -r -I{} pacmd
move-sink-input {} $SINK_INDEX2
else
pacmd set-default-sink $SINK_INDEX1
pacmd list-sink-inputs | awk '/index:/{print $2}' | xargs -r -I{} pacmd
move-sink-input {} $SINK_INDEX1
fi
In its current form, it allowed me to switch devices on-the-fly with a
keyboard shortcut.
The problem is I had to use a poudriere to build relevant ports with option
PULSEAUDIO (chromium, firefox, mpv, audacious, virtualbox, etc.) and there
may have been (I can not remember precisely) another problem if the USB
headset was either hot-plugged or hot-unplugged. Please let us know if you
manage to sort this out with virtual_oss.
More information about the freebsd-current
mailing list