-
Notifications
You must be signed in to change notification settings - Fork 0
/
tcp-audio-sink
executable file
·30 lines (27 loc) · 1.02 KB
/
tcp-audio-sink
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
#!/bin/bash
if [[ $1 == connect ]]; then
if [[ "$#" -eq 2 ]]; then
echo "Usage: tcp-audio-sink connect <IP_ADDRESS> <SINK_NAME>"
exit 1
fi
pactl load-module module-tunnel-sink sink_name=${3} server=tcp:${2}:4656 channels=2 rate=44100
elif [[ $1 == host ]]; then
if [[ "$#" -eq 1 ]]; then
echo "Usage: tcp-audio-sink host <SERVER_IP_ADDRESS>"
exit 1
fi
pactl load-module module-native-protocol-tcp port=4656 listen=${2}
elif [[ $1 == disconnect ]]; then
pactl unload-module module-tunnel-sink
elif [[ $1 == stop ]]; then
pactl unload-module module-native-protocol-tcp
elif [[ $1 == help ]]; then
echo "Usage: tcp-audio-sink command [ARGUMENTS]..."
echo "Available commands:"
echo " connect <IP_ADDRESS> <SINK_NAME>"$'\t'"Connect to a remote sink"
echo " host <SERVER_IP_ADDRESS>"$'\t\t'"Host a remote sink"
echo " disconnect"$'\t\t\t\t'"Disconnect from all remote sinks"
echo " stop"$'\t\t\t\t\t'"Stop hosting a remote sink"
else
echo "Invalid command. Use 'help' for more information."
fi