Skip site navigation (1)Skip section navigation (2)
Date:      Sun, 13 Sep 2020 14:56:43 +0200
From:      Samy Mahmoudi <samy.mahmoudi@gmail.com>
To:        Tomasz CEDRO <tomek@cedro.info>
Cc:        Graham Perrin <grahamperrin@gmail.com>, FreeBSD CURRENT <freebsd-current@freebsd.org>,  FreeBSD questions <freebsd-questions@freebsd.org>
Subject:   Re: USB sound devices with FreeBSD-CURRENT
Message-ID:  <CAFigVTPKdhUzvpZB=d4F5cd3Kik8Vh%2Bds_i=hm_94H=Anmd-uw@mail.gmail.com>
In-Reply-To: <CAM8r67A0595XkcskgxOMN8O=22-xexcdC63tC%2BME=5zQtcBD0Q@mail.gmail.com>
References:  <9551111b-5dfb-c42b-6f58-81f6c8b8bbd1@gmail.com> <CAM8r67A0595XkcskgxOMN8O=22-xexcdC63tC%2BME=5zQtcBD0Q@mail.gmail.com>

next in thread | previous in thread | raw e-mail | index | archive | help
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.



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?CAFigVTPKdhUzvpZB=d4F5cd3Kik8Vh%2Bds_i=hm_94H=Anmd-uw>