"Curtaining" audio for remote connection
Let me know if there's a better discussion forum for this kind of question.
I'm on a team working on a remote access tool, and we're looking for a way to forward all audio to the client machine without it being audible on the remote machine itself.
In the near term, I imagine this would involve creating a virtual output device and forcing all streams to go to that virtual output device while a remote user is connected, including streams that have been explicitly moved to a specific physical output in the past. However, I'm not sure how exactly to accomplish this, as merely setting the default output device is not always sufficient. This seems like the kind of logic a session manager is designed to handle, and indeed the high-level overview of WirePlumber makes it sounds like it could be used to accomplish what I'm looking for, but it's not obvious to me from the API reference documentation how I would accomplish this, and I haven't been able to find any higher-level API tutorials to get me started. Can the WirePlumber API be used to accomplish what I'm looking for, and if not, is there a better way to go about it?
Longer term, we've had a couple of preliminary discussions with some Wayland and GNOME folks about having first-class support for graphical session curtaining, where a single graphical session can be transition from a local console session to a headless session (if the user connects to the session remotely) and back to a console session (if the user logs in on the console again later). In that case, I imagine it would make sense for PipeWire to integrate into the same system, curtaining audio when the session is running headless, and playing on the local speakers when it is attached to the console. What's the best way to start planning out how this will look architecturally?
Thanks!