osu/run.sh

34 lines
896 B
Bash
Raw Normal View History

2020-06-10 16:33:29 +02:00
#!/bin/bash
function set_latency_offset() {
if [ $# != 1 ]; then
return 1
fi
echo "Set latency offset to $1 µs" >&2
pactl set-port-latency-offset alsa_card.pci-0000_00_1b.0 analog-output-headphones $1
}
set_latency_offset -40000
trap "set_latency_offset 0" SIGINT SIGTERM EXIT
BASEDIR="$(dirname $(realpath -s $0))"
mkdir -p "$BASEDIR/data" "$BASEDIR/import"
docker run \
--rm \
-it \
--name osu \
-e DISPLAY \
-e PULSE_SERVER=/run/user/$(id -u)/pulse/native \
-e PULSE_COOKIE=/run/pulse/cookie \
--device /dev/dri \
--group-add $(getent group video|cut -d: -f3) \
--group-add $(getent group audio|cut -d: -f3) \
-v /tmp/.X11-unix:/tmp/.X11-unix \
-v /run/user/$(id -u)/pulse/native:/run/user/$(id -u)/pulse/native \
-v "$HOME/.config/pulse/cookie:/run/pulse/cookie" \
-v "$BASEDIR/data/:/home/osu/osu/" \
-v "$BASEDIR/import/:$BASEDIR/import/" \
r.sbruder.de/osu \
$@