Re: snd device switching

From: Alexandre Ratchov <alex_at_caoua.org>
Date: Thu, 26 Sep 2019 22:13:24 +0200
On Thu, Sep 26, 2019 at 03:20:38PM +0300, Ilya Nerubatskiy wrote:
> Hello.
> Has sndio or some related apps feature to switch between sound output devices
> in real-time (on the fly)?
> 
> To /boot/loader.conf already added:
> Code:
> 
> snd_driver_load="YES"
> sound_load="YES"
> cuse_load="YES"
> 
> Switching with sysctl hw.snd.default_unit only works the next time I am playing
> a sound (it doesn’t work on the fly).
> # cat /dev/sndstat
> Code:
> 
> pcm0: <ATI R6xx (HDMI)> (play)
> pcm1: <Analog Devices AD1882 (Analog)> (play/rec) default
> pcm2: <Analog Devices AD1882 (Front Analog Headphones)> (play)
> pcm3: <USB audio> (play/rec)
> 
> # uname -a
> Code:
> 
> FreeBSD testInstall 12.0-RELEASE-p10 FreeBSD 12.0-RELEASE-p10 GENERIC  amd64

Hi,

There's no utility to switch between devices, sorry.

However recent sndiod versions allow "alternate devices" to be
specified with a new -F options. If the alternate device is present,
it's used. If it's disconnected, sndiod switches to the other one. In
your example, if sndiod is started with:

	sndiod -f rsnd/1 -F rsnd/3

then, when the the USB device is present, it will be used; if it's
disconnected sndiod switches to the on-board one. SIGHUP makes sndiod
switch back to the alternate device, if present.

I haven't tested this on FreeBSD yet.

HTH,

-- Alexandre
Received on Thu Sep 26 2019 - 22:13:24 CEST

This archive was generated by hypermail 2.3.0 : Fri Sep 27 2019 - 01:33:05 CEST