04bad1d3b88e — Chris Cannam tip 18 days ago
Update to current Rubber Band version
6 files changed, 54 insertions(+), 36 deletions(-)

M .hgignore
M README.md
M example.pro
M repoint-lock.json
M src/Processor.cpp
M src/Processor.h
M .hgignore +3 -0
@@ 5,5 5,8 @@ moc_*
 *~
 .qmake.stash
 Example
+Example.app
 Makefile
 ext
+.DS_Store
+example_plugin_import.cpp

          
M README.md +5 -2
@@ 1,8 1,8 @@ 
 
 # Rubber Band Qt Example
 
-A simplistic Qt-based UI that can load an audio file and adjust its
-playback speed dynamically.
+A simplistic Qt-based UI that can load and play an audio file and
+adjust its playback speed dynamically.
 
 ![Screenshot](screenshot.png)
 

          
@@ 17,5 17,8 @@ To build:
 $ make
 ```
 
+You will usually need the PortAudio library installed -
+check and edit example.pro for details.
+
 Copyright 2020 Particular Programs Ltd. This code is provided for
 example purposes only.

          
M example.pro +9 -25
@@ 5,9 5,12 @@ QT += gui widgets
 
 CONFIG += release c++11 object_parallel_to_source
 
-TARGET = "Example"
+DEFINES += USE_BQRESAMPLER
 
-DEFINES += USE_SPEEX USE_KISSFFT
+INCLUDEPATH += ../sonic-visualiser/sv-dependency-builds/osx/include
+LIBPATH += ../sonic-visualiser/sv-dependency-builds/osx/lib-arm64
+
+TARGET = "Example"
 
 INCLUDEPATH += \
         ext/rubberband \

          
@@ 22,34 25,15 @@ INCLUDEPATH += \
         ext/bqthingfactory
         
 RB_SOURCES += \
-      	ext/rubberband/src/RubberBandStretcher.cpp \
-	ext/rubberband/src/StretcherProcess.cpp \
-	ext/rubberband/src/StretchCalculator.cpp \
-	ext/rubberband/src/base/Profiler.cpp \
-	ext/rubberband/src/dsp/AudioCurveCalculator.cpp \
-	ext/rubberband/src/audiocurves/CompoundAudioCurve.cpp \
-	ext/rubberband/src/audiocurves/SpectralDifferenceAudioCurve.cpp \
-	ext/rubberband/src/audiocurves/HighFrequencyAudioCurve.cpp \
-	ext/rubberband/src/audiocurves/SilentAudioCurve.cpp \
-	ext/rubberband/src/audiocurves/ConstantAudioCurve.cpp \
-	ext/rubberband/src/audiocurves/PercussiveAudioCurve.cpp \
-	ext/rubberband/src/dsp/Resampler.cpp \
-	ext/rubberband/src/dsp/FFT.cpp \
-	ext/rubberband/src/system/Allocators.cpp \
-	ext/rubberband/src/system/sysutils.cpp \
-	ext/rubberband/src/system/Thread.cpp \
-	ext/rubberband/src/StretcherChannelData.cpp \
-	ext/rubberband/src/StretcherImpl.cpp \
-	ext/rubberband/src/speex/resample.c \
-	ext/rubberband/src/kissfft/kiss_fft.c \
-	ext/rubberband/src/kissfft/kiss_fftr.c
+      	ext/rubberband/single/RubberBandSingle.cpp
 
 BQ_SOURCES += \
 	ext/bqvec/src/Allocators.cpp \
 	ext/bqvec/src/Barrier.cpp \
 	ext/bqvec/src/VectorOpsComplex.cpp \
 	ext/bqresample/src/Resampler.cpp \
-	ext/bqresample/speex/resample.c \
+	ext/bqresample/src/BQResampler.cpp \
+	ext/bqresample/src/common.cpp \
 	ext/bqaudioio/src/AudioFactory.cpp \
 	ext/bqaudioio/src/JACKAudioIO.cpp \
 	ext/bqaudioio/src/Log.cpp \

          
@@ 63,7 47,7 @@ BQ_SOURCES += \
         ext/bqaudiostream/src/AudioStreamExceptions.cpp
         
 win32-msvc* {
-    DEFINES += HAVE_PORAUDIO HAVE_MEDIAFOUNDATION _USE_MATH_DEFINES
+    DEFINES += HAVE_PORTAUDIO HAVE_MEDIAFOUNDATION _USE_MATH_DEFINES
     LIBS += -lportaudio -lmfplat -lmfreadwrite -lmfuuid -lpropsys -ladvapi32 -lwinmm -lws2_32
 }
 

          
M repoint-lock.json +6 -6
@@ 1,22 1,22 @@ 
 {
   "libraries": {
     "rubberband": {
-      "pin": "e553918012b8"
+      "pin": "94130a719632"
     },
     "bqvec": {
-      "pin": "cd235ecbeb31"
+      "pin": "291cde50db9d"
     },
     "bqresample": {
-      "pin": "c2fb51b31fe4"
+      "pin": "38c3e524416a"
     },
     "bqaudioio": {
-      "pin": "0d9d36e5d063"
+      "pin": "88520ab5b8e5"
     },
     "bqaudiostream": {
-      "pin": "a0926b93e771"
+      "pin": "73fd7555ad14"
     },
     "bqthingfactory": {
-      "pin": "7686116dcdd5"
+      "pin": "2e4bd170f57f"
     }
   }
 }

          
M src/Processor.cpp +27 -3
@@ 34,9 34,10 @@ Processor::Processor() :
     m_timeRatio(1.0),
     m_pitchScale(1.0),
     m_formantPreserving(false),
-    m_centreFocus(false),
+    m_centreFocus(true),
     m_lastCentreFocus(false),
     m_crispness(5),
+    m_finerEngine(true),
     m_hqshift(false),
     m_windowSort(1),
     m_fileReadThread(0),

          
@@ 211,6 212,20 @@ Processor::setCrispness(int c)
     m_crispness = c;
 }
 
+bool
+Processor::getUseFinerEngine() const
+{
+    QMutexLocker locker(&m_mutex);
+    return m_finerEngine;
+}
+
+void
+Processor::setUseFinerEngine(bool finer)
+{
+    QMutexLocker locker(&m_mutex);
+    m_finerEngine = finer;
+}
+
 bool 
 Processor::getHighQualityShiftMode() const
 {

          
@@ 452,11 467,20 @@ Processor::open(QString filename)
         m_stretcher = 0;
     }
 
+    int defaultOptions = 0;
+    if (m_finerEngine) {
+        defaultOptions =
+            RubberBandStretcher::OptionProcessRealTime |
+            RubberBandStretcher::OptionEngineFiner;
+    } else {
+        defaultOptions =
+            RubberBandStretcher::OptionProcessRealTime;
+    }
+    
     m_stretcher = new RubberBandStretcher
         (m_blocks.sampleRate,
          m_blocks.channels,
-         RubberBandStretcher::OptionProcessRealTime |
-         RubberBandStretcher::OptionDetectorCompound,
+         defaultOptions,
          m_timeRatio,
          m_pitchScale);
 

          
M src/Processor.h +4 -0
@@ 66,6 66,9 @@ public:
     int getCrispness() const;
     void setCrispness(int c);
 
+    bool getUseFinerEngine() const;
+    void setUseFinerEngine(bool finer);
+    
     bool getHighQualityShiftMode() const;
     void setHighQualityShiftMode(bool);
 

          
@@ 154,6 157,7 @@ protected:
     bool m_centreFocus;
     bool m_lastCentreFocus;
     int m_crispness;
+    bool m_finerEngine;
     bool m_hqshift;
     int m_windowSort;