On Sun, 03 Oct 2004 12:55:18 +0300 Sampo Savolainen <v2@xxxxxx> wrote: > On Sun, 2004-10-03 at 08:25, Florian Schmidt wrote: > > Starting a new jack client in itself won't produce xruns. Also, > > cleanly shutting down a jack client will not in itself produce xruns > > [iirc]. But it seems that many, if not most, jack apps, get some > > part of the RT operation stuff not right. Especially start up and > > shutdown. > > Actually, that's not entirely correct. I've been talking to Paul about > this. The xruns created by exiting clients is due to jackd having to > rework it's internals. When doing this reordering, jackd has to lock > the data it's modifying and sometimes (very often) there will be an > xrun because the audio thread is waiting for the lock to be released. > > In short. It's not the clients fault, it's jacks' fault. Hi, a simple test will show you that this is not true. This program will exit and disconnect from the jack graph after 10 seconds. I don't get any xruns with it even a 2*32 frames. Jack's disconnection logic might still be flawed [if paul says so]. but at least in this case it doesn't show: #include <jack/jack.h> #include <iostream> jack_client_t *client; jack_port_t *iport; jack_port_t *oport; int process(jack_nframes_t frames, void *arg) { // actually do something jack_default_audio_sample_t *ibuf; ibuf = (jack_default_audio_sample_t*)jack_port_get_buffer(iport, frames); jack_default_audio_sample_t *obuf; obuf = (jack_default_audio_sample_t*)jack_port_get_buffer(oport, frames); for (jack_nframes_t frame = 0; frame < frames; frame++) { obuf[frames] = ibuf[frame]; } return 0; } int main(int argc, char *argv[]) { std::cout << "client_new" << std::endl; client = jack_client_new("foo"); std::cout << "port_register." << std::endl; iport = jack_port_register(client, "foobar_in", JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput|JackPortIsTerminal, 0); oport = jack_port_register(client, "foobar_out", JACK_DEFAULT_AUDIO_TYPE, JackPortIsTerminal|JackPortIsOutput, 0); std::cout << "set_process_callback" << std::endl; jack_set_process_callback(client, process, 0); std::cout << "activate" << std::endl; jack_activate(client); jack_port_tie(iport, oport); std::cout << "running" << std::endl; // while(1) {sleep(1);}; sleep(10); jack_deactivate(client); jack_client_close(client); }