This commit is contained in:
Chris Cannam
2017-02-13 14:10:31 +00:00
63 changed files with 442 additions and 128 deletions

View File

@@ -12,4 +12,5 @@ lib/*
config.status config.status
doc/html doc/html
*.rej *.rej
cov-int
*~

View File

@@ -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 Changes in Rubber Band v1.8.1
* Fix a crash in formant-preserving pitch shift for some build targets * Fix a crash in formant-preserving pitch shift for some build targets

View File

@@ -6,7 +6,7 @@ CXXFLAGS := -DHAVE_LIBSAMPLERATE -DHAVE_FFTW3 -DFFTW_DOUBLE_ONLY -DNO_THREAD_CHE
CFLAGS := @CFLAGS@ $(OPTFLAGS) CFLAGS := @CFLAGS@ $(OPTFLAGS)
LDFLAGS := @LDFLAGS@ -lpthread $(LDFLAGS) 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 JAVAC := $(JAVA_HOME)/bin/javac
JAR := $(JAVA_HOME)/bin/jar JAR := $(JAVA_HOME)/bin/jar
@@ -31,7 +31,7 @@ JNINAME := librubberband-jni
JARNAME := rubberband.jar JARNAME := rubberband.jar
DYNAMIC_EXTENSION := .so DYNAMIC_EXTENSION := .so
DYNAMIC_FULL_VERSION := 2.1.0 DYNAMIC_FULL_VERSION := 2.1.1
DYNAMIC_ABI_VERSION := 2 DYNAMIC_ABI_VERSION := 2
DYNAMIC_LDFLAGS := -shared -Wl,-Bsymbolic -Wl,-soname=$(LIBNAME)$(DYNAMIC_EXTENSION).$(DYNAMIC_ABI_VERSION) 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 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) 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).$(DYNAMIC_ABI_VERSION)
ln -s $(LIBNAME)$(DYNAMIC_EXTENSION).$(DYNAMIC_FULL_VERSION) $(DESTDIR)$(INSTALL_LIBDIR)/$(LIBNAME)$(DYNAMIC_EXTENSION) 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_TARGET) $(DESTDIR)$(INSTALL_VAMPDIR)
cp vamp/vamp-rubberband.cat $(DESTDIR)$(INSTALL_VAMPDIR) cp vamp/vamp-rubberband.cat $(DESTDIR)$(INSTALL_VAMPDIR)
cp $(LADSPA_TARGET) $(DESTDIR)$(INSTALL_LADSPADIR) cp $(LADSPA_TARGET) $(DESTDIR)$(INSTALL_LADSPADIR)

145
Makefile.ios Normal file
View File

@@ -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

View File

@@ -1,8 +1,8 @@
PREFIX := /usr/local PREFIX := /usr/local
CXX := g++ CXX := clang++ -stdlib=libc++
CC := gcc CC := clang
ARCHFLAGS := ARCHFLAGS := -arch i386 -arch x86_64 -mmacosx-version-min=10.7
OPTFLAGS := -DNDEBUG -ffast-math -mfpmath=sse -msse -msse2 -O3 -ftree-vectorize 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 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 LIBNAME := librubberband
DYNAMIC_EXTENSION := .dylib DYNAMIC_EXTENSION := .dylib
DYNAMIC_FULL_VERSION := 2.1.0 DYNAMIC_FULL_VERSION := 2.1.1
DYNAMIC_ABI_VERSION := 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) 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) rm -f $(PROGRAM_TARGET) $(STATIC_TARGET) $(DYNAMIC_TARGET) $(VAMP_TARGET) $(LADSPA_TARGET)
depend: depend:
makedepend -Y $(LIBRARY_SOURCES) $(PROGRAM_SOURCES) makedepend -f Makefile.osx -Y $(LIBRARY_SOURCES) $(PROGRAM_SOURCES)
# DO NOT DELETE # DO NOT DELETE

View File

@@ -5,7 +5,7 @@ Rubber Band
An audio time-stretching and pitch-shifting library and utility program. An audio time-stretching and pitch-shifting library and utility program.
Written by Chris Cannam, chris.cannam@breakfastquay.com. 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 Rubber Band is a library and utility program that permits changing the
tempo and pitch of an audio recording independently of one another. tempo and pitch of an audio recording independently of one another.
@@ -176,7 +176,7 @@ Resampler libraries supported
Name Flags required Notes 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. libresample -DHAVE_LIBRESAMPLE LGPL.
@@ -246,14 +246,16 @@ The following Makefile targets are available:
The default target is "all". The default target is "all".
4d. OS/X and iOS 4d. OS/X
---------------- --------
A Makefile for OS/X is provided as Makefile.osx. A Makefile for OS/X is provided as Makefile.osx.
Adjust the Makefile according to your preference for compiler and Adjust the Makefile according to your preference for compiler and
platform SDK, FFT and resampler implementations. The default is to 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: The following Makefile targets are available:
@@ -275,8 +277,32 @@ for RubberBandStretcherJNI.cpp) and the API headers in rubberband/
should be all you need. should be all you need.
Note that you cannot legally distribute applications using Rubber Band 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 in the Mac App Store, unless you have first obtained a commercial
valid commercial licence. GPL code is not permitted in these stores. 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 4e. Win32 and Visual Studio

View File

@@ -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; package com.breakfastquay.rubberband;

View File

@@ -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_CONFIG_SRCDIR(src/StretcherImpl.h)
AC_PROG_CXX AC_PROG_CXX

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as 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_sampleRate(sampleRate),
m_channels(channels) m_channels(channels)
{ {
m_input = new float *[m_channels];
m_output = new float *[m_channels];
m_outputBuffer = new RingBuffer<float> *[m_channels];
m_scratch = new float *[m_channels];
for (size_t c = 0; c < m_channels; ++c) { for (size_t c = 0; c < m_channels; ++c) {
m_input[c] = 0; m_input[c] = 0;
@@ -276,6 +282,10 @@ RubberBandPitchShifter::~RubberBandPitchShifter()
delete m_outputBuffer[c]; delete m_outputBuffer[c];
delete[] m_scratch[c]; delete[] m_scratch[c];
} }
delete[] m_outputBuffer;
delete[] m_scratch;
delete[] m_output;
delete[] m_input;
} }
LADSPA_Handle LADSPA_Handle

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -85,8 +85,8 @@ protected:
void updateFormant(); void updateFormant();
void updateFast(); void updateFast();
float *m_input[2]; float **m_input;
float *m_output[2]; float **m_output;
float *m_latency; float *m_latency;
float *m_cents; float *m_cents;
float *m_semitones; float *m_semitones;
@@ -105,8 +105,8 @@ protected:
size_t m_minfill; size_t m_minfill;
RubberBand::RubberBandStretcher *m_stretcher; RubberBand::RubberBandStretcher *m_stretcher;
RubberBand::RingBuffer<float> *m_outputBuffer[2]; RubberBand::RingBuffer<float> **m_outputBuffer;
float *m_scratch[2]; float **m_scratch;
int m_sampleRate; int m_sampleRate;
size_t m_channels; size_t m_channels;

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as 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 << endl;
cerr << "Rubber Band" << endl; cerr << "Rubber Band" << endl;
cerr << "An audio time-stretching and pitch-shifting library and utility program." << 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 << endl;
cerr << " Usage: " << argv[0] << " [options] <infile.wav> <outfile.wav>" << endl; cerr << " Usage: " << argv[0] << " [options] <infile.wav> <outfile.wav>" << endl;
cerr << endl; cerr << endl;

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -24,7 +24,7 @@
#ifndef _RUBBERBANDSTRETCHER_H_ #ifndef _RUBBERBANDSTRETCHER_H_
#define _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_MAJOR_VERSION 2
#define RUBBERBAND_API_MINOR_VERSION 5 #define RUBBERBAND_API_MINOR_VERSION 5
@@ -462,11 +462,17 @@ public:
void setPitchOption(Options options); 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 * receive. This is only useful in Offline mode, when it allows
* the stretcher to ensure that the number of output samples is * the stretcher to ensure that the number of output samples is
* exactly correct. In RealTime mode no such guarantee is * exactly correct. In RealTime mode no such guarantee is
* possible and this value is ignored. * 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); void setExpectedInputDuration(size_t samples);
@@ -492,6 +498,12 @@ public:
* Note that this value is only relevant to process(), not to * Note that this value is only relevant to process(), not to
* study() (to which you may pass any number of samples at a time, * study() (to which you may pass any number of samples at a time,
* and from which there is no output). * 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); void setMaxProcessSize(size_t samples);
@@ -512,6 +524,12 @@ public:
* Note that this value is only relevant to process(), not to * Note that this value is only relevant to process(), not to
* study() (to which you may pass any number of samples at a time, * study() (to which you may pass any number of samples at a time,
* and from which there is no output). * 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; size_t getSamplesRequired() const;
@@ -551,9 +569,16 @@ public:
* blocks in individual study() calls, or as a single large block. * blocks in individual study() calls, or as a single large block.
* *
* "input" should point to de-interleaved audio data with one * "input" should point to de-interleaved audio data with one
* float array per channel. "samples" supplies the number of * float array per channel. Sample values are conventionally
* audio sample frames available in "input". If "samples" is * expected to be in the range -1.0f to +1.0f. "samples" supplies
* zero, "input" may be NULL. * 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 * Set "final" to true if this is the last block of data that will
* be provided to study() before the first process() call. * be provided to study() before the first process() call.
@@ -564,6 +589,17 @@ public:
* Provide a block of "samples" sample frames for processing. * Provide a block of "samples" sample frames for processing.
* See also getSamplesRequired() and setMaxProcessSize(). * 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. * Set "final" to true if this is the last block of input data.
*/ */
void process(const float *const *input, size_t samples, bool final); void process(const float *const *input, size_t samples, bool final);
@@ -578,6 +614,12 @@ public:
* enough data has yet been processed. Call getSamplesRequired() * enough data has yet been processed. Call getSamplesRequired()
* to discover whether more input is needed. * 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 * This function returns -1 if all data has been fully processed
* and all output read, and the stretch process is now finished. * 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". * channel for de-interleaved audio data) pointed to by "output".
* The return value is the actual number of sample frames * The return value is the actual number of sample frames
* retrieved. * 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; size_t retrieve(float *const *output, size_t samples) const;

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -28,7 +28,7 @@
extern "C" { extern "C" {
#endif #endif
#define RUBBERBAND_VERSION "1.8.1" #define RUBBERBAND_VERSION "1.8.2"
#define RUBBERBAND_API_MAJOR_VERSION 2 #define RUBBERBAND_API_MAJOR_VERSION 2
#define RUBBERBAND_API_MINOR_VERSION 5 #define RUBBERBAND_API_MINOR_VERSION 5

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as 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_recovery(0),
m_prevRatio(1.0), m_prevRatio(1.0),
m_transientAmnesty(0), m_transientAmnesty(0),
m_debugLevel(0),
m_useHardPeaks(useHardPeaks) m_useHardPeaks(useHardPeaks)
{ {
// std::cerr << "StretchCalculator::StretchCalculator: useHardPeaks = " << useHardPeaks << std::endl; // std::cerr << "StretchCalculator::StretchCalculator: useHardPeaks = " << useHardPeaks << std::endl;
@@ -221,7 +222,7 @@ StretchCalculator::mapPeaks(std::vector<Peak> &peaks,
// NB we know for certain we have a mapping from 0 -> 0 (or at // NB we know for certain we have a mapping from 0 -> 0 (or at
// least, some mapping for source sample 0) because that is // 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 // to have a mapping for the total duration -- we will usually
// need to assume it maps to the normal duration * ratio sample // need to assume it maps to the normal duration * ratio sample

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -102,7 +102,6 @@ protected:
float adj) const; float adj) const;
size_t m_sampleRate; size_t m_sampleRate;
size_t m_blockSize;
size_t m_increment; size_t m_increment;
float m_prevDf; float m_prevDf;
double m_divergence; double m_divergence;

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -27,6 +27,8 @@
#include "system/Allocators.h" #include "system/Allocators.h"
#include <algorithm>
namespace RubberBand namespace RubberBand
{ {
@@ -249,6 +251,7 @@ RubberBandStretcher::Impl::ChannelData::~ChannelData()
deallocate(accumulator); deallocate(accumulator);
deallocate(windowAccumulator); deallocate(windowAccumulator);
deallocate(fltbuf); deallocate(fltbuf);
deallocate(dblbuf);
for (std::map<size_t, FFT *>::iterator i = ffts.begin(); for (std::map<size_t, FFT *>::iterator i = ffts.begin();
i != ffts.end(); ++i) { i != ffts.end(); ++i) {

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -45,6 +45,7 @@
#include <cmath> #include <cmath>
#include <set> #include <set>
#include <map> #include <map>
#include <algorithm>
using namespace RubberBand; 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<int> vector<int>
@@ -1118,11 +1119,15 @@ RubberBandStretcher::Impl::calculateStretch()
double prdm = 0, sdm = 0; double prdm = 0, sdm = 0;
if (!m_phaseResetDf.empty()) { 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(); prdm /= m_phaseResetDf.size();
} }
if (!m_stretchDf.empty()) { 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(); sdm /= m_stretchDf.size();
} }
// std::cerr << "phase reset df mean = " << prdm << ", stretch df mean = " << sdm << std::endl; // std::cerr << "phase reset df mean = " << prdm << ", stretch df mean = " << sdm << std::endl;

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -43,6 +43,7 @@
#include <set> #include <set>
#include <map> #include <map>
#include <deque> #include <deque>
#include <algorithm>
using namespace RubberBand; using namespace RubberBand;

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -67,7 +67,7 @@ public:
int getSize() const; 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 * delete when no longer needed) of the given size, containing the
* same data as this one. If another thread reads from or writes * same data as this one. If another thread reads from or writes
* to this buffer during the call, the results may be incomplete * to this buffer during the call, the results may be incomplete
@@ -89,8 +89,7 @@ public:
void reset(); void reset();
/** /**
* Return the amount of data available for reading by reader R, in * Return the amount of data available for reading, in samples.
* samples.
*/ */
int getReadSpace() const; int getReadSpace() const;
@@ -100,9 +99,9 @@ public:
int getWriteSpace() const; int getWriteSpace() const;
/** /**
* Read n samples from the buffer, for reader R. If fewer than n * Read n samples from the buffer. If fewer than n are available,
* are available, the remainder will be zeroed out. Returns the * the remainder will be zeroed out. Returns the number of
* number of samples actually read. * samples actually read.
* *
* This is a template function, taking an argument S for the target * This is a template function, taking an argument S for the target
* sample type, which is permitted to differ from T if the two * 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); int read(S *const R__ destination, int n);
/** /**
* Read n samples from the buffer, for reader R, adding them to * Read n samples from the buffer, adding them to the destination.
* the destination. If fewer than n are available, the remainder * If fewer than n are available, the remainder will be left
* will be left alone. Returns the number of samples actually * alone. Returns the number of samples actually read.
* read.
* *
* This is a template function, taking an argument S for the target * This is a template function, taking an argument S for the target
* sample type, which is permitted to differ from T if the two * 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); int readAdding(S *const R__ destination, int n);
/** /**
* Read one sample from the buffer, for reader R. If no sample is * Read one sample from the buffer. If no sample is available,
* available, this will silently return zero. Calling this * this will silently return zero. Calling this repeatedly is
* repeatedly is obviously slower than calling read once, but it * obviously slower than calling read once, but it may be good
* may be good enough if you don't want to allocate a buffer to * enough if you don't want to allocate a buffer to read into.
* read into.
*/ */
T readOne(); T readOne();
/** /**
* Read n samples from the buffer, if available, for reader R, * Read n samples from the buffer, if available, without advancing
* without advancing the read pointer -- i.e. a subsequent read() * the read pointer -- i.e. a subsequent read() or skip() will be
* or skip() will be necessary to empty the buffer. If fewer than * necessary to empty the buffer. If fewer than n are available,
* n are available, the remainder will be zeroed out. Returns the * the remainder will be zeroed out. Returns the number of
* number of samples actually read. * samples actually read.
*/ */
int peek(T *const R__ destination, int n) const; int peek(T *const R__ destination, int n) const;
@@ -151,10 +148,9 @@ public:
T peekOne() const; T peekOne() const;
/** /**
* Pretend to read n samples from the buffer, for reader R, * Pretend to read n samples from the buffer, without actually
* without actually returning them (i.e. discard the next n * returning them (i.e. discard the next n samples). Returns the
* samples). Returns the number of samples actually available for * number of samples actually available for discarding.
* discarding.
*/ */
int skip(int n); int skip(int n);

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -130,6 +130,7 @@ template <typename T>
Scavenger<T>::Scavenger(int sec, int defaultObjectListSize) : Scavenger<T>::Scavenger(int sec, int defaultObjectListSize) :
m_objects(ObjectTimeList(defaultObjectListSize)), m_objects(ObjectTimeList(defaultObjectListSize)),
m_sec(sec), m_sec(sec),
m_lastExcess(0),
m_claimed(0), m_claimed(0),
m_scavenged(0), m_scavenged(0),
m_asExcess(0) m_asExcess(0)

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -43,8 +43,7 @@
#endif #endif
#ifdef HAVE_VDSP #ifdef HAVE_VDSP
#include <vecLib/vDSP.h> #include <Accelerate/Accelerate.h>
#include <vecLib/vForce.h>
#endif #endif
#ifdef HAVE_MEDIALIB #ifdef HAVE_MEDIALIB
@@ -1598,6 +1597,15 @@ public:
m_commonMutex.unlock(); m_commonMutex.unlock();
#endif #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 FFT::Precisions

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -30,6 +30,8 @@
#include <algorithm> #include <algorithm>
#include <iostream>
namespace RubberBand namespace RubberBand
{ {
@@ -59,6 +61,10 @@ public:
} }
void push(T value) { void push(T value) {
if (value != value) {
std::cerr << "WARNING: MovingMedian: NaN encountered" << std::endl;
value = T();
}
drop(m_frame[0]); drop(m_frame[0]);
v_move(m_frame, m_frame+1, P::m_size-1); v_move(m_frame, m_frame+1, P::m_size-1);
m_frame[P::m_size-1] = value; m_frame[P::m_size-1] = value;

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -28,6 +28,7 @@
#include <cmath> #include <cmath>
#include <iostream> #include <iostream>
#include <algorithm>
#include "system/Allocators.h" #include "system/Allocators.h"

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as 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 { 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; } inline T getArea() const { return m_area; }

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as 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 { 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 { inline T getRMS() const {

View File

@@ -38,7 +38,13 @@
** long int lrint (double x) ; ** long int lrint (double x) ;
*/ */
#if (defined (WIN32) || defined (_WIN32)) #if (defined (_WIN64))
#include <math.h>
__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 <math.h> #include <math.h>

View File

@@ -1,5 +1,25 @@
/* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ /* -*- 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" #include "rubberband/RubberBandStretcher.h"

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -33,8 +33,7 @@
#endif #endif
#ifdef HAVE_VDSP #ifdef HAVE_VDSP
#include <vecLib/vDSP.h> #include <Accelerate/Accelerate.h>
#include <vecLib/vForce.h>
#endif #endif
#include <cstring> #include <cstring>
@@ -289,8 +288,8 @@ inline void v_add_channels(T *const R__ *const R__ dst,
template<typename T, typename G> template<typename T, typename G>
inline void v_add_with_gain(T *const R__ dst, inline void v_add_with_gain(T *const R__ dst,
const T *const R__ src, const T *const R__ src,
const int count, const G gain,
const G gain) const int count)
{ {
for (int i = 0; i < count; ++i) { for (int i = 0; i < count; ++i) {
dst[i] += src[i] * gain; dst[i] += src[i] * gain;
@@ -300,12 +299,12 @@ inline void v_add_with_gain(T *const R__ dst,
template<typename T, typename G> template<typename T, typename G>
inline void v_add_channels_with_gain(T *const R__ *const R__ dst, inline void v_add_channels_with_gain(T *const R__ *const R__ dst,
const T *const R__ *const R__ src, const T *const R__ *const R__ src,
const G gain,
const int channels, const int channels,
const int count, const int count)
const G gain)
{ {
for (int c = 0; c < channels; ++c) { 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) const int count)
{ {
float tmp[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); vvfabf(tmp, dst, &count);
#else #else
vvfabsf(tmp, dst, &count); vvfabsf(tmp, dst, &count);

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -28,7 +28,7 @@
#include <cassert> #include <cassert>
#if defined USE_POMMIER_MATHFUN #if defined USE_POMMIER_MATHFUN
#if defined __ARMEL__ #if defined __ARMEL__ || defined __aarch64__
#include "pommier/neon_mathfun.h" #include "pommier/neon_mathfun.h"
#else #else
#include "pommier/sse_mathfun.h" #include "pommier/sse_mathfun.h"
@@ -71,7 +71,7 @@ float approximate_atan2f(float real, float imag)
#if defined USE_POMMIER_MATHFUN #if defined USE_POMMIER_MATHFUN
#ifdef __ARMEL__ #if defined __ARMEL__ || defined __aarch64__
typedef union { typedef union {
float f[4]; float f[4];
int i[4]; int i[4];

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -52,7 +52,7 @@
#endif #endif
#ifdef HAVE_VDSP #ifdef HAVE_VDSP
#include <vecLib/vDSP.h> #include <Accelerate/Accelerate.h>
#include <fenv.h> #include <fenv.h>
#endif #endif

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as
@@ -29,9 +29,13 @@
#define R__ __restrict #define R__ __restrict
#endif #endif
#ifdef __clang__
#define R__ __restrict__
#else
#ifdef __GNUC__ #ifdef __GNUC__
#define R__ __restrict__ #define R__ __restrict__
#endif #endif
#endif
#ifndef R__ #ifndef R__
#define R__ #define R__
@@ -58,6 +62,7 @@
#define uint32_t unsigned __int32 #define uint32_t unsigned __int32
#elif defined(__MSVC__) #elif defined(__MSVC__)
#define ssize_t long #define ssize_t long
#include <stdint.h>
#else #else
#include <stdint.h> #include <stdint.h>
#endif #endif

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as

View File

@@ -3,7 +3,7 @@
/* /*
Rubber Band Library Rubber Band Library
An audio time-stretching and pitch-shifting 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 This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as modify it under the terms of the GNU General Public License as