Change to a pipewire way and for start/stop virtual sinks. Also make this more like a command with params that a simple script.
This commit is contained in:
parent
915715b975
commit
6f47cc4ecb
67
TwitchVOD
67
TwitchVOD
@ -1,12 +1,61 @@
|
|||||||
#!/bin/sh
|
#!/bin/bash
|
||||||
|
|
||||||
# Use "pactl list short sinks" to see your devices
|
##
|
||||||
AUDIOOUTPUTDEVICENAMEHERE=bluez_output.00_25_DB_69_D3_0B.a2dp-sink
|
# Create virtual sinks for use it on Twitch VOD Track.
|
||||||
|
#
|
||||||
|
# @author kj
|
||||||
|
# @website http://kj2.me
|
||||||
|
# @licence MIT
|
||||||
|
##
|
||||||
|
|
||||||
# pactl load-module module-remap-sink sink_name=base_output master=$AUDIOOUTPUTDEVICENAMEHERE channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right remix=no;
|
AUDIOOUTPUTDEVICE=bluez_output.00_25_DB_69_D3_0B.a2dp-sink
|
||||||
# pacmd update-sink-proplist base_output device.description="Main_Sink";
|
|
||||||
# pactl load-module module-remap-sink sink_name=music_output master=$AUDIOOUTPUTDEVICENAMEHERE channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right remix=no;
|
|
||||||
# pacmd update-sink-proplist music_output device.description="Music_Sink"
|
|
||||||
|
|
||||||
pactl load-module module-remap-sink sink_name="Main_Sink" master=$AUDIOOUTPUTDEVICENAMEHERE channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right remix=no;
|
function startSinks() {
|
||||||
pactl load-module module-remap-sink sink_name="Music_Sink" master=$AUDIOOUTPUTDEVICENAMEHERE channels=2 master_channel_map=front-left,front-right channel_map=front-left,front-right remix=no;
|
if [ -f "sinks.pid" ]; then
|
||||||
|
echo "Se ha encontrado el archivo de configuración de dispositivos virtuales previos."
|
||||||
|
stopSinks
|
||||||
|
fi
|
||||||
|
|
||||||
|
AUDIOOUTPUTDEVICE=$1
|
||||||
|
|
||||||
|
echo "Creando los nuevos dispositvos virtuales..."
|
||||||
|
pw-loopback --capture-props='media.class=Audio/Sink node.name=Music_Sink audio.position=[FL FR]' --playback-props='audio.position=[FR FL] node.target="'$AUDIOOUTPUTDEVICE'"' > /dev/null 2>&1 &
|
||||||
|
Main_PID=$!
|
||||||
|
pw-loopback --capture-props='media.class=Audio/Sink node.name=Main_Sink audio.position=[FL FR]' --playback-props='audio.position=[FR FL] node.target="'$AUDIOOUTPUTDEVICE'"' > /dev/null 2>&1 &
|
||||||
|
Music_PID=$!
|
||||||
|
|
||||||
|
echo $Main_PID >> sinks.pid
|
||||||
|
echo $Music_PID >> sinks.pid
|
||||||
|
|
||||||
|
echo "Las dispositivos de audio virtuales han sido creados :)."
|
||||||
|
}
|
||||||
|
|
||||||
|
function stopSinks() {
|
||||||
|
if [ -f "sinks.pid" ]; then
|
||||||
|
echo "Deteniendo los dispositivos virtuales..."
|
||||||
|
while read -r pid; do
|
||||||
|
kill -9 $pid
|
||||||
|
done < sinks.pid
|
||||||
|
rm sinks.pid
|
||||||
|
echo "Dispositivos virtuales detenidos."
|
||||||
|
else
|
||||||
|
echo "No se ha encontrado el archivo de configuración, no hay nada para detener."
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ "$1" == "start" ]; then
|
||||||
|
startSinks $AUDIOOUTPUTDEVICE
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" == "stop" ]; then
|
||||||
|
stopSinks
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ "$1" == "list" ]; then
|
||||||
|
pactl list short sinks
|
||||||
|
exit
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Modo de uso: $(basename $0) [start|stop|list]"
|
||||||
|
Loading…
Reference in New Issue
Block a user