diff --git a/.hgignore b/.hgignore index f8d3da1..54a0f8b 100644 --- a/.hgignore +++ b/.hgignore @@ -12,4 +12,5 @@ lib/* config.status doc/html *.rej - +cov-int +*~ diff --git a/CHANGELOG b/CHANGELOG index 1045d4d..5c553ae 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,15 @@ +Changes in Rubber Band v1.8.2 + + * Fix a number of small memory leaks + * Make stretcher more robust to being fed invalid input (with NaNs) + * Include iOS build file + * Various platform build fixes and improvements + +The API is unchanged and the library is binary compatible with +version 1.7. + + Changes in Rubber Band v1.8.1 * Fix a crash in formant-preserving pitch shift for some build targets diff --git a/Makefile.in b/Makefile.in index d376df3..3a70a71 100644 --- a/Makefile.in +++ b/Makefile.in @@ -6,7 +6,7 @@ CXXFLAGS := -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHE CFLAGS := @CFLAGS@ $(OPTFLAGS) LDFLAGS := @LDFLAGS@ -lpthread $(LDFLAGS) -JNI_CXXFLAGS := -I$(JAVA_HOME)/include +JNI_CXXFLAGS := -I$(JAVA_HOME)/include -I$(JAVA_HOME)/include/linux JAVAC := $(JAVA_HOME)/bin/javac JAR := $(JAVA_HOME)/bin/jar @@ -31,7 +31,7 @@ JNINAME := librubberband-jni JARNAME := rubberband.jar DYNAMIC_EXTENSION := .so -DYNAMIC_FULL_VERSION := 2.1.0 +DYNAMIC_FULL_VERSION := 2.1.1 DYNAMIC_ABI_VERSION := 2 DYNAMIC_LDFLAGS := -shared -Wl,-Bsymbolic -Wl,-soname=$(LIBNAME)$(DYNAMIC_EXTENSION).$(DYNAMIC_ABI_VERSION) VAMP_LDFLAGS := -shared -Wl,-Bsymbolic -Wl,--version-script=vamp/vamp-plugin.map @@ -183,7 +183,7 @@ install: all cp $(DYNAMIC_TARGET) $(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)$(DYNAMIC_EXTENSION).$(DYNAMIC_FULL_VERSION) ln -s $(LIBNAME)$(DYNAMIC_EXTENSION).$(DYNAMIC_FULL_VERSION) $(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)$(DYNAMIC_EXTENSION).$(DYNAMIC_ABI_VERSION) ln -s $(LIBNAME)$(DYNAMIC_EXTENSION).$(DYNAMIC_FULL_VERSION) $(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)$(DYNAMIC_EXTENSION) - cp $(JNI_TARGET) $(DESTDIR)$(INSTALL_LIBDIR)/$(JNINAME)$(DYNAMIC_EXTENSION) + cp -f $(JNI_TARGET) $(DESTDIR)$(INSTALL_LIBDIR)/$(JNINAME)$(DYNAMIC_EXTENSION) cp $(VAMP_TARGET) $(DESTDIR)$(INSTALL_VAMPDIR) cp vamp/vamp-rubberband.cat $(DESTDIR)$(INSTALL_VAMPDIR) cp $(LADSPA_TARGET) $(DESTDIR)$(INSTALL_LADSPADIR) diff --git a/Makefile.ios b/Makefile.ios new file mode 100644 index 0000000..04741a6 --- /dev/null +++ b/Makefile.ios @@ -0,0 +1,145 @@ + +CXX := clang++ +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 + +# 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 + +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 + +CXXFLAGS_DEV := $(ARCHFLAGS_DEV) $(CXXFLAGS_ANY) +CXXFLAGS_SIM := $(ARCHFLAGS_SIM) $(CXXFLAGS_ANY) + +CFLAGS_DEV := $(ARCHFLAGS_DEV) $(OPTFLAGS) +CFLAGS_SIM := $(ARCHFLAGS_SIM) $(OPTFLAGS) + +AR := ar +LIPO := lipo +MKDIR := mkdir + +LIBNAME := librubberband + +STATIC_TARGET := lib/$(LIBNAME).a +STATIC_TARGET_DEV := lib/$(LIBNAME).dev.a +STATIC_TARGET_SIM := lib/$(LIBNAME).sim.a + +default: lib $(STATIC_TARGET) + +all: lib $(STATIC_TARGET) + +static: $(STATIC_TARGET) + +PUBLIC_INCLUDES := \ + rubberband/rubberband-c.h \ + rubberband/RubberBandStretcher.h + +LIBRARY_INCLUDES := \ + src/StretcherChannelData.h \ + src/float_cast/float_cast.h \ + src/StretcherImpl.h \ + src/StretchCalculator.h \ + src/base/Profiler.h \ + src/base/RingBuffer.h \ + src/base/Scavenger.h \ + src/dsp/AudioCurveCalculator.h \ + src/audiocurves/CompoundAudioCurve.h \ + src/audiocurves/ConstantAudioCurve.h \ + src/audiocurves/HighFrequencyAudioCurve.h \ + src/audiocurves/PercussiveAudioCurve.h \ + src/audiocurves/SilentAudioCurve.h \ + src/audiocurves/SpectralDifferenceAudioCurve.h \ + src/dsp/Resampler.h \ + src/dsp/FFT.h \ + src/dsp/MovingMedian.h \ + src/dsp/SincWindow.h \ + src/dsp/Window.h \ + src/system/Allocators.h \ + src/system/Thread.h \ + src/system/VectorOps.h \ + src/system/VectorOpsComplex.h \ + src/system/sysutils.h + +LIBRARY_SOURCES := \ + src/rubberband-c.cpp \ + src/RubberBandStretcher.cpp \ + src/StretcherProcess.cpp \ + src/StretchCalculator.cpp \ + src/base/Profiler.cpp \ + src/dsp/AudioCurveCalculator.cpp \ + src/audiocurves/CompoundAudioCurve.cpp \ + src/audiocurves/SpectralDifferenceAudioCurve.cpp \ + src/audiocurves/HighFrequencyAudioCurve.cpp \ + src/audiocurves/SilentAudioCurve.cpp \ + src/audiocurves/ConstantAudioCurve.cpp \ + src/audiocurves/PercussiveAudioCurve.cpp \ + src/dsp/Resampler.cpp \ + src/dsp/FFT.cpp \ + src/system/Allocators.cpp \ + src/system/sysutils.cpp \ + src/system/Thread.cpp \ + src/system/VectorOpsComplex.cpp \ + src/StretcherChannelData.cpp \ + src/StretcherImpl.cpp + +# For Speex resampler -- comment these lines out if not specifying USE_SPEEX +LIBRARY_INCLUDES := $(LIBRARY_INCLUDES) \ + src/speex/speex_resampler.h +LIBRARY_SOURCES := $(LIBRARY_SOURCES) \ + src/speex/resample.c + +LIBRARY_OBJECTS_DEV := $(LIBRARY_SOURCES:.cpp=.dev.o) +LIBRARY_OBJECTS_DEV := $(LIBRARY_OBJECTS_DEV:.c=.dev.o) + +LIBRARY_OBJECTS_SIM := $(LIBRARY_SOURCES:.cpp=.sim.o) +LIBRARY_OBJECTS_SIM := $(LIBRARY_OBJECTS_SIM:.c=.sim.o) + +$(STATIC_TARGET): $(STATIC_TARGET_DEV) $(STATIC_TARGET_SIM) + rm -f $@ + $(LIPO) -create -output $@ $^ + @echo + @echo "Build complete." + @echo + @echo "Please note that you cannot legally distribute the Rubber Band Library in an" + @echo "iOS app on the App Store, unless you have first obtained a commercial licence." + @echo + +$(STATIC_TARGET_DEV): $(LIBRARY_OBJECTS_DEV) + rm -f $@ + $(AR) rsc $@ $^ + +$(STATIC_TARGET_SIM): $(LIBRARY_OBJECTS_SIM) + rm -f $@ + $(AR) rsc $@ $^ + +%.dev.o: %.c + $(CC) -c $(CFLAGS_DEV) -o $@ $< + +%.dev.o: %.cpp + $(CXX) -c $(CXXFLAGS_DEV) -o $@ $< + +%.sim.o: %.c + $(CC) -c $(CFLAGS_SIM) -o $@ $< + +%.sim.o: %.cpp + $(CXX) -c $(CXXFLAGS_SIM) -o $@ $< + +lib: + $(MKDIR) $@ + +clean: + rm -f $(LIBRARY_OBJECTS_DEV) $(LIBRARY_OBJECTS_SIM) + +distclean: clean + rm -f $(STATIC_TARGET_DEV) $(STATIC_TARGET_SIM) + +depend: + touch Makefile.dev_depends Makefile.sim_depends + makedepend -f Makefile.dev_depends -o.dev.o -Y $(LIBRARY_SOURCES) + makedepend -f Makefile.sim_depends -o.sim.o -Y $(LIBRARY_SOURCES) + +-include Makefile.dev_depends +-include Makefile.sim_depends diff --git a/Makefile.osx b/Makefile.osx index 6c2dc9c..4375188 100644 --- a/Makefile.osx +++ b/Makefile.osx @@ -1,8 +1,8 @@ PREFIX := /usr/local -CXX := g++ -CC := gcc -ARCHFLAGS := +CXX := clang++ -stdlib=libc++ +CC := clang +ARCHFLAGS := -arch i386 -arch x86_64 -mmacosx-version-min=10.7 OPTFLAGS := -DNDEBUG -ffast-math -mfpmath=sse -msse -msse2 -O3 -ftree-vectorize CXXFLAGS := $(ARCHFLAGS) $(OPTFLAGS) -I. -Isrc -Irubberband -I/usr/local/include -DUSE_PTHREADS -DMALLOC_IS_ALIGNED -DHAVE_VDSP -DUSE_SPEEX -DNO_THREAD_CHECKS -DNO_TIMING @@ -29,7 +29,7 @@ INSTALL_PKGDIR := $(PREFIX)/lib/pkgconfig LIBNAME := librubberband DYNAMIC_EXTENSION := .dylib -DYNAMIC_FULL_VERSION := 2.1.0 +DYNAMIC_FULL_VERSION := 2.1.1 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) @@ -183,7 +183,7 @@ distclean: clean rm -f $(PROGRAM_TARGET) $(STATIC_TARGET) $(DYNAMIC_TARGET) $(VAMP_TARGET) $(LADSPA_TARGET) depend: - makedepend -Y $(LIBRARY_SOURCES) $(PROGRAM_SOURCES) + makedepend -f Makefile.osx -Y $(LIBRARY_SOURCES) $(PROGRAM_SOURCES) # DO NOT DELETE diff --git a/README.txt b/README.txt index f38de26..f9756ed 100644 --- a/README.txt +++ b/README.txt @@ -5,7 +5,7 @@ Rubber Band An audio time-stretching and pitch-shifting library and utility program. Written by Chris Cannam, chris.cannam@breakfastquay.com. -Copyright 2007-2014 Particular Programs Ltd. +Copyright 2007-2015 Particular Programs Ltd. Rubber Band is a library and utility program that permits changing the tempo and pitch of an audio recording independently of one another. @@ -176,7 +176,7 @@ Resampler libraries supported Name Flags required Notes ---- -------------- ----- -libsamplerate -DHAVE_LIBSAMPLERATE GPL. +libsamplerate -DHAVE_LIBSAMPLERATE GPL until v0.1.8, BSD for v0.1.9 and later. libresample -DHAVE_LIBRESAMPLE LGPL. @@ -246,14 +246,16 @@ The following Makefile targets are available: The default target is "all". -4d. OS/X and iOS ----------------- +4d. OS/X +-------- A Makefile for OS/X is provided as Makefile.osx. Adjust the Makefile according to your preference for compiler and platform SDK, FFT and resampler implementations. The default is to -use the Accelerate framework and the Speex resampler. +use the Accelerate framework and the Speex resampler. Then run +e.g. "make -f Makefile.osx library" in a terminal window to build. +You will need the Xcode command-line tools installed. The following Makefile targets are available: @@ -275,8 +277,32 @@ for RubberBandStretcherJNI.cpp) and the API headers in rubberband/ should be all you need. Note that you cannot legally distribute applications using Rubber Band -through the iPhone/iPad App Store or OS/X App Store unless you have a -valid commercial licence. GPL code is not permitted in these stores. +in the Mac App Store, unless you have first obtained a commercial +licence for the Rubber Band Library. GPL code is not permitted in the +app store. See http://breakfastquay.com/technology/license.html for +commercial terms. + + +4d. iOS +------- + +A Makefile for iOS is provided as Makefile.ios. It produces a single +static library containing both simulator and device binaries, in both +32- and 64-bit architectures. + +Run e.g. "make -f Makefile.ios" in a terminal window to build. You +will need the Xcode command-line tools installed. + +If you prefer to add the Rubber Band library files to an existing +build project instead of using the Makefile, the files in src/ (except +for RubberBandStretcherJNI.cpp) and the API headers in rubberband/ +should be all you need. + +Note that you cannot legally distribute applications using Rubber Band +in the iOS App Store, unless you have a first obtained a commercial +licence for the Rubber Band Library. GPL code is not permitted in the +app store. See http://breakfastquay.com/technology/license.html for +commercial terms. 4e. Win32 and Visual Studio diff --git a/com/breakfastquay/rubberband/RubberBandStretcher.java b/com/breakfastquay/rubberband/RubberBandStretcher.java index 1c512ca..8ac6a04 100644 --- a/com/breakfastquay/rubberband/RubberBandStretcher.java +++ b/com/breakfastquay/rubberband/RubberBandStretcher.java @@ -1,4 +1,25 @@ -/* Copyright Chris Cannam - All Rights Reserved */ +/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ + +/* + Rubber Band Library + An audio time-stretching and pitch-shifting library. + Copyright 2007-2014 Particular Programs Ltd. + + 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. See the file + COPYING included with this distribution for more information. + + Alternatively, if you have a valid commercial licence for the + Rubber Band Library obtained by agreement with the copyright + holders, you may redistribute and/or modify it under the terms + described in that licence. + + If you wish to distribute code using the Rubber Band Library + under terms other than those of the GNU General Public License, + you must obtain a valid commercial licence before doing so. +*/ package com.breakfastquay.rubberband; diff --git a/configure.ac b/configure.ac index 73d7185..eef571b 100644 --- a/configure.ac +++ b/configure.ac @@ -1,5 +1,5 @@ -AC_INIT(RubberBand, 1.8.1, chris.cannam@breakfastquay.com) +AC_INIT(RubberBand, 1.8.2, chris.cannam@breakfastquay.com) AC_CONFIG_SRCDIR(src/StretcherImpl.h) AC_PROG_CXX diff --git a/ladspa/RubberBandPitchShifter.cpp b/ladspa/RubberBandPitchShifter.cpp index 6a4a17f..554940e 100644 --- a/ladspa/RubberBandPitchShifter.cpp +++ b/ladspa/RubberBandPitchShifter.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -253,6 +253,12 @@ RubberBandPitchShifter::RubberBandPitchShifter(int sampleRate, size_t channels) m_sampleRate(sampleRate), m_channels(channels) { + m_input = new float *[m_channels]; + m_output = new float *[m_channels]; + + m_outputBuffer = new RingBuffer *[m_channels]; + m_scratch = new float *[m_channels]; + for (size_t c = 0; c < m_channels; ++c) { m_input[c] = 0; @@ -276,6 +282,10 @@ RubberBandPitchShifter::~RubberBandPitchShifter() delete m_outputBuffer[c]; delete[] m_scratch[c]; } + delete[] m_outputBuffer; + delete[] m_scratch; + delete[] m_output; + delete[] m_input; } LADSPA_Handle diff --git a/ladspa/RubberBandPitchShifter.h b/ladspa/RubberBandPitchShifter.h index de28d59..096b2c8 100644 --- a/ladspa/RubberBandPitchShifter.h +++ b/ladspa/RubberBandPitchShifter.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -85,8 +85,8 @@ protected: void updateFormant(); void updateFast(); - float *m_input[2]; - float *m_output[2]; + float **m_input; + float **m_output; float *m_latency; float *m_cents; float *m_semitones; @@ -105,8 +105,8 @@ protected: size_t m_minfill; RubberBand::RubberBandStretcher *m_stretcher; - RubberBand::RingBuffer *m_outputBuffer[2]; - float *m_scratch[2]; + RubberBand::RingBuffer **m_outputBuffer; + float **m_scratch; int m_sampleRate; size_t m_channels; diff --git a/ladspa/libmain.cpp b/ladspa/libmain.cpp index 3ce8010..261f163 100644 --- a/ladspa/libmain.cpp +++ b/ladspa/libmain.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/main/main.cpp b/main/main.cpp index d51cff3..f7722ce 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -199,7 +199,7 @@ int main(int argc, char **argv) cerr << endl; cerr << "Rubber Band" << endl; cerr << "An audio time-stretching and pitch-shifting library and utility program." << endl; - cerr << "Copyright 2007-2012 Particular Programs Ltd." << endl; + cerr << "Copyright 2007-2015 Particular Programs Ltd." << endl; cerr << endl; cerr << " Usage: " << argv[0] << " [options] " << endl; cerr << endl; diff --git a/rubberband/RubberBandStretcher.h b/rubberband/RubberBandStretcher.h index f654cda..fc9fe4d 100644 --- a/rubberband/RubberBandStretcher.h +++ b/rubberband/RubberBandStretcher.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -24,7 +24,7 @@ #ifndef _RUBBERBANDSTRETCHER_H_ #define _RUBBERBANDSTRETCHER_H_ -#define RUBBERBAND_VERSION "1.8.1" +#define RUBBERBAND_VERSION "1.8.2" #define RUBBERBAND_API_MAJOR_VERSION 2 #define RUBBERBAND_API_MINOR_VERSION 5 @@ -462,11 +462,17 @@ public: void setPitchOption(Options options); /** - * Tell the stretcher exactly how many input samples it will + * Tell the stretcher exactly how many input sample frames it will * receive. This is only useful in Offline mode, when it allows * the stretcher to ensure that the number of output samples is * exactly correct. In RealTime mode no such guarantee is * possible and this value is ignored. + * + * Note that the value of "samples" refers to the number of audio + * sample frames, which may be multi-channel, not the number of + * individual samples. (For example, one second of stereo audio + * sampled at 44100Hz yields a value of 44100 sample frames, not + * 88200.) This rule applies throughout the Rubber Band API. */ void setExpectedInputDuration(size_t samples); @@ -492,6 +498,12 @@ public: * Note that this value is only relevant to process(), not to * study() (to which you may pass any number of samples at a time, * and from which there is no output). + * + * Note that the value of "samples" refers to the number of audio + * sample frames, which may be multi-channel, not the number of + * individual samples. (For example, one second of stereo audio + * sampled at 44100Hz yields a value of 44100 sample frames, not + * 88200.) This rule applies throughout the Rubber Band API. */ void setMaxProcessSize(size_t samples); @@ -512,6 +524,12 @@ public: * Note that this value is only relevant to process(), not to * study() (to which you may pass any number of samples at a time, * and from which there is no output). + * + * Note that the return value refers to the number of audio sample + * frames, which may be multi-channel, not the number of + * individual samples. (For example, one second of stereo audio + * sampled at 44100Hz yields a value of 44100 sample frames, not + * 88200.) This rule applies throughout the Rubber Band API. */ size_t getSamplesRequired() const; @@ -551,9 +569,16 @@ public: * blocks in individual study() calls, or as a single large block. * * "input" should point to de-interleaved audio data with one - * float array per channel. "samples" supplies the number of - * audio sample frames available in "input". If "samples" is - * zero, "input" may be NULL. + * float array per channel. Sample values are conventionally + * expected to be in the range -1.0f to +1.0f. "samples" supplies + * the number of audio sample frames available in "input". If + * "samples" is zero, "input" may be NULL. + * + * Note that the value of "samples" refers to the number of audio + * sample frames, which may be multi-channel, not the number of + * individual samples. (For example, one second of stereo audio + * sampled at 44100Hz yields a value of 44100 sample frames, not + * 88200.) This rule applies throughout the Rubber Band API. * * Set "final" to true if this is the last block of data that will * be provided to study() before the first process() call. @@ -564,6 +589,17 @@ public: * Provide a block of "samples" sample frames for processing. * See also getSamplesRequired() and setMaxProcessSize(). * + * "input" should point to de-interleaved audio data with one + * float array per channel. Sample values are conventionally + * expected to be in the range -1.0f to +1.0f. "samples" supplies + * the number of audio sample frames available in "input". + * + * Note that the value of "samples" refers to the number of audio + * sample frames, which may be multi-channel, not the number of + * individual samples. (For example, one second of stereo audio + * sampled at 44100Hz yields a value of 44100 sample frames, not + * 88200.) This rule applies throughout the Rubber Band API. + * * Set "final" to true if this is the last block of input data. */ void process(const float *const *input, size_t samples, bool final); @@ -578,6 +614,12 @@ public: * enough data has yet been processed. Call getSamplesRequired() * to discover whether more input is needed. * + * Note that the return value refers to the number of audio sample + * frames, which may be multi-channel, not the number of + * individual samples. (For example, one second of stereo audio + * sampled at 44100Hz yields a value of 44100 sample frames, not + * 88200.) This rule applies throughout the Rubber Band API. + * * This function returns -1 if all data has been fully processed * and all output read, and the stretch process is now finished. */ @@ -589,6 +631,13 @@ public: * channel for de-interleaved audio data) pointed to by "output". * The return value is the actual number of sample frames * retrieved. + * + * Note that the value of "samples" and the return value refer to + * the number of audio sample frames, which may be multi-channel, + * not the number of individual samples. (For example, one second + * of stereo audio sampled at 44100Hz yields a value of 44100 + * sample frames, not 88200.) This rule applies throughout the + * Rubber Band API. */ size_t retrieve(float *const *output, size_t samples) const; diff --git a/rubberband/rubberband-c.h b/rubberband/rubberband-c.h index 438b561..a73baa2 100644 --- a/rubberband/rubberband-c.h +++ b/rubberband/rubberband-c.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -28,7 +28,7 @@ extern "C" { #endif -#define RUBBERBAND_VERSION "1.8.1" +#define RUBBERBAND_VERSION "1.8.2" #define RUBBERBAND_API_MAJOR_VERSION 2 #define RUBBERBAND_API_MINOR_VERSION 5 diff --git a/src/RubberBandStretcher.cpp b/src/RubberBandStretcher.cpp index dcc6b94..160deab 100644 --- a/src/RubberBandStretcher.cpp +++ b/src/RubberBandStretcher.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/StretchCalculator.cpp b/src/StretchCalculator.cpp index 4494e66..2e0616f 100644 --- a/src/StretchCalculator.cpp +++ b/src/StretchCalculator.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -45,6 +45,7 @@ StretchCalculator::StretchCalculator(size_t sampleRate, m_recovery(0), m_prevRatio(1.0), m_transientAmnesty(0), + m_debugLevel(0), m_useHardPeaks(useHardPeaks) { // std::cerr << "StretchCalculator::StretchCalculator: useHardPeaks = " << useHardPeaks << std::endl; @@ -221,7 +222,7 @@ StretchCalculator::mapPeaks(std::vector &peaks, // NB we know for certain we have a mapping from 0 -> 0 (or at // least, some mapping for source sample 0) because that is - // enforced in setLockPoints above. However, we aren't guaranteed + // enforced in setKeyFrameMap above. However, we aren't guaranteed // to have a mapping for the total duration -- we will usually // need to assume it maps to the normal duration * ratio sample diff --git a/src/StretchCalculator.h b/src/StretchCalculator.h index 7c6a68d..f38321b 100644 --- a/src/StretchCalculator.h +++ b/src/StretchCalculator.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -102,7 +102,6 @@ protected: float adj) const; size_t m_sampleRate; - size_t m_blockSize; size_t m_increment; float m_prevDf; double m_divergence; diff --git a/src/StretcherChannelData.cpp b/src/StretcherChannelData.cpp index 5ddc30f..1ba3a8f 100644 --- a/src/StretcherChannelData.cpp +++ b/src/StretcherChannelData.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -27,6 +27,8 @@ #include "system/Allocators.h" +#include + namespace RubberBand { @@ -249,6 +251,7 @@ RubberBandStretcher::Impl::ChannelData::~ChannelData() deallocate(accumulator); deallocate(windowAccumulator); deallocate(fltbuf); + deallocate(dblbuf); for (std::map::iterator i = ffts.begin(); i != ffts.end(); ++i) { diff --git a/src/StretcherChannelData.h b/src/StretcherChannelData.h index 05f6cf4..0d0390e 100644 --- a/src/StretcherChannelData.h +++ b/src/StretcherChannelData.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/StretcherImpl.cpp b/src/StretcherImpl.cpp index b4a8bff..9d2e1ec 100644 --- a/src/StretcherImpl.cpp +++ b/src/StretcherImpl.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -45,6 +45,7 @@ #include #include #include +#include using namespace RubberBand; @@ -1057,7 +1058,7 @@ RubberBandStretcher::Impl::study(const float *const *input, size_t samples, bool } } - if (m_channels > 1) delete[] mdalloc; + if (m_channels > 1 || final) delete[] mdalloc; } vector @@ -1118,11 +1119,15 @@ RubberBandStretcher::Impl::calculateStretch() double prdm = 0, sdm = 0; if (!m_phaseResetDf.empty()) { - for (int i = 0; i < m_phaseResetDf.size(); ++i) prdm += m_phaseResetDf[i]; + for (int i = 0; i < (int)m_phaseResetDf.size(); ++i) { + prdm += m_phaseResetDf[i]; + } prdm /= m_phaseResetDf.size(); } if (!m_stretchDf.empty()) { - for (int i = 0; i < m_stretchDf.size(); ++i) sdm += m_stretchDf[i]; + for (int i = 0; i < (int)m_stretchDf.size(); ++i) { + sdm += m_stretchDf[i]; + } sdm /= m_stretchDf.size(); } // std::cerr << "phase reset df mean = " << prdm << ", stretch df mean = " << sdm << std::endl; diff --git a/src/StretcherImpl.h b/src/StretcherImpl.h index 82f0b32..22abfbc 100644 --- a/src/StretcherImpl.h +++ b/src/StretcherImpl.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/StretcherProcess.cpp b/src/StretcherProcess.cpp index 2bf152a..df9f8d4 100644 --- a/src/StretcherProcess.cpp +++ b/src/StretcherProcess.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -43,6 +43,7 @@ #include #include #include +#include using namespace RubberBand; diff --git a/src/audiocurves/CompoundAudioCurve.cpp b/src/audiocurves/CompoundAudioCurve.cpp index ac47130..3b4c285 100644 --- a/src/audiocurves/CompoundAudioCurve.cpp +++ b/src/audiocurves/CompoundAudioCurve.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/audiocurves/CompoundAudioCurve.h b/src/audiocurves/CompoundAudioCurve.h index c5bf0d8..458eb00 100644 --- a/src/audiocurves/CompoundAudioCurve.h +++ b/src/audiocurves/CompoundAudioCurve.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/audiocurves/ConstantAudioCurve.cpp b/src/audiocurves/ConstantAudioCurve.cpp index d1b6c91..9bdce1f 100644 --- a/src/audiocurves/ConstantAudioCurve.cpp +++ b/src/audiocurves/ConstantAudioCurve.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/audiocurves/ConstantAudioCurve.h b/src/audiocurves/ConstantAudioCurve.h index e6b2054..87cd4ea 100644 --- a/src/audiocurves/ConstantAudioCurve.h +++ b/src/audiocurves/ConstantAudioCurve.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/audiocurves/HighFrequencyAudioCurve.cpp b/src/audiocurves/HighFrequencyAudioCurve.cpp index f33eb4b..3f1f9e0 100644 --- a/src/audiocurves/HighFrequencyAudioCurve.cpp +++ b/src/audiocurves/HighFrequencyAudioCurve.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/audiocurves/HighFrequencyAudioCurve.h b/src/audiocurves/HighFrequencyAudioCurve.h index 5172669..7df0e1c 100644 --- a/src/audiocurves/HighFrequencyAudioCurve.h +++ b/src/audiocurves/HighFrequencyAudioCurve.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/audiocurves/PercussiveAudioCurve.cpp b/src/audiocurves/PercussiveAudioCurve.cpp index a1f76b0..80da163 100644 --- a/src/audiocurves/PercussiveAudioCurve.cpp +++ b/src/audiocurves/PercussiveAudioCurve.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/audiocurves/PercussiveAudioCurve.h b/src/audiocurves/PercussiveAudioCurve.h index c6d2fbb..9eac6bc 100644 --- a/src/audiocurves/PercussiveAudioCurve.h +++ b/src/audiocurves/PercussiveAudioCurve.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/audiocurves/SilentAudioCurve.cpp b/src/audiocurves/SilentAudioCurve.cpp index dbfd6bc..2a570ca 100644 --- a/src/audiocurves/SilentAudioCurve.cpp +++ b/src/audiocurves/SilentAudioCurve.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/audiocurves/SilentAudioCurve.h b/src/audiocurves/SilentAudioCurve.h index 4e07353..4146b7e 100644 --- a/src/audiocurves/SilentAudioCurve.h +++ b/src/audiocurves/SilentAudioCurve.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/audiocurves/SpectralDifferenceAudioCurve.cpp b/src/audiocurves/SpectralDifferenceAudioCurve.cpp index 5afa810..805cb9c 100644 --- a/src/audiocurves/SpectralDifferenceAudioCurve.cpp +++ b/src/audiocurves/SpectralDifferenceAudioCurve.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/audiocurves/SpectralDifferenceAudioCurve.h b/src/audiocurves/SpectralDifferenceAudioCurve.h index 20f9c64..25bdfb9 100644 --- a/src/audiocurves/SpectralDifferenceAudioCurve.h +++ b/src/audiocurves/SpectralDifferenceAudioCurve.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/base/Profiler.cpp b/src/base/Profiler.cpp index e899b23..d152682 100644 --- a/src/base/Profiler.cpp +++ b/src/base/Profiler.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/base/Profiler.h b/src/base/Profiler.h index e7bb4b9..96bc6af 100644 --- a/src/base/Profiler.h +++ b/src/base/Profiler.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/base/RingBuffer.h b/src/base/RingBuffer.h index dfad37f..b14a04e 100644 --- a/src/base/RingBuffer.h +++ b/src/base/RingBuffer.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -67,7 +67,7 @@ public: int getSize() const; /** - * Return a new ring buffer (allocated with "new" -- called must + * Return a new ring buffer (allocated with "new" -- caller must * delete when no longer needed) of the given size, containing the * same data as this one. If another thread reads from or writes * to this buffer during the call, the results may be incomplete @@ -89,8 +89,7 @@ public: void reset(); /** - * Return the amount of data available for reading by reader R, in - * samples. + * Return the amount of data available for reading, in samples. */ int getReadSpace() const; @@ -100,9 +99,9 @@ public: int getWriteSpace() const; /** - * Read n samples from the buffer, for reader R. If fewer than n - * are available, the remainder will be zeroed out. Returns the - * number of samples actually read. + * Read n samples from the buffer. If fewer than n are available, + * the remainder will be zeroed out. Returns the number of + * samples actually read. * * This is a template function, taking an argument S for the target * sample type, which is permitted to differ from T if the two @@ -112,10 +111,9 @@ public: int read(S *const R__ destination, int n); /** - * Read n samples from the buffer, for reader R, adding them to - * the destination. If fewer than n are available, the remainder - * will be left alone. Returns the number of samples actually - * read. + * Read n samples from the buffer, adding them to the destination. + * If fewer than n are available, the remainder will be left + * alone. Returns the number of samples actually read. * * This is a template function, taking an argument S for the target * sample type, which is permitted to differ from T if the two @@ -125,20 +123,19 @@ public: int readAdding(S *const R__ destination, int n); /** - * Read one sample from the buffer, for reader R. If no sample is - * available, this will silently return zero. Calling this - * repeatedly is obviously slower than calling read once, but it - * may be good enough if you don't want to allocate a buffer to - * read into. + * Read one sample from the buffer. If no sample is available, + * this will silently return zero. Calling this repeatedly is + * obviously slower than calling read once, but it may be good + * enough if you don't want to allocate a buffer to read into. */ T readOne(); /** - * Read n samples from the buffer, if available, for reader R, - * without advancing the read pointer -- i.e. a subsequent read() - * or skip() will be necessary to empty the buffer. If fewer than - * n are available, the remainder will be zeroed out. Returns the - * number of samples actually read. + * Read n samples from the buffer, if available, without advancing + * the read pointer -- i.e. a subsequent read() or skip() will be + * necessary to empty the buffer. If fewer than n are available, + * the remainder will be zeroed out. Returns the number of + * samples actually read. */ int peek(T *const R__ destination, int n) const; @@ -151,10 +148,9 @@ public: T peekOne() const; /** - * Pretend to read n samples from the buffer, for reader R, - * without actually returning them (i.e. discard the next n - * samples). Returns the number of samples actually available for - * discarding. + * Pretend to read n samples from the buffer, without actually + * returning them (i.e. discard the next n samples). Returns the + * number of samples actually available for discarding. */ int skip(int n); diff --git a/src/base/Scavenger.h b/src/base/Scavenger.h index a069056..db1ea35 100644 --- a/src/base/Scavenger.h +++ b/src/base/Scavenger.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -130,6 +130,7 @@ template Scavenger::Scavenger(int sec, int defaultObjectListSize) : m_objects(ObjectTimeList(defaultObjectListSize)), m_sec(sec), + m_lastExcess(0), m_claimed(0), m_scavenged(0), m_asExcess(0) diff --git a/src/dsp/AudioCurveCalculator.cpp b/src/dsp/AudioCurveCalculator.cpp index faaa277..cb3507b 100644 --- a/src/dsp/AudioCurveCalculator.cpp +++ b/src/dsp/AudioCurveCalculator.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/dsp/AudioCurveCalculator.h b/src/dsp/AudioCurveCalculator.h index ecaf78c..38c89d5 100644 --- a/src/dsp/AudioCurveCalculator.h +++ b/src/dsp/AudioCurveCalculator.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/dsp/FFT.cpp b/src/dsp/FFT.cpp index e49e1fe..7c0df1c 100644 --- a/src/dsp/FFT.cpp +++ b/src/dsp/FFT.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -43,8 +43,7 @@ #endif #ifdef HAVE_VDSP -#include -#include +#include #endif #ifdef HAVE_MEDIALIB @@ -1598,6 +1597,15 @@ public: m_commonMutex.unlock(); #endif } +#ifndef NO_THREADING + m_commonMutex.lock(); +#endif + if (m_extantf <= 0 && m_extantd <= 0) { + fftw_cleanup(); + } +#ifndef NO_THREADING + m_commonMutex.unlock(); +#endif } FFT::Precisions diff --git a/src/dsp/FFT.h b/src/dsp/FFT.h index 822af6a..52a64e6 100644 --- a/src/dsp/FFT.h +++ b/src/dsp/FFT.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/dsp/MovingMedian.h b/src/dsp/MovingMedian.h index c867fe2..a62f5a3 100644 --- a/src/dsp/MovingMedian.h +++ b/src/dsp/MovingMedian.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -30,6 +30,8 @@ #include +#include + namespace RubberBand { @@ -59,6 +61,10 @@ public: } void push(T value) { + if (value != value) { + std::cerr << "WARNING: MovingMedian: NaN encountered" << std::endl; + value = T(); + } drop(m_frame[0]); v_move(m_frame, m_frame+1, P::m_size-1); m_frame[P::m_size-1] = value; diff --git a/src/dsp/Resampler.cpp b/src/dsp/Resampler.cpp index 7f1bb8a..5e718d5 100644 --- a/src/dsp/Resampler.cpp +++ b/src/dsp/Resampler.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -28,6 +28,7 @@ #include #include +#include #include "system/Allocators.h" diff --git a/src/dsp/Resampler.h b/src/dsp/Resampler.h index f91157c..08da34b 100644 --- a/src/dsp/Resampler.h +++ b/src/dsp/Resampler.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/dsp/SampleFilter.h b/src/dsp/SampleFilter.h index c2589f4..758987e 100644 --- a/src/dsp/SampleFilter.h +++ b/src/dsp/SampleFilter.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/dsp/SincWindow.h b/src/dsp/SincWindow.h index 3d917c8..3e7beff 100644 --- a/src/dsp/SincWindow.h +++ b/src/dsp/SincWindow.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -85,7 +85,7 @@ public: } inline void add(T *const R__ dst, T scale) const { - v_add_with_gain(dst, m_cache, m_size, scale); + v_add_with_gain(dst, m_cache, scale, m_size); } inline T getArea() const { return m_area; } diff --git a/src/dsp/Window.h b/src/dsp/Window.h index 6ffa184..675117c 100644 --- a/src/dsp/Window.h +++ b/src/dsp/Window.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -80,7 +80,7 @@ public: } inline void add(T *const R__ dst, T scale) const { - v_add_with_gain(dst, m_cache, m_size, scale); + v_add_with_gain(dst, m_cache, scale, m_size); } inline T getRMS() const { diff --git a/src/float_cast/float_cast.h b/src/float_cast/float_cast.h index 0aff010..fdeedbb 100644 --- a/src/float_cast/float_cast.h +++ b/src/float_cast/float_cast.h @@ -38,7 +38,13 @@ ** long int lrint (double x) ; */ -#if (defined (WIN32) || defined (_WIN32)) +#if (defined (_WIN64)) + +#include +__inline long int lrint(double flt) { return (long int)flt; } +__inline long int lrintf(float flt) { return (long int)flt; } + +#elif (defined (WIN32) || defined (_WIN32)) #include diff --git a/src/jni/RubberBandStretcherJNI.cpp b/src/jni/RubberBandStretcherJNI.cpp index cb9bcd9..0b43fd3 100644 --- a/src/jni/RubberBandStretcherJNI.cpp +++ b/src/jni/RubberBandStretcherJNI.cpp @@ -1,5 +1,25 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ -/* Copyright Chris Cannam - All Rights Reserved */ + +/* + Rubber Band Library + An audio time-stretching and pitch-shifting library. + Copyright 2007-2015 Particular Programs Ltd. + + 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. See the file + COPYING included with this distribution for more information. + + Alternatively, if you have a valid commercial licence for the + Rubber Band Library obtained by agreement with the copyright + holders, you may redistribute and/or modify it under the terms + described in that licence. + + If you wish to distribute code using the Rubber Band Library + under terms other than those of the GNU General Public License, + you must obtain a valid commercial licence before doing so. +*/ #include "rubberband/RubberBandStretcher.h" diff --git a/src/rubberband-c.cpp b/src/rubberband-c.cpp index 3bb4fc5..f49e609 100644 --- a/src/rubberband-c.cpp +++ b/src/rubberband-c.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/system/Allocators.cpp b/src/system/Allocators.cpp index 4a8ee5b..3dcaca2 100644 --- a/src/system/Allocators.cpp +++ b/src/system/Allocators.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/system/Allocators.h b/src/system/Allocators.h index 08bf58b..98c0a62 100644 --- a/src/system/Allocators.h +++ b/src/system/Allocators.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/system/Thread.cpp b/src/system/Thread.cpp index d0e3360..27eda5a 100644 --- a/src/system/Thread.cpp +++ b/src/system/Thread.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/system/Thread.h b/src/system/Thread.h index 0ce754e..8550206 100644 --- a/src/system/Thread.h +++ b/src/system/Thread.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/system/VectorOps.h b/src/system/VectorOps.h index ba35c97..b79ac7f 100644 --- a/src/system/VectorOps.h +++ b/src/system/VectorOps.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -33,8 +33,7 @@ #endif #ifdef HAVE_VDSP -#include -#include +#include #endif #include @@ -289,8 +288,8 @@ inline void v_add_channels(T *const R__ *const R__ dst, template inline void v_add_with_gain(T *const R__ dst, const T *const R__ src, - const int count, - const G gain) + const G gain, + const int count) { for (int i = 0; i < count; ++i) { dst[i] += src[i] * gain; @@ -300,12 +299,12 @@ inline void v_add_with_gain(T *const R__ dst, template inline void v_add_channels_with_gain(T *const R__ *const R__ dst, const T *const R__ *const R__ src, + const G gain, const int channels, - const int count, - const G gain) + const int count) { for (int c = 0; c < channels; ++c) { - v_add_with_gain(dst[c], src[c], count, gain); + v_add_with_gain(dst[c], src[c], gain, count); } } @@ -674,7 +673,7 @@ inline void v_abs(float *const R__ dst, const int count) { float tmp[count]; -#if (MACOSX_DEPLOYMENT_TARGET <= 1070 && MAC_OS_X_VERSION_MIN_REQUIRED <= 1070) +#if (defined(MACOSX_DEPLOYMENT_TARGET) && MACOSX_DEPLOYMENT_TARGET <= 1070 && MAC_OS_X_VERSION_MIN_REQUIRED <= 1070) vvfabf(tmp, dst, &count); #else vvfabsf(tmp, dst, &count); diff --git a/src/system/VectorOpsComplex.cpp b/src/system/VectorOpsComplex.cpp index 809668b..2fdb0f9 100644 --- a/src/system/VectorOpsComplex.cpp +++ b/src/system/VectorOpsComplex.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -28,7 +28,7 @@ #include #if defined USE_POMMIER_MATHFUN -#if defined __ARMEL__ +#if defined __ARMEL__ || defined __aarch64__ #include "pommier/neon_mathfun.h" #else #include "pommier/sse_mathfun.h" @@ -71,7 +71,7 @@ float approximate_atan2f(float real, float imag) #if defined USE_POMMIER_MATHFUN -#ifdef __ARMEL__ +#if defined __ARMEL__ || defined __aarch64__ typedef union { float f[4]; int i[4]; diff --git a/src/system/VectorOpsComplex.h b/src/system/VectorOpsComplex.h index 519cadf..e1e53bb 100644 --- a/src/system/VectorOpsComplex.h +++ b/src/system/VectorOpsComplex.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/src/system/sysutils.cpp b/src/system/sysutils.cpp index be12074..9119175 100644 --- a/src/system/sysutils.cpp +++ b/src/system/sysutils.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -52,7 +52,7 @@ #endif #ifdef HAVE_VDSP -#include +#include #include #endif diff --git a/src/system/sysutils.h b/src/system/sysutils.h index f9895a2..b7d4b22 100644 --- a/src/system/sysutils.h +++ b/src/system/sysutils.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as @@ -29,9 +29,13 @@ #define R__ __restrict #endif +#ifdef __clang__ +#define R__ __restrict__ +#else #ifdef __GNUC__ #define R__ __restrict__ #endif +#endif #ifndef R__ #define R__ @@ -58,6 +62,7 @@ #define uint32_t unsigned __int32 #elif defined(__MSVC__) #define ssize_t long +#include #else #include #endif diff --git a/vamp/RubberBandVampPlugin.cpp b/vamp/RubberBandVampPlugin.cpp index f8e38dc..d7e9439 100644 --- a/vamp/RubberBandVampPlugin.cpp +++ b/vamp/RubberBandVampPlugin.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/vamp/RubberBandVampPlugin.h b/vamp/RubberBandVampPlugin.h index 4f350af..dd62841 100644 --- a/vamp/RubberBandVampPlugin.h +++ b/vamp/RubberBandVampPlugin.h @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as diff --git a/vamp/libmain.cpp b/vamp/libmain.cpp index 0702c1b..f5ef4cc 100644 --- a/vamp/libmain.cpp +++ b/vamp/libmain.cpp @@ -3,7 +3,7 @@ /* Rubber Band Library An audio time-stretching and pitch-shifting library. - Copyright 2007-2012 Particular Programs Ltd. + Copyright 2007-2015 Particular Programs Ltd. This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as