[LAU] [PATCH] JACK 0.109.2 alsa device disconnect patch

Salvatore Di Pietro salvuz_78 at virgilio.it
Fri Mar 14 11:32:48 EDT 2008


Hi all,
I just fitted Sean Meiners' alsa device disconnect patch for JACK 0.109.2.

It enables jackd to detach from the ALSA device, letting its use by 
other non-JACK programs whilst in the middle of a jack session, without 
closing jackd and its clients. IMHO very useful for i.e common builtin 
laptop soundcards which don't support more than one alsa-direct audio 
app at once (also commonly known as "no hardware mixing soundcards").

You get an additional example client: jack_device_connect (based on 
jack_freewheel, its arguments are "y" or "n") which you use to make jack 
release and re-hook to the audio card. Time is paused and all audio from 
jack is of course muted and jackd and its client applications are put 
into this fake-freewheel mode while jack has released the device; they 
continue producing and consuming audio upon jackd re-attaching to the 
audio device, with the command "jack_device_connect y".

The original version was for jack 0.100.0, I just modified it to make it 
patch successfully on jack 0.109.2. I don't have so advanced programming 
skills to understand its inner working, but from a quick read of the 
code, for what I can understand, I saw it mainly adds some functions in 
jackd (jack_device_disconnect() and jack_device_connect()in 
jackd/engine.c) and libjack (jack_set_connected() in client.c, 
jack_driver_nt_disconnect() and jack_driver_nt_connect() in driver.c) to 
dis/connect to the alsa device.

I was asked on this list about the interaction of this patch with 
realtime watchdogs. I didn't encounter any problem, they were never 
triggered (and no crashes or weird things ;) ) as in normal operation, 
because they enter this freewheeling-like mode.
I contacted Sean and asked him if it was this way, and he replied:

 >As I remember, that's pretty much it. It puts jack into something like 
 >freewheel mode (so that jack clients don't freeze up). And then shuts 
 >down the alsa driver. As for the watchdog, I don't remember anything 
 >about that, but if I had to guess I'd say it's because jack is put 
into >a fake-freewheel mode.

Hope it is useful to who wants to try it: just use

jack_device_connect n

and voila, you can watch youtube videos or use that strange non-jack 
aware application you need in that moment, _without_ closing any jack 
program.
When you're done, just use

jack_device_connect y

and enjoy all your JACK work just where you left it.

I should perhaps rename the jack_device_connect jack_alsa_connect...

Wanna try it?
Happy JACKing to all, ciao!
-- 
           salvuz
      POST FATA RESVRGO
  Linux registered user #291700 | machine #174619
  get counted on ---> http://counter.li.org/ <---
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: jack-audio-connection-kit-0.109.2_alsa_disconnect.patch
Url: http://lists.linuxaudio.org/pipermail/linux-audio-user/attachments/20080314/e4b97c5c/attachment.txt 


More information about the Linux-audio-user mailing list