from the department of tiny progress

I have multiple audio outputs. When running JACK it’s possible to enable output to the ones other than the primary one using alsa_out, but actually using them is difficult.

So I finally cobbled together a shell script to send all my current browser’s outputs to the Secondary:

#!/bin/bash
All_JACK_Ports="`jack_lsp`" # get ports list, maybe not optimally
SAVEIFS=$IFS # Save current Internal Field Separator
IFS=$'\n' # set Internal Field Separator to newlines only
All_JACK_Ports=($All_JACK_Ports) # turn list into an array
IFS=$SAVEIFS # Restore original IFS
for (( i=0; i<${#All_JACK_Ports[@]}; i++ ))
    do
      This_JACK_Port="${All_JACK_Ports[$i]}" # pull individual line
      if test "${This_JACK_Port:0:11}" = "vivaldi-bin" # or "Chromium" or whatever
         then
             if test "${This_JACK_Port: -1}" = "0" # last character
                then jack_connect "$This_JACK_Port" "Secondary:playback_1"
                else jack_connect "$This_JACK_Port" "Secondary:playback_2"
             fi
      fi
    done

A barely functional hack, but better than nothing.

Comment

Your email address will not be published. Required fields are marked *