From e3ae576fcd0083f0b5c8cf5ecaa011a0bb46b35e Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Thu, 28 Jul 2022 17:49:13 +0100 Subject: [PATCH 1/3] Avoid including incorrect literal in pc.in, even if it is supposed to be replaced on install --- rubberband.pc.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/rubberband.pc.in b/rubberband.pc.in index ac96edd..b872483 100644 --- a/rubberband.pc.in +++ b/rubberband.pc.in @@ -4,7 +4,7 @@ libdir=${exec_prefix}/lib includedir=${prefix}/include Name: rubberband -Version: 1.8.2 +Version: %VERSION% Description: Libs: -L${libdir} -lrubberband Cflags: -I${includedir} From 20d22f76d6ee7d58e23516659ec93bbc58962cd2 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Tue, 30 Aug 2022 18:55:33 +0100 Subject: [PATCH 2/3] Don't pass debug level through to FFT - it doesn't respect the log target --- src/faster/R2Stretcher.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/faster/R2Stretcher.cpp b/src/faster/R2Stretcher.cpp index 4546895..2fbc164 100644 --- a/src/faster/R2Stretcher.cpp +++ b/src/faster/R2Stretcher.cpp @@ -640,7 +640,7 @@ R2Stretcher::configure() if (!m_realtime && fftSizeChanged) { delete m_studyFFT; - m_studyFFT = new FFT(m_fftSize, m_log.getDebugLevel()); + m_studyFFT = new FFT(m_fftSize); m_studyFFT->initFloat(); } From e0a6fc686d0e6e6398272b8d3be2cb3a7fa0ffb0 Mon Sep 17 00:00:00 2001 From: Chris Cannam Date: Fri, 2 Sep 2022 11:10:44 +0100 Subject: [PATCH 3/3] Add support for external libspeexdsp --- meson.build | 46 ++++++++++++++++++++++++++-------------- meson_options.txt | 2 +- src/common/Resampler.cpp | 19 +++++++++++++++-- 3 files changed, 48 insertions(+), 19 deletions(-) diff --git a/meson.build b/meson.build index 42f7f7f..400aaec 100644 --- a/meson.build +++ b/meson.build @@ -113,6 +113,7 @@ endforeach fftw3_dep = dependency('fftw3', version: '>= 3.0.0', required: false) samplerate_dep = dependency('samplerate', version: '>= 0.1.8', required: false) +speexdsp_dep = dependency('speexdsp', version: '>= 1.0.0', required: false) sndfile_dep = dependency('sndfile', version: '>= 1.0.16', required: false) vamp_dep = dependency('vamp-sdk', version: '>= 2.9', required: false) boost_unit_test_dep = dependency('boost', modules: ['unit_test_framework'], version: '>= 1.73', required: false) @@ -177,17 +178,16 @@ elif fft == 'kissfft' general_include_dirs += 'src/ext/kissfft' elif fft == 'fftw' - if fftw3_dep.found() - config_summary += { 'FFT': 'FFTW' } - message('For FFT: using FFTW') - pkgconfig_requirements += fftw3_dep - else - fftw_dep = cpp.find_library('fftw3', - dirs: get_option('extra_lib_dirs'), - has_headers: ['fftw3.h'], - header_args: extra_include_args, - required: true) + if not fftw3_dep.found() + fftw3_dep = cpp.find_library('fftw3', + dirs: get_option('extra_lib_dirs'), + has_headers: ['fftw3.h'], + header_args: extra_include_args, + required: true) endif + config_summary += { 'FFT': 'FFTW' } + message('For FFT: using FFTW') + pkgconfig_requirements += fftw3_dep feature_dependencies += fftw3_dep feature_defines += ['-DHAVE_FFTW3', '-DFFTW_DOUBLE_ONLY'] @@ -223,27 +223,41 @@ if resampler == 'builtin' feature_defines += ['-DUSE_BQRESAMPLER'] elif resampler == 'libsamplerate' - if samplerate_dep.found() - config_summary += { 'Resampler': 'libsamplerate' } - message('For resampler: using libsamplerate') - pkgconfig_requirements += samplerate_dep - else + if not samplerate_dep.found() samplerate_dep = cpp.find_library('samplerate', dirs: get_option('extra_lib_dirs'), has_headers: ['samplerate.h'], header_args: extra_include_args, required: true) endif + config_summary += { 'Resampler': 'libsamplerate' } + message('For resampler: using libsamplerate') feature_dependencies += samplerate_dep + pkgconfig_requirements += samplerate_dep feature_defines += ['-DHAVE_LIBSAMPLERATE'] elif resampler == 'speex' config_summary += { 'Resampler': 'Speex' } - message('For resampler: using Speex') + message('For resampler: using bundled Speex') message('(consider libsamplerate if time-varying pitch shift is required)') feature_sources += ['src/ext/speex/resample.c'] feature_defines += ['-DUSE_SPEEX'] +elif resampler == 'libspeexdsp' + if not speexdsp_dep.found() + speexdsp_dep = cpp.find_library('speexdsp', + dirs: get_option('extra_lib_dirs'), + has_headers: ['speex/speex_resampler.h'], + header_args: extra_include_args, + required: true) + endif + config_summary += { 'Resampler': 'libspeexdsp' } + message('For resampler: using Speex DSP library') + message('(consider libsamplerate if time-varying pitch shift is required)') + feature_dependencies += speexdsp_dep + pkgconfig_requirements += speexdsp_dep + feature_defines += ['-DHAVE_LIBSPEEXDSP'] + elif resampler == 'ipp' if ipp_path != '' config_summary += { 'Resampler': 'Intel IPP' } diff --git a/meson_options.txt b/meson_options.txt index c820c20..3ca090c 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -7,7 +7,7 @@ option('fft', option('resampler', type: 'combo', - choices: ['auto', 'builtin', 'libsamplerate', 'speex', 'ipp'], + choices: ['auto', 'builtin', 'libsamplerate', 'speex', 'libspeexdsp', 'ipp'], value: 'auto', description: 'Resampler library to use. The default (auto) simply uses the builtin implementation.') diff --git a/src/common/Resampler.cpp b/src/common/Resampler.cpp index 32444a7..df46471 100644 --- a/src/common/Resampler.cpp +++ b/src/common/Resampler.cpp @@ -55,6 +55,10 @@ #ifdef USE_SPEEX #include "../ext/speex/speex_resampler.h" +#else +#ifdef HAVE_LIBSPEEXDSP +#include +#endif #endif #ifdef USE_BQRESAMPLER @@ -64,6 +68,7 @@ #ifndef HAVE_IPP #ifndef HAVE_LIBSAMPLERATE #ifndef HAVE_LIBRESAMPLE +#ifndef HAVE_LIBSPEEXDSP #ifndef USE_SPEEX #ifndef USE_BQRESAMPLER #error No resampler implementation selected! @@ -72,6 +77,7 @@ #endif #endif #endif +#endif #define BQ_R__ R__ @@ -1106,7 +1112,7 @@ D_BQResampler::reset() #endif /* USE_BQRESAMPLER */ -#ifdef USE_SPEEX +#if defined(USE_SPEEX) || defined(HAVE_LIBSPEEXDSP) class D_Speex : public Resampler::Impl { @@ -1404,6 +1410,9 @@ Resampler::Resampler(Resampler::Parameters params, int channels) #ifdef USE_SPEEX m_method = 2; #endif +#ifdef HAVE_LIBSPEEXDSP + m_method = 2; +#endif #ifdef HAVE_LIBRESAMPLE m_method = 3; #endif @@ -1425,6 +1434,9 @@ Resampler::Resampler(Resampler::Parameters params, int channels) #ifdef USE_SPEEX m_method = 2; #endif +#ifdef HAVE_LIBSPEEXDSP + m_method = 2; +#endif #ifdef USE_BQRESAMPLER m_method = 4; #endif @@ -1443,6 +1455,9 @@ Resampler::Resampler(Resampler::Parameters params, int channels) #ifdef USE_SPEEX m_method = 2; #endif +#ifdef HAVE_LIBSPEEXDSP + m_method = 2; +#endif #ifdef USE_BQRESAMPLER m_method = 4; #endif @@ -1483,7 +1498,7 @@ Resampler::Resampler(Resampler::Parameters params, int channels) break; case 2: -#ifdef USE_SPEEX +#if defined(USE_SPEEX) || defined(HAVE_LIBSPEEXDSP) d = new Resamplers::D_Speex (params.quality, params.ratioChange, channels,