aboutsummaryrefslogtreecommitdiff
path: root/bin/do_dac.sh
diff options
context:
space:
mode:
Diffstat (limited to 'bin/do_dac.sh')
-rwxr-xr-xbin/do_dac.sh22
1 files changed, 18 insertions, 4 deletions
diff --git a/bin/do_dac.sh b/bin/do_dac.sh
index 957cf7b..7ae913e 100755
--- a/bin/do_dac.sh
+++ b/bin/do_dac.sh
@@ -1,5 +1,19 @@
#!/bin/sh
-pacmd set-sink-mute alsa_output.pci-0000_00_1b.0.analog-stereo 1
-pacmd set-card-profile alsa_card.usb-FiiO_DigiHug_USB_Audio-01 output:iec958-stereo
-pacmd unload-module module-ladspa-sink
-pacmd load-module module-ladspa-sink sink_name=binaural sink_master=alsa_output.usb-FiiO_DigiHug_USB_Audio-01.iec958-stereo plugin=bs2b label=bs2b control=700,4.5
+
+USB_CARD="alsa_card.usb-FiiO_DigiHug_USB_Audio-01"
+USB_SINK="alsa_output.usb-FiiO_DigiHug_USB_Audio-01.iec958-stereo"
+SPEAKERS="alsa_output.pci-0000_00_1b.0.analog-stereo"
+
+pacmd set-sink-mute "${SPEAKERS}" 1
+pacmd set-card-profile "${USB_CARD}" output:iec958-stereo
+pacmd set-sink-mute "${USB_SINK}" 0
+
+if pacmd list-modules | grep module-ladspa-sink; then
+ pacmd unload-module module-ladspa-sink
+fi
+pacmd load-module module-ladspa-sink sink_name=binaural sink_master="${USB_SINK}" plugin=bs2b label=bs2b control=700,4.5
+
+for s in $(pacmd list-sink-inputs | awk '$1 == "index:" {print $2}')
+do
+ pacmd move-sink-input $s "${USB_SINK}" >/dev/null 2>&1
+done