diff --git a/.hgtags b/.hgtags index c72ad9e..70cb1f3 100644 --- a/.hgtags +++ b/.hgtags @@ -10,3 +10,4 @@ efbc861f9b9460068c48a250232d343ffa7d5726 v1.7 77466ee7ffb5b07efda9b1dbed858379c987a9da v1.8.1 d4911a276d96f6232a68c6b8448056d3946043b9 v1.8.1 fa6a54be7e6bf0c5adffd19ccec622481a8140a5 v1.8.2 +37b18c17c042eafc39483ffb58837de844ba3289 v1.9 diff --git a/.travis.yml b/.travis.yml index 1ddce82..eb3bafc 100644 --- a/.travis.yml +++ b/.travis.yml @@ -19,7 +19,16 @@ addons: - libfftw3-dev - vamp-plugin-sdk - ladspa-sdk - + +cache: + directories: + - $HOME/Library/Caches/Homebrew + - /usr/local/Homebrew + +before_cache: + - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then brew cleanup; fi + - if [ "${TRAVIS_OS_NAME}" = "osx" ]; then find /usr/local/Homebrew \! -regex ".+\.git.+" -delete; fi + before_install: - if [[ "$TRAVIS_OS_NAME" = "osx" ]] ; then brew update ; brew install libsndfile ; fi diff --git a/Makefile.ios b/Makefile.ios index 04741a6..a8d8087 100644 --- a/Makefile.ios +++ b/Makefile.ios @@ -4,10 +4,10 @@ CC := clang OPTFLAGS := -ffast-math -freciprocal-math -O3 -ftree-vectorize # For the device -ARCHFLAGS_DEV := -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -miphoneos-version-min=6 -stdlib=libc++ -arch armv7 -arch arm64 +ARCHFLAGS_DEV := -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk -miphoneos-version-min=6 -stdlib=libc++ -arch armv7 -arch arm64 -fembed-bitcode # Or for the simulator -ARCHFLAGS_SIM := -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk -miphoneos-version-min=6 -stdlib=libc++ -arch i386 -arch x86_64 +ARCHFLAGS_SIM := -isysroot /Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk -miphoneos-version-min=6 -stdlib=libc++ -arch i386 -arch x86_64 -fembed-bitcode CXXFLAGS_ANY := $(OPTFLAGS) -I. -Isrc -Irubberband -DMALLOC_IS_ALIGNED -DHAVE_VDSP -DUSE_SPEEX -DUSE_POMMIER_MATHFUN -DNO_THREADING -DNO_THREAD_CHECKS -DNO_TIMING -DNO_TIMING_COMPLETE_NOOP -DNDEBUG diff --git a/Makefile.osx b/Makefile.osx index 642533f..650c2f0 100644 --- a/Makefile.osx +++ b/Makefile.osx @@ -32,6 +32,8 @@ DYNAMIC_EXTENSION := .dylib DYNAMIC_FULL_VERSION := 2.1.2 DYNAMIC_ABI_VERSION := 2 DYNAMIC_LDFLAGS := -dynamiclib -install_name $(INSTALL_LIBDIR)/$(LIBNAME).$(DYNAMIC_ABI_VERSION)$(DYNAMIC_EXTENSION) -current_version $(DYNAMIC_FULL_VERSION) -compatibility_version $(DYNAMIC_ABI_VERSION) +VAMP_LDFLAGS := -dynamiclib -install_name vamp-rubberband.dylib -exported_symbols_list vamp/vamp-plugin.list +LADSPA_LDFLAGS := -dynamiclib -install_name ladspa-rubberband.dylib -exported_symbols_list ladspa/ladspa-plugin.list PROGRAM_TARGET := bin/rubberband STATIC_TARGET := lib/$(LIBNAME).a diff --git a/README.md b/README.md index b476350..bfcc98f 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,13 @@ tempo and pitch of an audio recording independently of one another. * About Rubber Band: https://breakfastquay.com/rubberband/ * Code repository: https://hg.sr.ht/~breakfastquay/rubberband +* Issue tracker: https://todo.sr.ht/~breakfastquay/rubberband +* Github mirror: https://github.com/breakfastquay/rubberband + +CI builds: + +* [![Build Status](https://travis-ci.org/breakfastquay/rubberband.svg?branch=master)](https://travis-ci.org/breakfastquay/rubberband) (Linux, macOS, iOS) +* [![Build Status](https://ci.appveyor.com/api/projects/status/hhhhpf718jwhpyf6?svg=true)](https://ci.appveyor.com/project/breakfastquay/rubberband) (Windows) ## Licence @@ -193,6 +200,8 @@ Name Flags required Notes ---- -------------- ----- libsamplerate -DHAVE_LIBSAMPLERATE GPL until v0.1.8, BSD for v0.1.9 and later. + This is the preferred choice in almost + all cases. libresample -DHAVE_LIBRESAMPLE LGPL. diff --git a/ladspa/ladspa-plugin.list b/ladspa/ladspa-plugin.list new file mode 100644 index 0000000..853ffc6 --- /dev/null +++ b/ladspa/ladspa-plugin.list @@ -0,0 +1 @@ +_ladspa_descriptor diff --git a/src/StretcherImpl.cpp b/src/StretcherImpl.cpp index b9e3443..cbf8b7b 100644 --- a/src/StretcherImpl.cpp +++ b/src/StretcherImpl.cpp @@ -466,6 +466,10 @@ RubberBandStretcher::Impl::calculateSizes() outputIncrement /= 2; inputIncrement = int(outputIncrement / r); } + while (inputIncrement < 1) { + outputIncrement *= 2; + inputIncrement = int(outputIncrement / r); + } size_t minwin = roundUp(lrint(outputIncrement * windowIncrRatio)); if (windowSize < minwin) windowSize = minwin; @@ -501,6 +505,10 @@ RubberBandStretcher::Impl::calculateSizes() outputIncrement /= 2; inputIncrement = int(outputIncrement / r); } + while (inputIncrement < 1) { + outputIncrement *= 2; + inputIncrement = int(outputIncrement / r); + } windowSize = std::max(windowSize, roundUp(outputIncrement * 6)); if (r > 5) while (windowSize < 8192) windowSize *= 2; } diff --git a/src/audiocurves/HighFrequencyAudioCurve.cpp b/src/audiocurves/HighFrequencyAudioCurve.cpp index bae61f5..dbe3c24 100644 --- a/src/audiocurves/HighFrequencyAudioCurve.cpp +++ b/src/audiocurves/HighFrequencyAudioCurve.cpp @@ -42,7 +42,7 @@ HighFrequencyAudioCurve::reset() } float -HighFrequencyAudioCurve::processFloat(const float *R__ mag, int increment) +HighFrequencyAudioCurve::processFloat(const float *R__ mag, int) { float result = 0.0; @@ -56,7 +56,7 @@ HighFrequencyAudioCurve::processFloat(const float *R__ mag, int increment) } double -HighFrequencyAudioCurve::processDouble(const double *R__ mag, int increment) +HighFrequencyAudioCurve::processDouble(const double *R__ mag, int) { float result = 0.0; diff --git a/src/audiocurves/PercussiveAudioCurve.cpp b/src/audiocurves/PercussiveAudioCurve.cpp index c1190fb..5d3efcb 100644 --- a/src/audiocurves/PercussiveAudioCurve.cpp +++ b/src/audiocurves/PercussiveAudioCurve.cpp @@ -58,7 +58,7 @@ PercussiveAudioCurve::setFftSize(int newSize) } float -PercussiveAudioCurve::processFloat(const float *R__ mag, int increment) +PercussiveAudioCurve::processFloat(const float *R__ mag, int) { static float threshold = powf(10.f, 0.15f); // 3dB rise in square of magnitude static float zeroThresh = powf(10.f, -8); @@ -84,7 +84,7 @@ PercussiveAudioCurve::processFloat(const float *R__ mag, int increment) } double -PercussiveAudioCurve::processDouble(const double *R__ mag, int increment) +PercussiveAudioCurve::processDouble(const double *R__ mag, int) { static double threshold = pow(10., 0.15); // 3dB rise in square of magnitude static double zeroThresh = pow(10., -8); diff --git a/src/audiocurves/SpectralDifferenceAudioCurve.cpp b/src/audiocurves/SpectralDifferenceAudioCurve.cpp index cb10ee6..91fc81f 100644 --- a/src/audiocurves/SpectralDifferenceAudioCurve.cpp +++ b/src/audiocurves/SpectralDifferenceAudioCurve.cpp @@ -62,7 +62,7 @@ SpectralDifferenceAudioCurve::setFftSize(int newSize) } float -SpectralDifferenceAudioCurve::processFloat(const float *R__ mag, int increment) +SpectralDifferenceAudioCurve::processFloat(const float *R__ mag, int) { double result = 0.0; @@ -83,7 +83,7 @@ SpectralDifferenceAudioCurve::processFloat(const float *R__ mag, int increment) } double -SpectralDifferenceAudioCurve::processDouble(const double *R__ mag, int increment) +SpectralDifferenceAudioCurve::processDouble(const double *R__ mag, int) { double result = 0.0; diff --git a/src/dsp/Resampler.cpp b/src/dsp/Resampler.cpp index 205fc7f..383c5a1 100644 --- a/src/dsp/Resampler.cpp +++ b/src/dsp/Resampler.cpp @@ -718,7 +718,7 @@ D_SRC::resampleInterleaved(const float *const R__ in, { SRC_DATA data; - int outcount = lrintf(ceilf(incount * ratio)); + int outcount = lrintf(ceilf(incount * ratio) + 10); data.data_in = const_cast(in); data.data_out = out; @@ -1209,11 +1209,11 @@ Resampler::Resampler(Resampler::Quality quality, int channels, #ifdef HAVE_LIBRESAMPLE m_method = 3; #endif -#ifdef HAVE_LIBSAMPLERATE - m_method = 1; -#endif #ifdef USE_SPEEX m_method = 2; +#endif +#ifdef HAVE_LIBSAMPLERATE + m_method = 1; #endif break; diff --git a/src/system/Allocators.h b/src/system/Allocators.h index c431f78..2f1fbbf 100644 --- a/src/system/Allocators.h +++ b/src/system/Allocators.h @@ -271,9 +271,13 @@ T **reallocate_channels(T **ptr, { T **newptr = allocate_channels(channels, count); if (oldcount && ptr) { - v_copy_channels(newptr, ptr, channels, oldcount < count ? oldcount : count); + for (size_t c = 0; c < oldchannels && c < channels; ++c) { + for (size_t i = 0; i < oldcount && i < count; ++i) { + newptr[c][i] = ptr[c][i]; + } + } } - if (ptr) deallocate_channels(ptr, channels); + if (ptr) deallocate_channels(ptr, oldchannels); return newptr; } @@ -284,9 +288,13 @@ T **reallocate_and_zero_extend_channels(T **ptr, { T **newptr = allocate_and_zero_channels(channels, count); if (oldcount && ptr) { - v_copy_channels(newptr, ptr, channels, oldcount < count ? oldcount : count); + for (size_t c = 0; c < oldchannels && c < channels; ++c) { + for (size_t i = 0; i < oldcount && i < count; ++i) { + newptr[c][i] = ptr[c][i]; + } + } } - if (ptr) deallocate_channels(ptr, channels); + if (ptr) deallocate_channels(ptr, oldchannels); return newptr; } diff --git a/src/system/Thread.cpp b/src/system/Thread.cpp index 8d35647..eb65731 100644 --- a/src/system/Thread.cpp +++ b/src/system/Thread.cpp @@ -200,7 +200,11 @@ Mutex::trylock() } } -Condition::Condition(string name) : +Condition::Condition(string +#ifdef DEBUG_CONDITION + name +#endif + ) : m_locked(false) #ifdef DEBUG_CONDITION , m_name(name) @@ -456,7 +460,11 @@ Mutex::trylock() } } -Condition::Condition(string name) : +Condition::Condition(string +#ifdef DEBUG_CONDITION + name +#endif + ) : m_locked(false) #ifdef DEBUG_CONDITION , m_name(name) diff --git a/src/system/VectorOps.h b/src/system/VectorOps.h index 405b176..92694e1 100644 --- a/src/system/VectorOps.h +++ b/src/system/VectorOps.h @@ -38,6 +38,7 @@ #ifdef HAVE_VDSP #include +#include #endif #include @@ -521,7 +522,7 @@ template<> inline void v_log(float *const R__ dst, const int count) { - float tmp[count]; + float *tmp = (float *)alloca(count * sizeof(float)); vvlogf(tmp, dst, &count); v_copy(dst, tmp, count); } @@ -529,7 +530,7 @@ template<> inline void v_log(double *const R__ dst, const int count) { - double tmp[count]; + double *tmp = (double *)alloca(count * sizeof(double)); vvlog(tmp, dst, &count); v_copy(dst, tmp, count); } @@ -566,7 +567,7 @@ template<> inline void v_exp(float *const R__ dst, const int count) { - float tmp[count]; + float *tmp = (float *)alloca(count * sizeof(float)); vvexpf(tmp, dst, &count); v_copy(dst, tmp, count); } @@ -574,7 +575,7 @@ template<> inline void v_exp(double *const R__ dst, const int count) { - double tmp[count]; + double *tmp = (double *)alloca(count * sizeof(double)); vvexp(tmp, dst, &count); v_copy(dst, tmp, count); } @@ -611,7 +612,7 @@ template<> inline void v_sqrt(float *const R__ dst, const int count) { - float tmp[count]; + float *tmp = (float *)alloca(count * sizeof(float)); vvsqrtf(tmp, dst, &count); v_copy(dst, tmp, count); } @@ -619,7 +620,7 @@ template<> inline void v_sqrt(double *const R__ dst, const int count) { - double tmp[count]; + double *tmp = (double *)alloca(count * sizeof(double)); vvsqrt(tmp, dst, &count); v_copy(dst, tmp, count); } @@ -676,8 +677,10 @@ template<> inline void v_abs(float *const R__ dst, const int count) { - float tmp[count]; -#if (defined(MACOSX_DEPLOYMENT_TARGET) && MACOSX_DEPLOYMENT_TARGET <= 1070 && MAC_OS_X_VERSION_MIN_REQUIRED <= 1070) + float *tmp = (float *)alloca(count * sizeof(float)); +#if TARGET_OS_IPHONE + vvfabsf(tmp, dst, &count); +#elif (defined(MAC_OS_X_VERSION_MIN_REQUIRED) && MAC_OS_X_VERSION_MIN_REQUIRED < 1070) vvfabf(tmp, dst, &count); #else vvfabsf(tmp, dst, &count); diff --git a/vamp/vamp-plugin.list b/vamp/vamp-plugin.list new file mode 100644 index 0000000..47a3e77 --- /dev/null +++ b/vamp/vamp-plugin.list @@ -0,0 +1 @@ +_vampGetPluginDescriptor