/* * Copyright (C) 2001 Steve Harris * * This program is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation; either version 2 of the License, or * (at your option) any later version. * * This program 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 General Public License * along with this program; if not, write to the Free Software * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. * */ #include #include #include #include #include #include #include #include jack_port_t *input_port; jack_port_t *output_port; unsigned int impulse_sent = 0; float *response; unsigned long response_duration; unsigned long response_pos; int grab_finished = 0; jack_client_t *client; static void signal_handler(int sig) { jack_client_close(client); fprintf(stderr, "signal received, exiting ...\n"); exit(0); } static int process (jack_nframes_t nframes, void *arg) { jack_default_audio_sample_t *out = (jack_default_audio_sample_t *) jack_port_get_buffer (output_port, nframes); jack_default_audio_sample_t *in = (jack_default_audio_sample_t *) jack_port_get_buffer (input_port, nframes); unsigned int i; if (grab_finished) { return 0; } else if (impulse_sent) { for(i=0; i= response_duration) { grab_finished = 1; } for (i=0; i peak) { peak = fabs(response[i]); peak_sample = i; } } printf("\n};\n"); } else { for (i=0; i peak) { peak = fabs(response[i]); peak_sample = i; } } } fprintf(stderr, "Peak value was %f at sample %lu\n", peak, peak_sample); exit (0); }