check in user systemd services and pulse auto connect

This commit is contained in:
LuKe Tidd 2025-04-26 12:05:34 -04:00
commit 825f0598a4
Signed by: luke
GPG Key ID: 75D6600BEF4E8E8F
8 changed files with 135 additions and 0 deletions

41
bin/pulse_jack_autoconnect Executable file
View File

@ -0,0 +1,41 @@
#!/bin/bash
declare -A ports
ports[pulsel]='PulseAudio JACK Sink:front-left'
ports[pulser]='PulseAudio JACK Sink:front-right'
ports[echo_audiofire1]='firewire_pcm:001486a296a59815_Unknown_out'
ports[echo_audiofire2]='firewire_pcm:001486a296a59815_Unknown0_out'
retries=10
err_file="$(mktemp)"
while [[ "$retries" -gt 0 ]]; do
failed=false
live_ports="$(jack_lsp -c 2>"$err_file")"
printf 'live ports:\n\n%s\n' "$live_ports"
err="$(<"$err_file")"
rm "$err_file"
if [[ -n "$err" ]]; then
printf '%s\n' "$err" >&2
sleep 2
((retries-=1))
continue
fi
for port in "${ports[@]}"; do
if ! grep -q "$port" <<< "$live_ports"; then
printf '%s not seen\n' "$port" >&2
sleep 2
((retries-=1))
failed=true
fi
done
if [[ "$failed" == 'false' ]]; then
break
fi
done
jack_connect "${ports[pulsel]}" "${ports[echo_audiofire1]}"
jack_connect "${ports[pulser]}" "${ports[echo_audiofire2]}"
printf 'success\n'
if [[ "$retries" != 10 ]]; then
printf 'attempts: %s\n' "$((10-retries))"
fi

View File

@ -0,0 +1,15 @@
[Unit]
Description=ardour
After=carla_pre.service
Wants=carla_pre.service
[Service]
Environment="DISPLAY=:0"
Environment="XAUTHORITY=/home/luke/.Xauthority"
StandardOutput=syslog+console
StandardError=syslog+console
ExecStart=/home/luke/bin/ardour_with_template
Restart=always
RestartSec=5
[Install]
WantedBy=default.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=carla
After=carla_pre.service
[Service]
Environment="DISPLAY=:0"
StandardOutput=syslog+console
StandardError=syslog+console
Environment="XAUTHORITY=/home/luke/.Xauthority"
ExecStart=/usr/bin/carla /studio/carla/default.carxp
[Install]
WantedBy=graphical.target

View File

@ -0,0 +1,11 @@
[Unit]
Description=carla_pre
After=graphical.target
[Service]
Type=exec
ExecStart=/home/luke/bin/prestart_carla
[Install]
WantedBy=graphical.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=JACK
#Before=pulseaudio.service pulseaudio.socket
[Service]
LimitRTPRIO=infinity
LimitMEMLOCK=infinity
ExecStart=/usr/bin/jackd -dfirewire -r48000 -p256 -n3
# ExecStart=/usr/bin/jackd -dfirewire -r44100 -p256 -n3
# ExecStart=/usr/bin/jackd -dfirewire -r48000 -p128 -n3
# ExecStart=/usr/bin/jackd -dalsa -dhw:AudioFire12_1,0 -r48000 -p128 -n3 -i24 -o24
Restart=always
RestartSec=5
[Install]
WantedBy=default.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=patchage
After=carla_pre.service
[Service]
Environment="DISPLAY=:0"
StandardOutput=syslog+console
StandardError=syslog+console
Environment="XAUTHORITY=/home/luke/.Xauthority"
ExecStart=/usr/bin/patchage
[Install]
WantedBy=graphical.target

View File

@ -0,0 +1,14 @@
[Unit]
Description=pavucontrol
After=carla_pre.service
[Service]
Environment="DISPLAY=:0"
StandardOutput=syslog+console
StandardError=syslog+console
Environment="XAUTHORITY=/home/luke/.Xauthority"
ExecStart=/usr/bin/pavucontrol
[Install]
WantedBy=graphical.target

View File

@ -0,0 +1,12 @@
[Unit]
Description=Pulse_and_Jack
After=jack.service
Wants=jack.service
[Service]
Type=oneshot
ExecStart=/home/luke/bin/pulse_jack
ExecStop=/usr/bin/pactl unload-module module-jack-sink
SuccessExitStatus=0
RemainAfterExit=true
[Install]
WantedBy=default.target