[LAU] [Jackit-devel] [PATCH] JACK 0.109.2 alsa device disconnect patch

Stéphane Letz letz at grame.fr
Fri Mar 14 14:21:32 EDT 2008


Le 14 mars 08 à 16:32, Salvatore Di Pietro a écrit :

> 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
>
> ja

Hi,

I don't think this patch should go for jack 1.0 for several reasons:

- it is quite intrusive and add a new API jack_set_connected on the  
client side.

- dynamically changing backend is something that was discussed at LAC  
and that should be better done in a new "server control" API that  
will be part of jack2. Changing the backend is conceptually more a  
server control operation. This API is yet to be completely defined  
but should allow much better control of the server, like dynamically  
gettting/setting backend parameters, starting/stopping the server,  
dynamically changing backend....

Stephane




More information about the Linux-audio-user mailing list