diff lsonify.c @ 3:3dd48f06493e

add sample rate change callback
author paulo@localhost
date Thu, 21 May 2009 00:56:16 -0700
parents ff028323c114
children
line diff
     1.1 --- a/lsonify.c	Thu May 21 00:00:49 2009 -0700
     1.2 +++ b/lsonify.c	Thu May 21 00:56:16 2009 -0700
     1.3 @@ -106,9 +106,12 @@
     1.4  }
     1.5  
     1.6  int
     1.7 -sample_rate_change () {
     1.8 -	printf("Sample rate has changed! Exiting...\n");
     1.9 -	exit(-1);
    1.10 +sample_rate_change (jack_nframes_t nframes, void *arg) {
    1.11 +	if (nframes != sr) {
    1.12 +		printf("Sample rate has changed! Exiting...\n");
    1.13 +		exit(-1);
    1.14 +	}
    1.15 +	return 0;
    1.16  }
    1.17  
    1.18  int
    1.19 @@ -222,6 +225,7 @@
    1.20  	output_port = jack_port_register (client, port_string, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
    1.21  
    1.22  	sr = jack_get_sample_rate (client);
    1.23 +	jack_set_sample_rate_callback (client, sample_rate_change, 0);
    1.24  
    1.25  	/* setup wave table parameters */
    1.26  	wave_length = 60 * sr / bpm;