aboutsummaryrefslogtreecommitdiff
path: root/bin
diff options
context:
space:
mode:
Diffstat (limited to '')
-rwxr-xr-xbin/do_dac.sh22
-rwxr-xr-xbin/do_speakers.sh13
2 files changed, 31 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
diff --git a/bin/do_speakers.sh b/bin/do_speakers.sh
new file mode 100755
index 0000000..84b82e1
--- /dev/null
+++ b/bin/do_speakers.sh
@@ -0,0 +1,13 @@
+#!/bin/sh
+
+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 "${USB_SINK}" 1
+pacmd set-sink-mute "${SPEAKERS}" 0
+
+for s in $(pacmd list-sink-inputs | awk '$1 == "index:" {print $2}')
+do
+ pacmd move-sink-input $s "${SPEAKERS}" >/dev/null 2>&1
+done