From 740f06b69a354c22dd92e9ca2d371fc93f259604 Mon Sep 17 00:00:00 2001 From: Paul Brossier Date: Sat, 17 Oct 2009 00:43:00 +0200 Subject: [PATCH] ext/, examples/, swig/, python/, tests/: remove libaubioext, make libsamplerate optional --- Makefile.am | 2 +- configure.ac | 4 +- examples/Makefile.am | 27 ++++---- {ext => examples}/jackio.c | 0 {ext => examples}/jackio.h | 0 {ext => examples}/sndfileio.c | 0 {ext => examples}/sndfileio.h | 0 examples/utils.h | 5 +- examples/wscript_build | 18 ++--- ext/Makefile.am | 15 ---- ext/aubioext.h | 42 ----------- ext/wscript_build | 13 ---- python/aubio/Makefile.am | 10 +-- python/aubio/wscript_build | 12 +++- swig/aubio.i | 69 +++++++++++-------- .../{python/examples/README => README.tests} | 0 ... yinfft.16568__acclivity__TwoCows.wav.txt} | 0 tests/src/test-phasevoc-jack.c | 2 +- wscript | 11 +-- 19 files changed, 96 insertions(+), 134 deletions(-) rename {ext => examples}/jackio.c (100%) rename {ext => examples}/jackio.h (100%) rename {ext => examples}/sndfileio.c (100%) rename {ext => examples}/sndfileio.h (100%) delete mode 100644 ext/Makefile.am delete mode 100644 ext/aubioext.h delete mode 100644 ext/wscript_build rename tests/{python/examples/README => README.tests} (100%) rename tests/python/examples/aubiopitch/{yinfft.16568_acclivity_TwoCows.wav.txt => yinfft.16568__acclivity__TwoCows.wav.txt} (100%) diff --git a/Makefile.am b/Makefile.am index 257a70df..db7792d5 100644 --- a/Makefile.am +++ b/Makefile.am @@ -13,7 +13,7 @@ endif endif -SUBDIRS = src ext interfaces/cpp examples sounds plugins $(PYTHONDIR) $(SWIGDIR) $(JAVADIR) $(DOC) tests +SUBDIRS = src interfaces/cpp examples sounds plugins $(PYTHONDIR) $(SWIGDIR) $(JAVADIR) $(DOC) tests EXTRA_DIST = bootstrap VERSION docs: diff --git a/configure.ac b/configure.ac index eb27baec..5c3c19be 100644 --- a/configure.ac +++ b/configure.ac @@ -166,7 +166,8 @@ AC_ARG_ENABLE(samplerate, [with_samplerate=$enableval], with_samplerate="yes") if test "$with_samplerate" = "yes"; then - PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.0.15, HAVE_SAMPLERATE=1) + PKG_CHECK_MODULES(SAMPLERATE, samplerate >= 0.0.15, HAVE_SAMPLERATE=1, + HAVE_SAMPLERATE=0) if test "${HAVE_SAMPLERATE}" = "1"; then AC_DEFINE(HAVE_SAMPLERATE,1,[Define to enable libsamplerate support]) fi @@ -256,7 +257,6 @@ dnl Create Makefiles AC_OUTPUT([ Makefile src/Makefile - ext/Makefile examples/Makefile tests/Makefile tests/src/Makefile diff --git a/examples/Makefile.am b/examples/Makefile.am index 3ac9a14e..bf593506 100644 --- a/examples/Makefile.am +++ b/examples/Makefile.am @@ -1,6 +1,6 @@ # global flags -AM_CFLAGS = -DAUBIO_PREFIX=\"$(prefix)\" -I$(top_srcdir)/src -I$(top_srcdir)/ext @AUBIO_CFLAGS@ @LASH_CFLAGS@ @FFTWLIB_CFLAGS@ -AM_LDFLAGS = -L$(top_builddir)/src -L$(top_builddir)/ext -laubioext -laubio @LASH_LIBS@ +AM_CFLAGS = -DAUBIO_PREFIX=\"$(prefix)\" -I$(top_srcdir)/src @AUBIO_CFLAGS@ @LASH_CFLAGS@ @SNDFILE_CFLAGS@ @JACK_CFLAGS@ +AM_LDFLAGS = -L$(top_builddir)/src -laubio @LASH_LIBS@ # add your programs to this list bin_PROGRAMS = \ @@ -12,17 +12,18 @@ bin_PROGRAMS = \ noinst_PROGRAMS = \ aubioquiet -EXTRA_DIST = utils.h +EXTRA_DIST = utils.h sndfileio.h jackio.h # optionally add sources file for these programs -aubioonset_SOURCES = aubioonset.c utils.c -aubionotes_SOURCES = aubionotes.c utils.c -aubiotrack_SOURCES = aubiotrack.c utils.c -aubioquiet_SOURCES = aubioquiet.c utils.c -aubiomfcc_SOURCES = aubiomfcc.c utils.c +COMMON_SOURCE_FILES = sndfileio.c jackio.c utils.c +aubioonset_SOURCES = aubioonset.c $(COMMON_SOURCE_FILES) +aubionotes_SOURCES = aubionotes.c $(COMMON_SOURCE_FILES) +aubiotrack_SOURCES = aubiotrack.c $(COMMON_SOURCE_FILES) +aubioquiet_SOURCES = aubioquiet.c $(COMMON_SOURCE_FILES) +aubiomfcc_SOURCES = aubiomfcc.c $(COMMON_SOURCE_FILES) -aubioonset_LDADD = @JACK_LIBS@ -aubionotes_LDADD = @JACK_LIBS@ -aubiotrack_LDADD = @JACK_LIBS@ -aubioquiet_LDADD = @JACK_LIBS@ -aubiomfcc_LDADD = @JACK_LIBS@ +aubioonset_LDADD = @SNDFILE_LIBS@ @JACK_LIBS@ +aubionotes_LDADD = @SNDFILE_LIBS@ @JACK_LIBS@ +aubiotrack_LDADD = @SNDFILE_LIBS@ @JACK_LIBS@ +aubioquiet_LDADD = @SNDFILE_LIBS@ @JACK_LIBS@ +aubiomfcc_LDADD = @SNDFILE_LIBS@ @JACK_LIBS@ diff --git a/ext/jackio.c b/examples/jackio.c similarity index 100% rename from ext/jackio.c rename to examples/jackio.c diff --git a/ext/jackio.h b/examples/jackio.h similarity index 100% rename from ext/jackio.h rename to examples/jackio.h diff --git a/ext/sndfileio.c b/examples/sndfileio.c similarity index 100% rename from ext/sndfileio.c rename to examples/sndfileio.c diff --git a/ext/sndfileio.h b/examples/sndfileio.h similarity index 100% rename from ext/sndfileio.h rename to examples/sndfileio.h diff --git a/examples/utils.h b/examples/utils.h index 884f94ba..17a7a8bd 100644 --- a/examples/utils.h +++ b/examples/utils.h @@ -26,7 +26,10 @@ #include /* for isfinite */ #include /* for strcmp */ #include -#include +#include "sndfileio.h" +#ifdef HAVE_JACK +#include "jackio.h" +#endif /* HAVE_JACK */ #ifdef HAVE_C99_VARARGS_MACROS #define debug(...) if (verbose) fprintf (stderr, __VA_ARGS__) diff --git a/examples/wscript_build b/examples/wscript_build index 84943bc6..33b601a7 100644 --- a/examples/wscript_build +++ b/examples/wscript_build @@ -3,23 +3,25 @@ defines = ['AUBIO_PREFIX="' + bld.env['AUBIO_PREFIX'] + '"'] defines += ['PACKAGE="' + bld.env['PACKAGE'] + '"'] +extra_source = ['utils.c', 'sndfileio.c', 'jackio.c'] + bld.new_task_gen(features = 'cc', - includes = '../src ../ext', - source = 'utils.c', + includes = '../src', + source = extra_source, uselib = ['LASH'], defines = defines, - target = 'utils') + target = 'utils_io') # loop over all *.c filenames in examples to build them all for target_name in bld.path.ant_glob('*.c').split(): # ignore utils.c - if target_name in ['utils.c']: continue + if target_name in extra_source: continue bld.new_task_gen(features = 'cc cprogram', - add_objects = 'utils', - includes = '../src ../ext', + add_objects = 'utils_io', + includes = '../src', defines = defines, - uselib = ['LASH'], - uselib_local = ['aubio', 'aubioext'], + uselib = ['LASH', 'JACK', 'SNDFILE'], + uselib_local = ['aubio'], source = target_name, # program name is filename.c without the .c target = target_name.split('.')[0]) diff --git a/ext/Makefile.am b/ext/Makefile.am deleted file mode 100644 index 24e4b524..00000000 --- a/ext/Makefile.am +++ /dev/null @@ -1,15 +0,0 @@ -pkginclude_HEADERS = \ - aubioext.h \ - jackio.h \ - sndfileio.h - -lib_LTLIBRARIES = libaubioext.la -libaubioext_la_SOURCES = aubioext.h \ - jackio.c \ - jackio.h \ - sndfileio.c \ - sndfileio.h - -AM_CFLAGS = -I$(top_srcdir)/src @AUBIO_CFLAGS@ @SNDFILE_CFLAGS@ @JACK_CFLAGS@ @FFTWLIB_CFLAGS@ @SAMPLERATE_CFLAGS@ -libaubioext_la_LIBADD = -laubio -L${top_builddir}/src @SNDFILE_LIBS@ @JACK_LIBS@ @FFTWLIB_LIBS@ @SAMPLERATE_LIBS@ @LTLIBOBJS@ -libaubioext_la_LDFLAGS = -version-info @SHARED_VERSION_INFO@ diff --git a/ext/aubioext.h b/ext/aubioext.h deleted file mode 100644 index 67f75da5..00000000 --- a/ext/aubioext.h +++ /dev/null @@ -1,42 +0,0 @@ -/* - Copyright (C) 2003 Paul Brossier - - 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. - -*/ - -#ifndef __AUBIOEXT_H__ -#define __AUBIOEXT_H__ - - -#ifdef __cplusplus -extern "C" { -#endif - -#include - -#if HAVE_JACK -#include "jackio.h" -#endif /* HAVE_JACK */ - -#if HAVE_SNDFILE -#include "sndfileio.h" -#endif /* HAVE_SNDFILE */ - -#ifdef __cplusplus -} /* extern "C" */ -#endif - -#endif diff --git a/ext/wscript_build b/ext/wscript_build deleted file mode 100644 index b9e67791..00000000 --- a/ext/wscript_build +++ /dev/null @@ -1,13 +0,0 @@ -# build libaubioext -libaubioext = bld.new_task_gen( - features = 'cc cshlib', - includes = ['.', '../src'], - source = bld.path.ant_glob('*.c **/*.c'), - target = 'aubioext', - uselib = ['SNDFILE', 'JACK'], - uselib_local = ['aubio'], - vnum = bld.env['LIB_VERSION']) - -# install headers -for file in bld.path.ant_glob('**/*.h').split(): - bld.install_as('${PREFIX}/include/aubio/' + file, file) diff --git a/python/aubio/Makefile.am b/python/aubio/Makefile.am index 2eed2af9..426d12bd 100644 --- a/python/aubio/Makefile.am +++ b/python/aubio/Makefile.am @@ -44,21 +44,23 @@ CLEANFILES = *.pyc *.so *.o aubio_wrap.c aubiowrapper.py NOWARN_CFLAGS = -Wno-missing-prototypes -Wno-missing-declarations \ -Wno-strict-aliasing -AM_CFLAGS = @AUBIO_CFLAGS@ $(NOWARN_CFLAGS) $(SWCFLAGS) \ - -I$(top_builddir)/src -I$(top_srcdir)/src -I$(top_srcdir)/ext \ +AM_CFLAGS = @AUBIO_CFLAGS@ @SNDFILE_CFLAGS@ \ + $(NOWARN_CFLAGS) $(SWCFLAGS) \ + -I$(top_builddir)/src -I$(top_srcdir)/src \ + -I$(top_srcdir)/examples \ -I/usr/include/python${PYTHON_VERSION} \ -I${prefix}/include/python${PYTHON_VERSION} \ -I/usr/include \ -I${prefix}/include AUBIO_LDFLAGS = $(SWLDFLAGS) \ - -L$(top_builddir)/ext -laubioext \ + @SNDFILE_LIBS@ \ -L$(top_builddir)/src -laubio pkgpyexec_LTLIBRARIES = _aubiowrapper.la _aubiowrapper_la_LDFLAGS = -module -avoid-version $(AUBIO_LDFLAGS) -_aubiowrapper_la_SOURCES = aubio_wrap.c +_aubiowrapper_la_SOURCES = aubio_wrap.c $(top_srcdir)/examples/sndfileio.c aubio_wrap.c aubiowrapper.py: $(SWIG) -outdir . -o aubio_wrap.c -python $(top_srcdir)/swig/aubio.i diff --git a/python/aubio/wscript_build b/python/aubio/wscript_build index 61c36d22..34943f15 100644 --- a/python/aubio/wscript_build +++ b/python/aubio/wscript_build @@ -1,10 +1,18 @@ +bld.new_task_gen(features = 'cc', + includes = '../../examples ../../src', + source = ['../../examples/sndfileio.c'], + uselib = ['JACK'], + target = 'sndfileio') + pyaubio = bld.new_task_gen(name = 'python-aubio', features = 'cc cshlib pyext', source = '../../swig/aubio.i', + add_objects = 'sndfileio', target = '_aubiowrapper', - uselib_local = ['aubio', 'aubioext'], + uselib_local = ['aubio'], + uselib = ['SNDFILE'], swig_flags = '-python -Wall', - includes = '. ../../src ../../ext') + includes = '. ../../src ../../examples') pyaubio.install_path = '${PYTHONDIR}/${PACKAGE}' # install python files diff --git a/swig/aubio.i b/swig/aubio.i index 599d2054..70a9888d 100644 --- a/swig/aubio.i +++ b/swig/aubio.i @@ -1,12 +1,8 @@ %module aubiowrapper %{ - #include "aubio.h" - #include "aubioext.h" -%} - #include "aubio.h" -#include "aubioext.h" +%} /* type aliases */ typedef unsigned int uint_t; @@ -60,18 +56,6 @@ extern smpl_t ** cvec_get_norm(cvec_t *s); extern smpl_t ** cvec_get_phas(cvec_t *s); -/* sndfile */ -%#if HAVE_SNDFILE -extern aubio_sndfile_t * new_aubio_sndfile_ro (const char * inputfile); -extern aubio_sndfile_t * new_aubio_sndfile_wo(aubio_sndfile_t * existingfile, const char * outputname); -extern void aubio_sndfile_info(aubio_sndfile_t * file); -extern int aubio_sndfile_write(aubio_sndfile_t * file, int frames, fvec_t * write); -extern int aubio_sndfile_read(aubio_sndfile_t * file, int frames, fvec_t * read); -extern int del_aubio_sndfile(aubio_sndfile_t * file); -extern uint_t aubio_sndfile_channels(aubio_sndfile_t * file); -extern uint_t aubio_sndfile_samplerate(aubio_sndfile_t * file); -%#endif /* HAVE_SNDFILE */ - /* fft */ extern aubio_fft_t * new_aubio_fft(uint_t size, uint_t channels); extern void del_aubio_fft(aubio_fft_t * s); @@ -175,16 +159,16 @@ void aubio_mfcc_do(aubio_mfcc_t *mf, cvec_t *in, fvec_t *out); /* scale */ extern aubio_scale_t * new_aubio_scale(smpl_t flow, smpl_t fhig, smpl_t ilow, smpl_t ihig); -extern void aubio_scale_set_limits (aubio_scale_t *s, smpl_t ilow, smpl_t ihig, smpl_t olow, smpl_t ohig); +extern uint_t aubio_scale_set_limits (aubio_scale_t *s, smpl_t ilow, smpl_t ihig, smpl_t olow, smpl_t ohig); extern void aubio_scale_do(aubio_scale_t *s, fvec_t * input); extern void del_aubio_scale(aubio_scale_t *s); /* resampling */ -%#if HAVE_SAMPLERATE +#if HAVE_SAMPLERATE extern aubio_resampler_t * new_aubio_resampler(float ratio, uint_t type); extern void aubio_resampler_do (aubio_resampler_t *s, fvec_t * input, fvec_t * output); extern void del_aubio_resampler(aubio_resampler_t *s); -%#endif /* HAVE_SAMPLERATE */ +#endif /* HAVE_SAMPLERATE */ /* onset detection */ aubio_onsetdetection_t * new_aubio_onsetdetection(char * onset_mode, uint_t size, uint_t channels); @@ -201,11 +185,10 @@ void aubio_pvoc_rdo(aubio_pvoc_t *pv, cvec_t * fftgrain, fvec_t *out); aubio_pitchdetection_t *new_aubio_pitchdetection (char *pitch_mode, uint_t bufsize, uint_t hopsize, uint_t channels, uint_t samplerate); void aubio_pitchdetection_do (aubio_pitchdetection_t * p, fvec_t * ibuf, fvec_t * obuf); -void aubio_pitchdetection_set_tolerance(aubio_pitchdetection_t *p, smpl_t thres); -void aubio_pitchdetection_set_unit(aubio_pitchdetection_t *p, char * pitch_unit); +uint_t aubio_pitchdetection_set_tolerance(aubio_pitchdetection_t *p, smpl_t thres); +uint_t aubio_pitchdetection_set_unit(aubio_pitchdetection_t *p, char * pitch_unit); void del_aubio_pitchdetection(aubio_pitchdetection_t * p); - /* pitch mcomb */ aubio_pitchmcomb_t * new_aubio_pitchmcomb(uint_t bufsize, uint_t hopsize, uint_t channels); void aubio_pitchmcomb_do (aubio_pitchmcomb_t * p, cvec_t * fftgrain, fvec_t * out); @@ -231,14 +214,17 @@ aubio_peakpicker_t * new_aubio_peakpicker(smpl_t threshold); smpl_t aubio_peakpicker_do(aubio_peakpicker_t * p, fvec_t * df); smpl_t aubio_peakpicker_get_thresholded_input(aubio_peakpicker_t* p); void del_aubio_peakpicker(aubio_peakpicker_t * p); -void aubio_peakpicker_set_threshold(aubio_peakpicker_t * p, smpl_t threshold); +uint_t aubio_peakpicker_set_threshold(aubio_peakpicker_t * p, smpl_t threshold); smpl_t aubio_peakpicker_get_threshold(aubio_peakpicker_t * p); /* transient/steady state separation */ -aubio_tss_t * new_aubio_tss(smpl_t thrs, smpl_t alfa, smpl_t beta, - uint_t size, uint_t overlap,uint_t channels); -void del_aubio_tss(aubio_tss_t *s); -void aubio_tss_do(aubio_tss_t *s, cvec_t * input, cvec_t * trans, cvec_t * stead); +aubio_tss_t *new_aubio_tss (uint_t win_s, uint_t hop_s, uint_t channels); +void del_aubio_tss (aubio_tss_t * s); +void aubio_tss_do (aubio_tss_t * s, cvec_t * input, cvec_t * trans, + cvec_t * stead); +uint_t aubio_tss_set_threshold (aubio_tss_t * o, smpl_t thrs); +uint_t aubio_tss_set_alpha (aubio_tss_t * o, smpl_t alpha); +uint_t aubio_tss_set_beta (aubio_tss_t * o, smpl_t beta); /* beattracking */ aubio_beattracking_t * new_aubio_beattracking(uint_t winlen, uint_t channels); @@ -247,3 +233,30 @@ void del_aubio_beattracking(aubio_beattracking_t * p); smpl_t aubio_beattracking_get_bpm(aubio_beattracking_t * p); smpl_t aubio_beattracking_get_confidence(aubio_beattracking_t * p); +/* tempo */ +typedef struct _aubio_tempo_t aubio_tempo_t; +aubio_tempo_t * new_aubio_tempo (char_t * mode, + uint_t buf_size, uint_t hop_size, uint_t channels, uint_t samplerate); +void aubio_tempo_do (aubio_tempo_t *o, fvec_t * input, fvec_t * tempo); +uint_t aubio_tempo_set_silence(aubio_tempo_t * o, smpl_t silence); +uint_t aubio_tempo_set_threshold(aubio_tempo_t * o, smpl_t threshold); +smpl_t aubio_tempo_get_bpm(aubio_tempo_t * bt); +smpl_t aubio_tempo_get_confidence(aubio_tempo_t * bt); +void del_aubio_tempo(aubio_tempo_t * o); + +/* sndfile */ +%{ +#if HAVE_SNDFILE +#include "sndfileio.h" +%} +extern aubio_sndfile_t * new_aubio_sndfile_ro (const char * inputfile); +extern aubio_sndfile_t * new_aubio_sndfile_wo(aubio_sndfile_t * existingfile, const char * outputname); +extern void aubio_sndfile_info(aubio_sndfile_t * file); +extern int aubio_sndfile_write(aubio_sndfile_t * file, int frames, fvec_t * write); +extern int aubio_sndfile_read(aubio_sndfile_t * file, int frames, fvec_t * read); +extern int del_aubio_sndfile(aubio_sndfile_t * file); +extern uint_t aubio_sndfile_channels(aubio_sndfile_t * file); +extern uint_t aubio_sndfile_samplerate(aubio_sndfile_t * file); +%{ +#endif /* HAVE_SNDFILE */ +%} diff --git a/tests/python/examples/README b/tests/README.tests similarity index 100% rename from tests/python/examples/README rename to tests/README.tests diff --git a/tests/python/examples/aubiopitch/yinfft.16568_acclivity_TwoCows.wav.txt b/tests/python/examples/aubiopitch/yinfft.16568__acclivity__TwoCows.wav.txt similarity index 100% rename from tests/python/examples/aubiopitch/yinfft.16568_acclivity_TwoCows.wav.txt rename to tests/python/examples/aubiopitch/yinfft.16568__acclivity__TwoCows.wav.txt diff --git a/tests/src/test-phasevoc-jack.c b/tests/src/test-phasevoc-jack.c index 5d7cc3e7..ffc7673e 100644 --- a/tests/src/test-phasevoc-jack.c +++ b/tests/src/test-phasevoc-jack.c @@ -9,7 +9,7 @@ #include /* sleep() */ #include -#include +#include "jackio.h" uint_t testing = 1; /* change this to 1 to listen */ diff --git a/wscript b/wscript index 58bd1c9b..eb097210 100644 --- a/wscript +++ b/wscript @@ -136,7 +136,7 @@ def build(bld): bld.env['LIB_VERSION'] = LIB_VERSION # add sub directories - bld.add_subdirs('src ext examples interfaces/cpp') + bld.add_subdirs('src examples interfaces/cpp') if bld.env['SWIG']: if bld.env['PYTHON']: bld.add_subdirs('python/aubio python') @@ -187,8 +187,11 @@ def build_tests(bld): source = target_name, target = target_name.split('.')[0], includes = 'src', + defines = 'AUBIO_UNSTABLE_API=1', uselib_local = 'aubio') - # phasevoc-jack also needs aubioext + # phasevoc-jack also needs jack if target_name.endswith('test-phasevoc-jack.c'): - this_target.includes = ['src', 'ext'] - this_target.uselib_local = ['aubio', 'aubioext'] + this_target.includes = ['src', 'examples'] + this_target.uselib_local = ['aubio'] + this_target.uselib = ['JACK'] + this_target.source += ' examples/jackio.c' -- 2.26.2