Idea: virtual devices for "canned" patch settings
Hi all,
Firstly, great work on pipewire
. I've been a user of JACK for its audio graph capability but lamented its disabilities where multiple audio devices were concerned. Today I took the plunge and installed pipewire-0.3.30
(Gentoo package), and aside from a few minor hiccups, it's working well. Not sure if there's a mailing list somewhere, I don't do IRC much these days.
One problem I've noticed is that on my system, it gets confused as to what default audio device to use. I have 3 audio devices: the on-board audio device on my laptop, a USB wireless headset, and a USB ADC/DAC.
I primarily use the USB ADC/DAC (Behringer UCA-202) for hi-fi listening, but it also has line-level RCA inputs that I sometimes plug a record player (or specifically, its pre-amp) into for digitisation of records. The on-board sound card of the laptop is mostly unused, but I'd be fine with it being used for things like Slack/Zoom/Twinkle indicating an incoming call. At the moment, it seems to prefer the USB headset, which is fine for VoIP calls, and may be fine for private hi-fi listening, but not ideal for ring-tones.
That is a problem though, how does pipewire
know the nature of the audio stream being received? At least from the perspective of a generic ALSA-style client, it can't. It just knows there's an audio stream and nothing more, it "guesses" which audio device it should connect it to. For what it's worth, JACK and PulseAudio have the same problem, so it's not unique to pipewire
, but I suspect pipewire
is in a better position to solve the issue.
One possible thought was maybe that pipewire
could expose "virtual" input/output devices that the user could define, that describe a policy for what audio device(s) should be default. So in my situation above, I might define some virtual devices:
-
ring
might use a broadcast-style policy, where it just looks for all audio devices not currently muted and connects to all of them; thus you can hear if someone's calling you even if you've taken your headset off and stepped away from the computer, because the ring tone is playing through the laptop speakers too. -
hifi
might look for my USB ADC/DAC, then my USB audio headset, finally on-board sound card, in that order. -
private
might look for the USB audio headset, fall back to the on-board sound card -
analogue
might look for the USB ADC/DAC for the purpose of providing a stereo audio input channel for things like Audacity.
Thus, there'd be two types of policy that defines the virtual device: "broadcast" policies that might look for audio devices that match given patterns, and "priority" policies that try to choose one device given a preference order. At most, I might have to define a few instances of the pipewire-alsa
plug-in in my .asoundrc
, but then at least if an ALSA application connects to one, it'll "default" to a patch set-up that suits the intent for the stream.
I haven't given much thought as to how this might be configured, but just thought I'd at least start the discussion. :-)
Regards, Stuart Longland