[pulseaudio-discuss] Dynamically loading/unloading sinks or sources

Lennart Poettering lennart at poettering.net
Thu Dec 11 06:48:33 PST 2008

On Fri, 07.11.08 15:36, Ng Oon-Ee (ngoonee at gmail.com) wrote:

> Hi all,
> I'm using Pulseaudio with Ubuntu Intrepid Ibex (0.9.10 version). I've 
> been going about converting my laptop to a recording machine, starting 
> with the installation of JACK, of course. My current setup has JACK 
> directly accessing my sound card, with Pulseaudio loading the modules 
> 'module-jack-sink' and 'module-jack-source'. However, this means that 
> when I stop JACK, some programs currently outputting sound to Pulseaudio 
> (Rhythmbox, for example) hang and have to be killed manually. This also 
> means that, without killing and restarting Pulseaudio, I cannot shut 
> JACK down and have Pulseaudio automatically 'grab' the sound card. 
> Neither can I, when running Pulseaudio without JACK, inform Pulseaudio 
> to release its grab on the sound card so that JACK can grab the sound 
> card (except with pasuspender, which isn't useful when what I actually 
> want to do is have Pulse play THROUGH JACK).
> Sorry about the long background. Here's the questions I have:-
> 1. Is there a way to instruct 'module-alsa-sink' and 
> 'module-alsa-source' to release their hold on the sound card? To maybe 
> further complicate matters, I'm loading those modules through 
> 'module-hal-detect'. I'd rather not unload the modules, because I've had 
> problems loading them again once they've already been loaded to a 
> running server.

Yes, you can "suspend" sinks/sources. For the ALSA sinks/sources this
will result in the devices being closed. You can trigger this via the
API or via the "suspend-sink" CLI command.

> 2. Currently, upon starting JACK I run a script which loads the two 
> modules 'module-jack-sink' and 'module-jack-source'. When I want to quit 
> JACK without crashing Pulseaudio, I have to disconnect the connections 
> JACK has made to Pulse, then quite JACK. This unloads 'module-jack-sink' 
> and 'module-jack-source' automatically, leaving pulse without sinks or 
> sources. Is there any way to use pactl to inform Pulse to reacquire the 
> ALSA sinks and sources?

Crashing PulseAudio?

You can simply load modules whenever you want. Use the "load-module"
CLI command for that.

You can get into the CLI console by typing "pacmd" in the shell.


Lennart Poettering                        Red Hat, Inc.
lennart [at] poettering [dot] net         ICQ# 11060553
http://0pointer.net/lennart/           GnuPG 0x1A015CC4

More information about the pulseaudio-discuss mailing list