# HG changeset patch # User paulo@localhost # Date 1242892576 25200 # Node ID 3dd48f06493e660379425422d4caf540eab639c8 # Parent ff028323c114f32b2adb571b7e7678310c21f471 add sample rate change callback diff -r ff028323c114 -r 3dd48f06493e lsonify.c --- a/lsonify.c Thu May 21 00:00:49 2009 -0700 +++ b/lsonify.c Thu May 21 00:56:16 2009 -0700 @@ -106,9 +106,12 @@ } int -sample_rate_change () { - printf("Sample rate has changed! Exiting...\n"); - exit(-1); +sample_rate_change (jack_nframes_t nframes, void *arg) { + if (nframes != sr) { + printf("Sample rate has changed! Exiting...\n"); + exit(-1); + } + return 0; } int @@ -222,6 +225,7 @@ output_port = jack_port_register (client, port_string, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0); sr = jack_get_sample_rate (client); + jack_set_sample_rate_callback (client, sample_rate_change, 0); /* setup wave table parameters */ wave_length = 60 * sr / bpm;