From: Paul Brossier Date: Wed, 23 Sep 2009 17:40:14 +0000 (+0200) Subject: replace FOO_SUPPORT with HAVE_FOO, use float for jack_process function prototype X-Git-Tag: 0.4.0-beta1~857 X-Git-Url: https://git.aubio.org/?p=aubio.git;a=commitdiff_plain;h=b511fa9c8a005c964a817eed7278f0600afd6f08 replace FOO_SUPPORT with HAVE_FOO, use float for jack_process function prototype --- diff --git a/configure.ac b/configure.ac index d02e82bf..43f0c24b 100644 --- a/configure.ac +++ b/configure.ac @@ -142,11 +142,11 @@ fi dnl Check for pkg-config AC_PATH_PROG(PKG_CONFIG,pkg-config,no) -PKG_CHECK_MODULES(SNDLIB, sndfile >= 1.0.4, SNDLIB_SUPPORT=1) -PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.0.15, SAMPLERATE_SUPPORT=1) +PKG_CHECK_MODULES(SNDLIB, sndfile >= 1.0.4, HAVE_SNDLIB=1) +PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.0.15, HAVE_SAMPLERATE=1) -if test "${SNDLIB_SUPPORT}" = "1"; then - AC_DEFINE(SNDLIB_SUPPORT,1,[Define to enable libsndfile support]) +if test "${HAVE_SNDLIB}" = "1"; then + AC_DEFINE(HAVE_SNDLIB,1,[Define to enable libsndfile support]) fi dnl Check for fftw3 (required) @@ -155,18 +155,18 @@ AC_ARG_ENABLE(fftw3f, [with_fftw3f=$enableval], with_fftw3f="yes") if test "$with_fftw3f" = "yes"; then - PKG_CHECK_MODULES(FFTWLIB, fftw3f >= 3.0.0, FFTW3F_SUPPORT=1, FFTW3F_SUPPORT=0) + PKG_CHECK_MODULES(FFTWLIB, fftw3f >= 3.0.0, HAVE_FFTW3F=1, HAVE_FFTW3F=0) else - PKG_CHECK_MODULES(FFTWLIB, fftw3 >= 3.0.0, FFTW3_SUPPORT=1) + PKG_CHECK_MODULES(FFTWLIB, fftw3 >= 3.0.0, HAVE_FFTW3=1) fi -if test "${FFTW3F_SUPPORT}" = "0"; then - PKG_CHECK_MODULES(FFTWLIB, fftw3 >= 3.0.0, FFTW3_SUPPORT=1) +if test "${HAVE_FFTW3F}" = "0"; then + PKG_CHECK_MODULES(FFTWLIB, fftw3 >= 3.0.0, HAVE_FFTW3=1) fi -if test "${FFTW3_SUPPORT}" = "1"; then - AC_DEFINE(FFTW3_SUPPORT,1,[Define to enable fftw3 support]) +if test "${HAVE_FFTW3}" = "1"; then + AC_DEFINE(HAVE_FFTW3,1,[Define to enable fftw3 support]) fi -if test "${FFTW3F_SUPPORT}" = "1"; then - AC_DEFINE(FFTW3F_SUPPORT,1,[Define to enable fftw3f support]) +if test "${HAVE_FFTW3F}" = "1"; then + AC_DEFINE(HAVE_FFTW3F,1,[Define to enable fftw3f support]) fi dnl Enable jack support (auto) @@ -176,9 +176,9 @@ AC_ARG_ENABLE(jack, with_jack="yes") if test "$with_jack" = "yes" then - PKG_CHECK_MODULES(JACK, jack >= 0.15.0, JACK_SUPPORT=1, JACK_SUPPORT=0) - if test "${JACK_SUPPORT}" = "1"; then - AC_DEFINE(JACK_SUPPORT,1,[Define to enable jack support]) + PKG_CHECK_MODULES(JACK, jack >= 0.15.0, HAVE_JACK=1, HAVE_JACK=0) + if test "${HAVE_JACK}" = "1"; then + AC_DEFINE(HAVE_JACK,1,[Define to enable jack support]) fi fi @@ -191,9 +191,9 @@ if test "$with_alsa" = "yes" then if test "$with_jack" = "yes" then - PKG_CHECK_MODULES(ALSA, alsa >= 0.0.9, ALSA_SUPPORT=1, ALSA_SUPPORT=0) - if test "${ALSA_SUPPORT}" = "1"; then - AC_DEFINE(ALSA_SUPPORT,1,[Define to enable alsa support]) + PKG_CHECK_MODULES(ALSA, alsa >= 0.0.9, HAVE_ALSA=1, HAVE_ALSA=0) + if test "${HAVE_ALSA}" = "1"; then + AC_DEFINE(HAVE_ALSA,1,[Define to enable alsa support]) fi else AC_MSG_WARN([Disabling alsa as jack was not found]) @@ -207,9 +207,9 @@ AC_ARG_ENABLE(lash, with_lash="yes") if test "$with_lash" = "yes" then - PKG_CHECK_MODULES(LASH, lash-1.0 >= 0.5.0, LASH_SUPPORT=1, LASH_SUPPORT=0) - if test "${LASH_SUPPORT}" = "1"; then - LASH_CFLAGS+="-DLASH_SUPPORT" + PKG_CHECK_MODULES(LASH, lash-1.0 >= 0.5.0, HAVE_LASH=1, HAVE_LASH=0) + if test "${HAVE_LASH}" = "1"; then + LASH_CFLAGS+="-DHAVE_LASH" fi fi @@ -269,36 +269,36 @@ dnl Print summary echo echo "**************************************************************" echo "Summary:" -if test "${FFTW3F_SUPPORT}" = "1"; then +if test "${HAVE_FFTW3F}" = "1"; then echo "Fftw3: yes (using fftw3f)" else -if test "${FFTW3_SUPPORT}" = "1"; then +if test "${HAVE_FFTW3}" = "1"; then echo "Fftw3: yes (not using fftw3f)" else echo "Fftw3: no (that should not happen)" fi fi -if test "${SNDLIB_SUPPORT}" = "1"; then +if test "${HAVE_SNDLIB}" = "1"; then echo "Libsndfile: yes" else echo "Libsndfile: no" fi -if test "${SAMPLERATE_SUPPORT}" = "1"; then +if test "${HAVE_SAMPLERATE}" = "1"; then echo "Libsamplerate: yes" else echo "Libsamplerate: no" fi -if test "${JACK_SUPPORT}" = "1"; then +if test "${HAVE_JACK}" = "1"; then echo "JACK: yes" else echo "JACK: no" fi -if test "${ALSA_SUPPORT}" = "1"; then +if test "${HAVE_ALSA}" = "1"; then echo "ALSA midi: yes" else echo "ALSA midi: no" fi -if test "${LASH_SUPPORT}" = "1"; then +if test "${HAVE_LASH}" = "1"; then echo "Lash: yes" else echo "Lash: no" diff --git a/examples/utils.c b/examples/utils.c index 515c3e35..10f7f4b5 100644 --- a/examples/utils.c +++ b/examples/utils.c @@ -1,8 +1,8 @@ #include "aubio.h" -#ifndef JACK_SUPPORT -#define JACK_SUPPORT 0 +#ifndef HAVE_JACK +#define HAVE_JACK 0 #endif #include @@ -12,7 +12,7 @@ #include /* for isfinite */ #include "utils.h" -#ifdef LASH_SUPPORT +#ifdef HAVE_LASH #include #include lash_client_t * aubio_lash_client; @@ -22,7 +22,7 @@ int lash_main (void); void save_data (void); void restore_data(lash_config_t * lash_config); pthread_t lash_thread; -#endif /* LASH_SUPPORT */ +#endif /* HAVE_LASH */ /* settings */ const char * output_filename = NULL; @@ -130,9 +130,9 @@ int parse_args (int argc, char **argv) { {"hopsize", 1, NULL, 'H'}, {NULL , 0, NULL, 0} }; -#ifdef LASH_SUPPORT +#ifdef HAVE_LASH lash_args = lash_extract_args(&argc, &argv); -#endif /* LASH_SUPPORT */ +#endif /* HAVE_LASH */ prog_name = argv[0]; if( argc < 1 ) { usage (stderr, 1); @@ -237,7 +237,7 @@ int parse_args (int argc, char **argv) { debug ("Input file : %s\n", input_filename ); debug ("Output file : %s\n", output_filename ); } else { - if (JACK_SUPPORT) + if (HAVE_JACK) { debug ("Jack input output\n"); usejack = 1; @@ -287,7 +287,7 @@ void examples_common_init(int argc,char ** argv) { if (output_filename != NULL) fileout = new_aubio_sndfile_wo(file, output_filename); } -#ifdef LASH_SUPPORT +#ifdef HAVE_LASH else { aubio_lash_client = lash_init(lash_args, argv[0], LASH_Config_Data_Set | LASH_Terminal, @@ -303,7 +303,7 @@ void examples_common_init(int argc,char ** argv) { pthread_create(&lash_thread, NULL, lash_thread_main, NULL); } } -#endif /* LASH_SUPPORT */ +#endif /* HAVE_LASH */ ibuf = new_fvec(overlap_size, channels); obuf = new_fvec(overlap_size, channels); @@ -359,7 +359,7 @@ void examples_common_del(void){ void examples_common_process(aubio_process_func_t process_func, aubio_print_func_t print ){ if(usejack) { -#if JACK_SUPPORT +#if HAVE_JACK aubio_jack_t * jack_setup; debug("Jack init ...\n"); jack_setup = new_aubio_jack(channels, channels, @@ -431,7 +431,7 @@ void send_noteon(int pitch, int velo) { smpl_t mpitch = floor(aubio_freqtomidi(pitch)+.5); /* we should check if we use midi here, not jack */ -#if ALSA_SUPPORT +#if HAVE_ALSA if (usejack) { if (velo==0) { aubio_midi_event_set_type(event,NOTE_OFF); @@ -473,7 +473,7 @@ uint_t get_note(fvec_t *note_buffer, fvec_t *note_buffer2){ return vec_median(note_buffer2); } -#if LASH_SUPPORT +#if HAVE_LASH void * lash_thread_main(void *data __attribute__((unused))) { @@ -542,5 +542,5 @@ void restore_data(lash_config_t * lash_config) { } -#endif /* LASH_SUPPORT */ +#endif /* HAVE_LASH */ diff --git a/examples/utils.h b/examples/utils.h index cc75bb63..cc55cb8e 100644 --- a/examples/utils.h +++ b/examples/utils.h @@ -51,9 +51,9 @@ int parse_args (int argc, char **argv); void examples_common_init(int argc, char **argv); void examples_common_del(void); typedef void (aubio_print_func_t)(void); -#ifndef JACK_SUPPORT +#ifndef HAVE_JACK typedef int (*aubio_process_func_t) - (smpl_t **input, smpl_t **output, int nframes); + (float **input, float **output, int nframes); #endif void examples_common_process(aubio_process_func_t process_func, aubio_print_func_t print); void flush_process(aubio_process_func_t process_func, aubio_print_func_t print); diff --git a/ext/aubioext.h b/ext/aubioext.h index 9b925243..e44e0b0b 100644 --- a/ext/aubioext.h +++ b/ext/aubioext.h @@ -27,10 +27,14 @@ extern "C" { #include -#ifdef JACK_SUPPORT +#ifdef HAVE_JACK #include "jackio.h" #endif +#if HAVE_ALSA +#define ALSA_SUPPORT 1 +#endif + #include "sndfileio.h" #include "midi/midi.h" diff --git a/ext/jackio.c b/ext/jackio.c index 2476adc7..ec1ea9bd 100644 --- a/ext/jackio.c +++ b/ext/jackio.c @@ -18,7 +18,7 @@ */ #include "config.h" -#ifdef JACK_SUPPORT +#ifdef HAVE_JACK #include #include "aubio_priv.h" #include "jackio.h" @@ -172,4 +172,4 @@ static int aubio_jack_process(jack_nframes_t nframes, void *arg) { } -#endif /* JACK_SUPPORT */ +#endif /* HAVE_JACK */ diff --git a/ext/jackio.h b/ext/jackio.h index 9d0768e0..2634ba8f 100644 --- a/ext/jackio.h +++ b/ext/jackio.h @@ -34,7 +34,7 @@ extern "C" { /** jack object */ typedef struct _aubio_jack_t aubio_jack_t; /** jack process function */ -typedef int (*aubio_process_func_t)(smpl_t **input, smpl_t **output, int +typedef int (*aubio_process_func_t)(float **input, float **output, int nframes); /** jack device creation function */ diff --git a/ext/midi/midi_driver.h b/ext/midi/midi_driver.h index f9a0e7ae..e489ab03 100644 --- a/ext/midi/midi_driver.h +++ b/ext/midi/midi_driver.h @@ -49,9 +49,9 @@ aubio_midi_driver_t* new_aubio_midi_driver(char * name, void del_aubio_midi_driver(aubio_midi_driver_t* driver); void aubio_midi_driver_settings(aubio_settings_t* settings); -#include "config.h" -#if JACK_SUPPORT +#include "aubioext.h" +#if HAVE_JACK void aubio_midi_direct_output(aubio_midi_driver_t * dev, aubio_midi_event_t * event); -#endif +#endif /* HAVE_JACK */ #endif /* _AUBIO_AUDRIVER_H */ diff --git a/src/aubio_priv.h b/src/aubio_priv.h index 03792edc..755a523c 100644 --- a/src/aubio_priv.h +++ b/src/aubio_priv.h @@ -32,7 +32,7 @@ * */ -#if HAVE_CONFIG_H +#if 1 //HAVE_CONFIG_H #include "config.h" #endif @@ -57,7 +57,7 @@ #include #endif -#if HAVE_STRINGS_H +#if HAVE_STRING_H #include #endif diff --git a/src/mathutils.c b/src/mathutils.c index 4c1d5379..d39cd6f7 100644 --- a/src/mathutils.c +++ b/src/mathutils.c @@ -418,10 +418,10 @@ void aubio_autocorr(fvec_t * input, fvec_t * output) { } void aubio_cleanup(void) { -#if FFTW3_SUPPORT +#if HAVE_FFTW3 fftw_cleanup(); #else -#if FFTW3F_SUPPORT +#if HAVE_FFTW3F fftwf_cleanup(); #endif #endif diff --git a/src/spectral/fft.c b/src/spectral/fft.c index 7c770832..8c682bb8 100644 --- a/src/spectral/fft.c +++ b/src/spectral/fft.c @@ -23,7 +23,7 @@ #include "mathutils.h" #include "spectral/fft.h" -#if FFTW3F_SUPPORT +#if HAVE_FFTW3F #define fftw_malloc fftwf_malloc #define fftw_free fftwf_free #define fftw_execute fftwf_execute @@ -34,7 +34,7 @@ #define fftw_destroy_plan fftwf_destroy_plan #endif -#if FFTW3F_SUPPORT +#if HAVE_FFTW3F #if !AUBIO_SINGLE_PRECISION #warning "Using aubio in double precision with fftw3 in single precision" #endif diff --git a/src/spectral/fft.h b/src/spectral/fft.h index 1737bd95..f067b20b 100644 --- a/src/spectral/fft.h +++ b/src/spectral/fft.h @@ -31,13 +31,13 @@ #include #ifdef HAVE_COMPLEX_H -#if FFTW3F_SUPPORT +#if HAVE_FFTW3F #define FFTW_TYPE fftwf_complex #else #define FFTW_TYPE fftw_complex #endif #else -#if FFTW3F_SUPPORT +#if HAVE_FFTW3F /** fft data type */ #define FFTW_TYPE float #else diff --git a/tests/src/test-phasevoc-jack.c b/tests/src/test-phasevoc-jack.c index 00570686..d5aca4f8 100644 --- a/tests/src/test-phasevoc-jack.c +++ b/tests/src/test-phasevoc-jack.c @@ -20,7 +20,7 @@ fvec_t * out; aubio_pvoc_t * pv; -#ifdef JACK_SUPPORT +#ifdef HAVE_JACK aubio_jack_t * jack_setup; #endif @@ -42,7 +42,7 @@ int main(){ aubio_pvoc_rdo(pv,fftgrain,out); printf("computed backard\n"); -#ifdef JACK_SUPPORT +#ifdef HAVE_JACK jack_setup = new_aubio_jack(channels, channels, (aubio_process_func_t)aubio_process); aubio_jack_activate(jack_setup);