stuff *not*. Let's let Steve or Patrick look at it, I'm just a GUI
geek. I can't agree more with you about gdb changing things. I could
the problem you are seeing may be timing related. I wonder what would
basis. I get a hangup or segfault about every twentieth time I run but
if I kick it again it comes right up. No pattern to it.
Post by Jack O'QuinPost by Jan DepnerI haven't had this problem since I'm using 2.2.1 but I took a look at
the code in main.c. It looks to me like the
gtk_widget_show(main_window);
line should be after all of the geq setup and backend_activate. The
show function causes a ton of things to go on in GTK. Many of these
activate callbacks (expose, configure, etc). Try moving it to just
before the
gtk_main();
line and see if that alleviates some of the trouble. I've done this in
my code and the only effect I see is a slight delay while we get
jackified. Let me know what happens. If it works I'll commit it.
Also, try playing with the EQ sliders and drawing some curves and let me
know how you like that. The hand drawn stuff isn't connected to
anything but you can try it out.
I'm using GTK 2.2.1 now, too.
I tried moving the gtk_widget_show() call as you suggest. It seems
like the right approach.
But, I still get a segfault when running JAM...
Using jamrc file: /home/joq/.jamrc
Registering as jam
Segmentation fault
I'm not getting a core file, when running this way. Anyone know how
to activate core dumps? Since gdb is still giving bogus results, I
have no good way to look at what was going on.
If I run with gdb, I still get the same failure as before...
Breakpoint 1, backend_activate (argc=1, argv=0xbffffaf4) at io.c:65
(gdb) cont
Continuing.
[New Thread 32769 (LWP 4298)]
Can't attach LWP 4298: Operation not permitted
(gdb) bt
#0 0x403e03d9 in __linuxthreads_create_event () from /lib/libpthread.so.0
#1 0x403dc740 in __pthread_initialize_manager () from /lib/libpthread.so.0
#3 0x4042952f in jack_start_thread (client=0x81085b8) at client.c:914
#4 0x404299dd in jack_activate (client=0x81085b8) at client.c:1081
#5 0x08062158 in backend_activate (argc=1, argv=0xbffffaf4) at io.c:74
#6 0x0804fd4b in main (argc=1, argv=0xbffffaf4) at main.c:67
(gdb) info threads
2 Thread 32769 (LWP 4298) Couldn't get registers: No such process.
Since the thread is created successfully when running without gdb, I
suspect a bug in gdb's handling of realtime thread creation. This
crash does *not* occur when I run jackd without -R.
But the overall segfault still happens...
(gdb) run
Starting program: /usr/local/stow/jam/bin/jam
[New Thread 16384 (LWP 4334)]
Using jamrc file: /home/joq/.jamrc
Registering as jam
[New Thread 32769 (LWP 4335)]
[New Thread 16386 (LWP 4336)]
poll interrupted
poll interrupted
poll interrupted
poll interrupted
poll interrupted
poll interrupted
Program received signal SIGSEGV, Segmentation fault.
[Switching to Thread 16384 (LWP 4334)]
0x32003836 in ?? ()
(gdb) bt
#0 0x32003836 in ?? ()
Cannot access memory at address 0x31202d20
Commenting out the call to gtk_widget_show() allows the program to run
without crashing (still). I can even run it inside gdb if I start
jackd without -R.
I'm not sure what to conclude from that. Possibilities...
1) The UI is changing the timing in a way that uncovers a
concurrency problem in the backend processing.
2) There's a bug in the UI somewhere. I haven't pursued that.
3) My GTK 2.2.1 installation is somehow screwed up. I spent way too
much time fighting package dependencies and building a hybrid Debian
stable/testing system, yesterday. There were lots of changes
including a new XFree86 version, with new font handling. Then, I
installed GTK 2.2 using some .deb files I downloaded from an
unofficial GNOME 2.2 backport to Debian woody site. So, there was
lots of room for error. Plus, I don't have any other GTK 2.2
applications to try out. I didn't install GNOME 2.2, I'm still
running GNOME 1.4, which doesn't use GTK 2.2. I should probably
find something simple that does use it.
Is this stuff working for everyone but me? Or, am I just seeing an
intermittent failure more often than most? Can anyone suggest a
program that uses GTK 2.2 similarly to JAM and doesn't depend on GNOME
2.2?
I think I was right yesterday about the order of JACK operations in
backend_activate(). I spotted some code in process() that checks for
whether the ports have been registered yet. That should not be
necessary if JACK is initialized correctly. I changed that test to
use assert(3). Building with -DNDEBUG will turn on that check, which
should never fail. The patch is appended, along with a better
placement of the jack_activate() call in backend_activate(). I
recommend applying it to CVS.
If I run JAM with no UI, should I be able to get sound out from the
current version? I haven't tried that yet.
Keep on jammin'
--
Jack O'Quin
Austin, Texas, USA
----
Index: src/io.c
===================================================================
RCS file: /cvsroot/jamin/jam/src/io.c,v
retrieving revision 1.3
diff -u -r1.3 io.c
--- src/io.c 16 Apr 2003 07:29:41 -0000 1.3
+++ src/io.c 19 Apr 2003 15:41:09 -0000
@@ -62,11 +62,6 @@
char *ioports[4];
unsigned int i;
- if (jack_activate(client)) {
- fprintf (stderr, "cannot activate client");
- exit(1);
- }
-
input_ports[0] = jack_port_register(client, "in_L",
JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
input_ports[1] = jack_port_register(client, "in_R",
@@ -75,6 +70,11 @@
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
output_ports[1] = jack_port_register(client, "out_R",
JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+
+ if (jack_activate(client)) {
+ fprintf (stderr, "cannot activate client");
+ exit(1);
+ }
if (argc == 5) {
for (i=0; i<4; i++) {
Index: src/process.c
===================================================================
RCS file: /cvsroot/jamin/jam/src/process.c,v
retrieving revision 1.4
diff -u -r1.4 process.c
--- src/process.c 18 Apr 2003 08:34:30 -0000 1.4
+++ src/process.c 19 Apr 2003 15:41:10 -0000
@@ -3,6 +3,7 @@
#include <stdlib.h>
#include <jack/jack.h>
#include <fftw3.h>
+#include <assert.h>
#include "process.h"
#include "compressor.h"
@@ -216,11 +217,8 @@
static unsigned int n_calc_pt = BINS - (BINS / OVER_SAMP);
jack_default_audio_sample_t *in[2], *out[2];
- /* just incase the ports aren't registered */
- if (input_ports[0] == 0 || input_ports[1] == 0) {
- return 0;
- }
- //printf("we seem to have some ports...\n");
+ /* the ports should have been registered */
+ assert(input_ports[0] && input_ports[1]);
in[0] = (jack_default_audio_sample_t *)
jack_port_get_buffer(input_ports[0], nframes);