feature request: pacmd and sink-input - too many numbers
I want to do something like this:
pactl move-sink-input music music_normal
pactl move-sink-input music music_nighttime
However, move-sink-input only takes a sink number. So I have to do this instead:
pactl move-sink-input 5 music_normal
pactl move-sink-input 5 music_nighttime
In order to get the number 5, first I have to list all the modules and extract the associated sink_names:
$ pactl list modules | grep "Module\|sink_name"
Module #22
Argument: sink_name=hw1 device=hw:2 tsched=0 fixed_latency_range=yes fragments=1 fragment_size=15
Module #23
Argument: sink_name=hw2 device=hw:4 tsched=0 fixed_latency_range=yes fragments=1 fragment_size=15
Module #24
Argument: sink_name=combined slaves=1,2
Module #25
Argument: sink_name=noise master=combined
Module #26
Argument: sink_name=music_nighttime master=combined plugin=filter label=hpf control=300
Module #27
Argument: sink_name=music_normal master=combined
Module #28
Argument: sink_name=music master=music_nighttime
Module #29
Argument: sink_name=null
Module #30
Now that I have a module number (28) I can look up the sink input number associated with that module:
$ pactl list sink-inputs | grep 'Sink Input\|Owner'
Sink Input #0
Owner Module: 24
Sink Input #1
Owner Module: 24
Sink Input #2
Owner Module: 25
Sink Input #3
Owner Module: 26
Sink Input #4
Owner Module: 27
Sink Input #5
Owner Module: 28
Sink Input #7
Owner Module: 11
Sink Input #8
Owner Module: 11
This is very awkward.
Please let me know if there is a less awkward way to do it, but I also recommend documenting this use case and empowering the command-line syntax a bit and then updating the shell completion for pacmd move-sink-input
.
By the way, my sinks these are connected using module-remap-sink
with no channel remapping specified:
pactl load-module module-remap-sink sink_name=music master=music_nighttime
Is that the standard way to do it?
See vaguely related https://stackoverflow.com/questions/39736580/look-up-pulseaudio-sink-input-index-by-property.
It is great that these features exist in the first place, and that audio can be redirected on the fly and so on. Big improvement over ALSA. Thank you.