Re: [pulseaudio-discuss] [PATCH] JACK: Add module-jackdbus-detect

2010-12-05 Thread Colin Guthrie
'Twas brillig, and Colin Guthrie at 03/12/10 12:46 did gyre and gimble:
 'Twas brillig, and David Henningsson at 03/12/10 11:58 did gyre and gimble:
 On 2010-12-03 11:35, Colin Guthrie wrote:
 Hiya

 Seems like a good patch at first glance.

 Thanks! :-)

 One minor question that I
 really don't know the answer to right now, but firgured it's worth
 asking. This approach seems totally separate from the device reservation
 protocol that works between Jack and PA to do graceful handover. Is
 there any chance of races here between the two different IPCs? I don't
 think so (i'd expect Jack to ensure it gets the device first before it
 reports that it isStarted()).

 I'd say they are unrelated. The device handover, as you say, might
 happen before JACK is fully started. Also; JACK controlling ALSA is not
 all use cases, JACK can also control firewire sound cards (and it has
 network and oss drivers as well).

 Also IIRC, there is no automatic stream moving/rescuing when device
 reservation happens, so existing streams will not move, you'll still
 have to manually switch to the JACK sink in kde/gnome/pavu-control.
 
 Hmm, right, those streams will be corked and thus not move across...
 
 Wonder how best to handle that :s Really the sinks/sources should be
 fully unloaded and thus allow the stream rescuing to happen (in theory
 we should move it to the jack sink rather than just rescuing, but that's
 beside the point.
 
 I guess if we had priority list routing and jack was always higher than
 alsa in the priority list, then this is a non-issue, but that's maybe
 not the best way to think about it
 
 
 I think it's probably OK to go into default.pa, but it could also be an
 option in paprefs too.

 e.g. a ticky box for:

 [ ] Automatically redirect audio through Jack if it is started

 or similar.

 WDYT is best?

 Perhaps I need to explain a little further - there is a routing
 patchbay inside the JACK server; connect=true means that when a
 module-jack-sink is started, it will connect the jack-sink (which is an
 input seen from JACK) to the system's sound card output. If
 connect=false, it will just show up as an unconnected sink, making it
 easy for people who want to connect that sink to the sound card, run it
 through a vocoder [1], record it into Ardour, or anything else.

 Perhaps we should go and ask the Ubuntu Studio and/or Planet CCRMA folks
 and see if they have an opinion? Leaving them unconnected would be a
 less invasive approach.
 
 Ahh right I see what you mean.
 
 Well if the whole loading of the module was left to paprefs (or rather
 module-gconf), the main ticky box could have a sub-ticky box for the
 connect argument of the module. Would be trivial to write for paprefs
 and lets users choose easily without messing with config files.

I've pushed the first patch to git now (master + stable-queue) but I'll
wait and see what you think about putting this into paprefs rather than
default.pa before committing the second patch (or not). I'll make the
changes to paprefs if you like?

Col


-- 

Colin Guthrie
gmane(at)colin.guthr.ie
http://colin.guthr.ie/

Day Job:
  Tribalogic Limited [http://www.tribalogic.net/]
Open Source:
  Mageia Contributor [http://www.mageia.org/]
  PulseAudio Hacker [http://www.pulseaudio.org/]
  Trac Hacker [http://trac.edgewall.org/]

___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss


[pulseaudio-discuss] [PATCH] JACK: Add module-jackdbus-detect

2010-12-03 Thread David Henningsson
Over the past few days I've been making a new PulseAudio module that 
detects the presence of JACK server, and adds a sources and a sink when 
JACK is started.


Here are the notes:

* This version uses JACK's dbus interface to detect server being started 
or stopped, i e /usr/bin/jackdbus instead of /usr/bin/jackd.
If you use qjackctl to control the server, make sure that you check the 
checkbox Enable D-Bus interface under Setup - Misc.


* It is deliberately named module-jackdbus-detect instead of 
module-jack-detect, both to emphasize the above, and to avoid name 
clashes with an imaginary (?) future module detecting whether headphones 
are plugged in or not.


* The patch is against stable-queue.

* It is probably ready for merging into the next version of PA. I'm 
saying probably, since during testing yesterday, I sometimes got 
segfaults. However, I believe these are related to something happening 
inside libjack when the server shuts down; since I can trigger the same 
segfaults even without my new module involved. That said; it takes fewer 
strokes with the module enabled, as you can just press start and 
stop in qjackctl until it happens...


* A question is about the default; patch 2 here adds it to default.pa. 
Should connect default to true or false in such a scenario? I think it 
depends on whether we're aiming for just showing the user the 
possibility (connect=false), or if we're aiming for a just-works 
experience (connect=true), which might upset a few people who don't want 
it to work that way...I've gone with connect=true as the default to 
mimic the behaviour of module-jack-sink and module-jack-source.


--
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic
From d111edff2667dcdaad69a0d32bee8358966e5f42 Mon Sep 17 00:00:00 2001
From: David Henningsson david.hennings...@canonical.com
Date: Tue, 30 Nov 2010 04:59:27 +0100
Subject: [PATCH 1/2] JACK: Add module-jackdbus-detect

Signed-off-by: David Henningsson david.hennings...@canonical.com
---
 src/Makefile.am   |   12 ++
 src/modules/jack/module-jackdbus-detect.c |  304 +
 2 files changed, 316 insertions(+), 0 deletions(-)
 create mode 100644 src/modules/jack/module-jackdbus-detect.c

diff --git a/src/Makefile.am b/src/Makefile.am
index 164faa6..799ab8d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1124,6 +1124,12 @@ if HAVE_JACK
 modlibexec_LTLIBRARIES += \
 		module-jack-sink.la \
 		module-jack-source.la
+
+if HAVE_DBUS
+modlibexec_LTLIBRARIES += \
+		module-jackdbus-detect.la
+endif
+
 endif
 
 if HAVE_GCONF
@@ -1228,6 +1234,7 @@ SYMDEF_FILES = \
 		modules/module-detect-symdef.h \
 		modules/rtp/module-rtp-send-symdef.h \
 		modules/rtp/module-rtp-recv-symdef.h \
+		modules/jack/module-jackdbus-detect-symdef.h \
 		modules/jack/module-jack-sink-symdef.h \
 		modules/jack/module-jack-source-symdef.h \
 		modules/module-volume-restore-symdef.h \
@@ -1607,6 +1614,11 @@ module_rtp_recv_la_CFLAGS = $(AM_CFLAGS)
 
 # JACK
 
+module_jackdbus_detect_la_SOURCES = modules/jack/module-jackdbus-detect.c
+module_jackdbus_detect_la_LDFLAGS = $(MODULE_LDFLAGS)
+module_jackdbus_detect_la_LIBADD = $(AM_LIBADD) $(DBUS_LIBS) libpulseco...@pa_majorminormicro@.la $(JACK_LIBS) libpulsecomm...@pa_majorminormicro@.la libpulse.la
+module_jackdbus_detect_la_CFLAGS = $(AM_CFLAGS) $(DBUS_CFLAGS) $(JACK_CFLAGS)
+
 module_jack_sink_la_SOURCES = modules/jack/module-jack-sink.c
 module_jack_sink_la_LDFLAGS = $(MODULE_LDFLAGS)
 module_jack_sink_la_LIBADD = $(AM_LIBADD) libpulseco...@pa_majorminormicro@.la $(JACK_LIBS) libpulsecomm...@pa_majorminormicro@.la libpulse.la
diff --git a/src/modules/jack/module-jackdbus-detect.c b/src/modules/jack/module-jackdbus-detect.c
new file mode 100644
index 000..f635b23
--- /dev/null
+++ b/src/modules/jack/module-jackdbus-detect.c
@@ -0,0 +1,304 @@
+/***
+  This file is part of PulseAudio.
+
+  Written by David Henningsson david.hennings...@canonical.com
+  Copyright 2010 Canonical Ltd.
+
+  Some code taken from other parts of PulseAudio, these are
+  Copyright 2006-2009 Lennart Poettering
+
+  PulseAudio is free software; you can redistribute it and/or modify
+  it under the terms of the GNU Lesser General Public License as published
+  by the Free Software Foundation; either version 2.1 of the License,
+  or (at your option) any later version.
+
+  PulseAudio is distributed in the hope that it will be useful, but
+  WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+  General Public License for more details.
+
+  You should have received a copy of the GNU Lesser General Public License
+  along with PulseAudio; if not, write to the Free Software
+  Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
+  USA.
+***/
+
+#ifdef HAVE_CONFIG_H
+#include config.h
+#endif
+
+#include pulsecore/log.h
+#include pulsecore/modargs.h
+#include pulsecore/core-util.h
+#include 

Re: [pulseaudio-discuss] [PATCH] JACK: Add module-jackdbus-detect

2010-12-03 Thread David Henningsson

On 2010-12-03 11:35, Colin Guthrie wrote:

Hiya

Seems like a good patch at first glance.


Thanks! :-)


One minor question that I
really don't know the answer to right now, but firgured it's worth
asking. This approach seems totally separate from the device reservation
protocol that works between Jack and PA to do graceful handover. Is
there any chance of races here between the two different IPCs? I don't
think so (i'd expect Jack to ensure it gets the device first before it
reports that it isStarted()).


I'd say they are unrelated. The device handover, as you say, might 
happen before JACK is fully started. Also; JACK controlling ALSA is not 
all use cases, JACK can also control firewire sound cards (and it has 
network and oss drivers as well).


Also IIRC, there is no automatic stream moving/rescuing when device 
reservation happens, so existing streams will not move, you'll still 
have to manually switch to the JACK sink in kde/gnome/pavu-control.




I suspect that this is actually needed as if we try to load the
jack-sink's immediately when we hand over the device control to jack,
then jack is likely not ready yet (I think Lennart mentioned this in the
past, and thus makes me thing that speaking to jack directly (as you do)
is the only way to make this work correctly)


'Twas brillig, and David Henningsson at 03/12/10 08:29 did gyre and gimble:

* A question is about the default; patch 2 here adds it to default.pa.
Should connect default to true or false in such a scenario? I think it
depends on whether we're aiming for just showing the user the
possibility (connect=false), or if we're aiming for a just-works
experience (connect=true), which might upset a few people who don't want
it to work that way...I've gone with connect=true as the default to
mimic the behaviour of module-jack-sink and module-jack-source.




I think it's probably OK to go into default.pa, but it could also be an
option in paprefs too.

e.g. a ticky box for:

[ ] Automatically redirect audio through Jack if it is started

or similar.

WDYT is best?


Perhaps I need to explain a little further - there is a routing 
patchbay inside the JACK server; connect=true means that when a 
module-jack-sink is started, it will connect the jack-sink (which is an 
input seen from JACK) to the system's sound card output. If 
connect=false, it will just show up as an unconnected sink, making it 
easy for people who want to connect that sink to the sound card, run it 
through a vocoder [1], record it into Ardour, or anything else.


Perhaps we should go and ask the Ubuntu Studio and/or Planet CCRMA folks 
and see if they have an opinion? Leaving them unconnected would be a 
less invasive approach.


--
David Henningsson, Canonical Ltd.
http://launchpad.net/~diwic

[1] Admit you always wanted your system sounds vocoded! ;-)
___
pulseaudio-discuss mailing list
pulseaudio-discuss@mail.0pointer.de
https://tango.0pointer.de/mailman/listinfo/pulseaudio-discuss