Browse Source

Read default sink name from configuration file and replace hard-coded "PulseAudio JACK Sink"

pull/290/head
Mark Fisher 4 years ago
parent
commit
c68747b837
1 changed files with 5 additions and 17 deletions
  1. +5
    -17
      data/cadence-pulse2jack

+ 5
- 17
data/cadence-pulse2jack View File

@@ -121,8 +121,7 @@ fi
addDefaultSource $PA_CTLFILE addDefaultSource $PA_CTLFILE
addDefaultSink $PA_CTLFILE addDefaultSink $PA_CTLFILE


IsPulseAudioRunning()
{
IsPulseAudioRunning() {
PROCESS=`ps -u $USER | grep pulseaudio` PROCESS=`ps -u $USER | grep pulseaudio`
if [ "$PROCESS" == "" ]; then if [ "$PROCESS" == "" ]; then
false false
@@ -132,40 +131,29 @@ IsPulseAudioRunning()
} }


if (IsPulseAudioRunning); then if (IsPulseAudioRunning); then
{

if (`jack_lsp | grep "PulseAudio JACK Sink:" > /dev/null`); then
{
# get the first sink name from the table
FIRST_SINK_NAME=$(grep '|sink|' $JACK_CONNFILE | head -1 | cut -d\| -f1)
if ($(jack_lsp 2>/dev/null | grep "$FIRST_SINK_NAME" > /dev/null)); then
echo "PulseAudio is already running and bridged to JACK" echo "PulseAudio is already running and bridged to JACK"
}
else else
{
echo "PulseAudio is already running, bridge it..." echo "PulseAudio is already running, bridge it..."


if [ "$PLAY_ONLY" == "yes" ]; then if [ "$PLAY_ONLY" == "yes" ]; then
{
loadConnectionsIntoPA "sink" loadConnectionsIntoPA "sink"
pacmd set-default-source jack_in > /dev/null pacmd set-default-source jack_in > /dev/null
}
else else
{
loadConnectionsIntoPA "source" loadConnectionsIntoPA "source"
loadConnectionsIntoPA "sink" loadConnectionsIntoPA "sink"
pacmd set-default-sink jack_out > /dev/null pacmd set-default-sink jack_out > /dev/null
pacmd set-default-source jack_in > /dev/null pacmd set-default-source jack_in > /dev/null
}
fi fi


echo "Done" echo "Done"
}
fi fi
}
else else
{
if (`pulseaudio --daemonize --high-priority --realtime --exit-idle-time=-1 --file=$PA_CTLFILE -n`); then
if ($(pulseaudio --daemonize --high-priority --realtime --exit-idle-time=-1 --file=$PA_CTLFILE -n)); then
echo "Initiated PulseAudio successfully!" echo "Initiated PulseAudio successfully!"
else else
echo "Failed to initialize PulseAudio!" echo "Failed to initialize PulseAudio!"
fi fi
}
fi fi

Loading…
Cancel
Save