This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

superconfig / tools / gg23-audio / gg23-audio.sh
1.3 kB 46 lines
1#!/usr/bin/env bash 2# Send audio to the gg23 audio hub on acheron (configs/gg23/audio/hub.nix) 3# via ROC while running: loads a ROC sink into pipewire-pulse and makes it the 4# default. Ctrl-C / SIGTERM unloads it (streams move back) and restores the 5# previous default sink. 6 7set -euo pipefail 8 9SINK=roc-gg23 10 11if [ "$#" -gt 0 ]; then 12 echo "usage: gg23-audio (runs until Ctrl-C)" >&2 13 exit 1 14fi 15 16if pactl list short modules | awk -v s="sink_name=$SINK" '$2 == "module-roc-sink" && index($0, s) { f = 1 } END { exit !f }'; then 17 echo "gg23-audio: $SINK is already loaded (another gg23-audio running?)" >&2 18 exit 1 19fi 20 21prev=$(pactl get-default-sink) 22 23id=$(pactl load-module module-roc-sink \ 24 sink_name="$SINK" \ 25 "sink_properties='node.description=\"gg23 (acheron hub)\"'" \ 26 remote_ip=10.42.0.1 \ 27 remote_source_port=10001 \ 28 remote_repair_port=10002 \ 29 remote_control_port=10003 \ 30 fec_code=disable) 31 32cleanup() { 33 if [ -n "${sleeper-}" ]; then kill "$sleeper" 2>/dev/null || true; fi 34 pactl unload-module "$id" || true 35 pactl set-default-sink "$prev" || true 36} 37trap cleanup EXIT 38trap 'exit 130' INT 39trap 'exit 143' TERM 40 41pactl set-default-sink "$SINK" 42echo "sending audio to gg23 hub, Ctrl-C to stop" >&2 43 44sleep infinity & 45sleeper=$! 46wait