JACK, Pulse Audio and Rivendell causes a bit of a headache in order to get  
them all to play nice.  I've only actually achieved this on an Ubuntu  
workstation and even then I noticed that on 10.04 Youtube videos were hit  
and miss (I think it was a flash problem).

Theres several things you need to sort out. Mainly user permissions and  
correct startup of the pulse source and sink plugins.  Without knowing the  
details of your installation I can at least let you know how I managed it.

The main problem is getting everything to run as the same user due to a  
permissions thing in JACK.  I think you can run it as different users but  
I never figured that out.

First of all you need to install the pulse audio jack modules:

sudo apt-get install pulseaudio-module-jack

Then make 4 scripts that will suspend pulse and let it play with JACK and  
then recover gracefully if you close JACK.

"pulse-jack-pre-start.sh"

#!/bin/bash
pacmd suspend true

"pulse-jack-post-start.sh"
#!/bin/bash
pactl load-module module-jack-sink channels=2
pactl load-module module-jack-source channels=2
pacmd set-default-sink jack_out
pacmd set-default-source jack_in

"pulse-jack-pre-stop.sh"
#!/bin/bash
SINKID=$(pactl list | grep -B 1 "Name: module-jack-sink" | grep
Module | sed 's/[^0-9]//g')
SOURCEID=$(pactl list | grep -B 1 "Name: module-jack-source" |
grep Module | sed 's/[^0-9]//g')
pactl unload-module $SINKID
pactl unload-module $SOURCEID
sleep 5

"pulse-jack-post-stop.sh"
#!/bin/bash
pacmd suspend false

Make these executable and then inside JACK (qjackctl) setup -> options add  
the 4 scripts into the execute script on startup, after startup etc etc.

That is all you need for jack, all I did was make qjackctl run on startup  
as the local user with those scripts.

Unfortunately if the Rivendell daemons are around they tend to steal the  
ALSA device and JACK has a wobbly.  So I had to amend how Riv starts.   
Basically first off I removed it from etc/init.d.  Make a copy of the init  
script to home for safe keeping (sudo cp /etc/init.d/rivendell  
~/rivendell) and then run "sudo update-rc.d -f rivendell remove" and "sudo  
rm /etc/init.d/rivendell"

Unfortunately this causes more problems as you now need to load the  
rivendell daemons elsewhere and also create /var/run/rivendell every time  
you reboot.

The Rivendell daemons are the easy bit.  You can add the startup for those  
to the "pulse-jack-post-start.sh" just add three lines:
/usr/local/bin/caed
/usr/local/bin/ripcd
/usr/local/bin/rdcatchd

Also double check that caed, ripcd and rdcatchd don't have rws  
permissions.  Running as root (s) means JACK doesn't like them so you have  
to chown then as root:root (theres probably another way to change the S  
permission but that solved it for me).

If you're fancy you can then stop Riv daemons when JACK exits by using the  
kill commands on caed etc but beware this will kill any on air playout.

As for the /var/run/rivendell dir this is slightly more complicated.  Due  
to needing root permissions to do this I created an init script to do this:

#! /bin/sh
# /etc/init.d/rivendell_run_dir
#
# Simple script to create the /var/run/rivendell directory
# and then change ownership to the rivendell user
#
# Responds to start and stop calls
case "$1" in
start)
echo "Creating /var/run/rivendell"
mkdir /var/run/rivendell
# CHANGE THE NEXT LINE to your own username
chown rivendell2:rivendell /var/run/rivendell
;;
stop)
# There is actually nothing to do here but we'll say
bye anyway
echo "rivendell_run_dir exiting"
;;
*)
echo "Usage: /etc/init.d/rivendell_run_dir {start|
stop}"
exit 1
;;
esac
exit 0

you need to edit chown rivendell2:rivendell /var/run/rivendell to whatever  
your local user and group is.  After that make it executable and update  
the boot scripts "sudo update-rc.d rivendell_run_dir defaults"

You get some warnings as the script is not complete to handle all the init  
stuff but it works fine.

I have a pdf of all this stuff on  
http://www.thevoiceasia.org/rivendell/Rivendell_2_on_Ubuntu_1104.pdf

I don't use the startup script that waits for JACK and loads the daemons  
anymore as I realised JACK can do this much more easily.

Regards,


Wayne

On Wed, 12 Oct 2011 11:31:38 +0100, Terry LeTourneau  
<[email protected]> wrote:

> Good Morning!
>
>
> I noticed something this AM when we fired up RDAdmin and that was that  
> the
> icon for Jack was inside a red box.  We were trying to roll out RD on  
> Oct.
> 1st but had constant issues with trying to figure out Jack/PulseAudio.
>  We're sort of at a loss here as to why this red box keeps popping up,  
> etc.
>  We can hear the Test Tone in RdAirplay but wondering why this keeps
> happening.  I've posted the message we got this AM from Jack below.  Any
> thoughts or suggestions as to what we should do to make this go away?  =)
>  We're running RD 2.0.2 on Ubuntu 11.04.  Our sound card is a Delta44
> (ice1312).
>
>
> -Terry
>
> ************************************************************************************
>
> Wed Oct 12 05:30:41 2011: New client 'rivendell_0' with PID 2497
>
> 05:30:45.460 JACK connection graph change.
>
> 05:30:46.147 XRUN callback (1).
>
> Wed Oct 12 05:30:42 2011: Connecting 'rivendell_0:playout_0L' to
> 'system:playback_1'
>
> Wed Oct 12 05:30:42 2011: Connecting 'rivendell_0:playout_0R' to
> 'system:playback_2'
>
> Wed Oct 12 05:30:42 2011: Connecting 'rivendell_0:playout_1L' to
> 'system:playback_1'
>
> Wed Oct 12 05:30:42 2011: Connecting 'rivendell_0:playout_1R' to
> 'system:playback_2'
>
> Wed Oct 12 05:30:42 2011: Connecting 'system:capture_1' to
> 'rivendell_0:record_0L'
>
> 05:30:48.589 JACK connection change.
>
> 05:35:09.230 XRUN callback (2).
>
> Wed Oct 12 05:35:08 2011: [1m [31mERROR: JackEngine::XRun: client =
> PulseAudio JACK Source was not run: state = 2 [0m
>
> Wed Oct 12 05:35:08 2011: [1m [31mERROR:  
> JackAudioDriver::ProcessGraphAsync:
> Process error [0m
>
> Wed Oct 12 05:35:09 2011: [1m [31mERROR: JackEngine::XRun: client =
> PulseAudio JACK Source was not run: state = 2 [0m
>
> Wed Oct 12 05:35:09 2011: [1m [31mERROR:  
> JackAudioDriver::ProcessGraphAsync:
> Process error [0m
>
> Wed Oct 12 05:35:09 2011: [1m [31mERROR: JackEngine::XRun: client =
> PulseAudio JACK Source was not run: state = 2 [0m
>
> Wed Oct 12 05:35:09 2011: [1m [31mERROR:  
> JackAudioDriver::ProcessGraphAsync:
> Process error [0m
>
> 05:35:12.932 XRUN callback (4 skipped).


-- 
Regards,

Wayne Merricks
The Voice Asia

#######################
Scanned by MailMarshal
#######################

####################################################################################################################################################################################################################

Attention: 

The information contained in this message is confidential and intended for the 
addressee(s) only. If you have received this message in error or there are any 
problems, please notify the originator immediately.
The unauthorised use, disclosure, copying or alteration of this message is 
strictly forbidden. Christian Vision or any of its subsidiaries will not be 
liable for direct, special, indirect or consequential damages 
arising from alteration of the contents of this message by a third party or as 
a result of any virus being passed on. Please note that we reserve the right to 
monitor and read any e-mails sent or received by the 
company under the Telecommunications (Lawful Business Practice) (Interception 
of Communications) Regulation 2000. Christian Vision is registered in England 
as a limited company 2842414 and as a charity 1031031  

####################################################################################################################################################################################################################
_______________________________________________
Rivendell-dev mailing list
[email protected]
http://lists.rivendellaudio.org/mailman/listinfo/rivendell-dev

Reply via email to