[pulseaudio-discuss] Working with PA and jack
Ng Oon-Ee
ngoonee at gmail.com
Fri May 22 10:56:59 PDT 2009
On Fri, 2009-05-22 at 14:20 +0700, Patrick Shirkey wrote:
>
> Thanks for you reply. It's good to know that progress is being made.
> FYI, I have received another report suggesting that pulse combined with
> jackdbus has this problem fixed which I intend to test asap.
>
> Can you provide a command line for this that works for you please? I
> would like to test it here.
Okay. As I warned, it IS rather hackish. There's two scripts, the first
one I name pulse-nojack, the second I name pulse-withjack. Sequence of
events is as follows:-
1. Start pulseaudio (I comment out every HAL/alsa-related line
in /etc/pulse/*.pa, so pulse just starts with a null sink if it hasn't
yet). Using the --start means if pulse is already started nothing will
be done (use current server).
2. Check for modules needing to be unloaded. Just pactl with some greps
and sed, then pactl unload-module.
3. Check for jackd (this may need to be changed once jack2 comes out,
I've been monitoring the jackdbus conversations and things are in real
flux there), kill/start if needed.
4. Load the modules which need loading.
Please note there's probably some wrapping problems with this code.
Please check it out, should not be hard to figure out what to do.
FIRST SCRIPT: PULSE-NOJACK----------------------------------------------
#!/bin/bash
# ORIGINAL SCRIPT FROM:
#http://ubuntuforums.org/showthread.php?t=904379&highlight=bash+ping
# edited by edmondt in: http://ubuntuforums.org/showthread.php?t=939183
# edited by ngoonee, Feb 2009
# Start pulseaudio if it hasn't already been started
pulseaudio --start
# Name the module to be unloaded.
MODULE="alsa"
# The line used to startup JACK.
JACKSTART="/usr/bin/jackd -R -dalsa -r44100 -p64 -n3 -D -Chw:0 -Phw:0"
SINKID=$(pactl list | grep -B 1 "Name: module-$MODULE-sink" | grep
Module | sed 's/[^0-9]//g')
SOURCEID=$(pactl list | grep -B 1 "Name: module-$MODULE-source" | grep
Module | sed 's/[^0-9]//g')
if [ -e $SINKID ]; then
echo $MODULE sinks/sources not loaded, proceeding....
else
echo $MODULE sinks/sources are loaded, ID of $MODULE sink is $SINKID
ID of $MODULE source is $SOURCEID...
echo Unloading module $SINKID and $SOURCID
pactl unload-module $SINKID
pactl unload-module $SOURCEID
fi
if [ $( pidof jackd ) ]; then
echo JACK is running, nothing to be done.
else
echo JACK is not running, starting JACK...
$JACKSTART &
sleep 3
fi
JACKSINKID=$(pactl list | grep -B 1 "Name: module-jack-sink" | grep
Module | sed 's/[^0-9]//g')
JACKSOURCEID=$(pactl list | grep -B 1 "Name: module-jack-source" | grep
Module | sed 's/[^0-9]//g')
if [ -e $JACKSINKID ]; then
echo JACK sinks/sources not loaded, loading now...
pactl load-module module-jack-sink
pactl load-module module-jack-source
else
echo JACK sinks/sources are loaded, ID of JACK sink is $JACKSINKID
ID of JACK source is $JACKSOURCEID...
fi
exit 0
------------------------------------------------------------------------
SECOND SCRIPT: PULSE-WITHJACK-------------------------------------------
#!/bin/bash
# ORIGINAL SCRIPT FROM:
# http://ubuntuforums.org/showthread.php?t=904379&highlight=bash+ping
# edited by edmondt in: http://ubuntuforums.org/showthread.php?t=939183
# edited by ngoonee, Feb 2009
# Start pulseaudio if it hasn't already been started
pulseaudio --start
# Name the module to be unloaded.
MODULE="alsa"
# The line used to startup JACK.
JACKSTART="/usr/bin/jackd -R -dalsa -r44100 -p64 -n3 -D -Chw:0 -Phw:0"
SINKID=$(pactl list | grep -B 1 "Name: module-$MODULE-sink" | grep
Module | sed 's/[^0-9]//g')
SOURCEID=$(pactl list | grep -B 1 "Name: module-$MODULE-source" | grep
Module | sed 's/[^0-9]//g')
if [ -e $SINKID ]; then
echo $MODULE sinks/sources not loaded, proceeding....
else
echo $MODULE sinks/sources are loaded, ID of $MODULE sink is $SINKID
ID of $MODULE source is $SOURCEID...
echo Unloading module $SINKID and $SOURCID
pactl unload-module $SINKID
pactl unload-module $SOURCEID
fi
if [ $( pidof jackd ) ]; then
echo JACK is running, nothing to be done.
else
echo JACK is not running, starting JACK...
$JACKSTART &
sleep 3
fi
JACKSINKID=$(pactl list | grep -B 1 "Name: module-jack-sink" | grep
Module | sed 's/[^0-9]//g')
JACKSOURCEID=$(pactl list | grep -B 1 "Name: module-jack-source" | grep
Module | sed 's/[^0-9]//g')
if [ -e $JACKSINKID ]; then
echo JACK sinks/sources not loaded, loading now...
pactl load-module module-jack-sink
pactl load-module module-jack-source
else
echo JACK sinks/sources are loaded, ID of JACK sink is $JACKSINKID
ID of JACK source is $JACKSOURCEID...
fi
exit 0
------------------------------------------------------------------------
More information about the pulseaudio-discuss
mailing list