-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathadd_monitor_sink
More file actions
executable file
·56 lines (51 loc) · 1.5 KB
/
Copy pathadd_monitor_sink
File metadata and controls
executable file
·56 lines (51 loc) · 1.5 KB
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
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/bash
# Define the default name/description for your monitor sink
SINK_NAME="MyMonitorSink"
SINK_DESCRIPTION="Virtual Monitor for System Audio"
function print_help {
echo "usage: "
echo 'add_monitor_sink <options>'
echo "options:"
echo " --name: name for the sink"
echo " --description: the description for the sink"
}
while [ $# -gt 0 ]; do
case "$1" in
-h|--help)
print_help;
exit 0
;;
-d|--description)
SINK_DESCRIPTION="$2"
shift 2
;;
-n|--name)
SINK_NAME="$2"
shift 2
;;
# -b|--boolean-option)
# SINK_NAME=true
# shift
# ;;
# *)
# # Handle positional arguments or unknown options
# text=$1
# shift
# ;;
esac
done
echo "Creating PulseAudio null sink: $SINK_NAME"
pactl load-module module-null-sink sink_name="$SINK_NAME" sink_properties=device.description="$SINK_DESCRIPTION"
if [ $? -eq 0 ]; then
echo "Null sink '$SINK_NAME' created successfully."
echo "Creating loopback module to hear the monitored audio."
pactl load-module module-loopback sink="$SINK_NAME"
if [ $? -eq 0 ]; then
echo "Loopback module created successfully. You can now route applications to '$SINK_NAME'."
echo "Use 'pavucontrol' to manage audio routing."
else
echo "Error creating loopback module."
fi
else
echo "Error creating null sink '$SINK_NAME'."
fi