From 4e1bb952341da08b5a793c385b0cf2f976d9ca92 Mon Sep 17 00:00:00 2001 From: David Madl Date: Sat, 7 Mar 2026 00:20:05 +0100 Subject: [PATCH] build: simple build using CMake (manually add src/ext/libsndfile) --- CMakeLists.txt | 61 +++++++++++++++++++++++++++++ main/main.cpp | 1 + src/RubberBandStretcher.cpp | 1 + src/common/BQResampler.cpp | 1 + src/common/Resampler.cpp | 1 + src/common/VectorOpsComplex.cpp | 2 +- src/common/sysutils.cpp | 1 + src/faster/R2Stretcher.cpp | 2 + src/faster/StretcherChannelData.cpp | 6 ++- src/faster/StretcherProcess.cpp | 1 + src/finer/R3LiveShifter.cpp | 1 + src/finer/R3Stretcher.cpp | 1 + 12 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 CMakeLists.txt diff --git a/CMakeLists.txt b/CMakeLists.txt new file mode 100644 index 0000000..9ce931e --- /dev/null +++ b/CMakeLists.txt @@ -0,0 +1,61 @@ +cmake_minimum_required(VERSION 4.1) +project(rubberband) + +set(CMAKE_CXX_STANDARD 20) + +set(CMAKE_CXX_FLAGS "-DUSE_BQRESAMPLER -DHAVE_KISSFFT") + +#include_directories(mpg123/lib/x86_64/include) +include_directories( +./dotnet/rubberband-dll +./ladspa-lv2 +./rubberband +./src/common +./src/ext/float_cast +./src/ext/getopt +./src/ext/kissfft +./src/ext/pommier +./src/ext/speex +./src/faster +./src/finer +./vamp +) + +add_executable(rubberband +./src/ext/getopt/getopt.c +./src/ext/getopt/getopt_long.c +./src/ext/kissfft/kiss_fft.c +./src/ext/kissfft/kiss_fftr.c +./src/ext/speex/resample.c +./main/main.cpp +./src/common/Allocators.cpp +./src/common/BQResampler.cpp +./src/common/FFT.cpp +./src/common/Log.cpp +./src/common/mathmisc.cpp +./src/common/Profiler.cpp +./src/common/Resampler.cpp +./src/common/StretchCalculator.cpp +./src/common/sysutils.cpp +./src/common/Thread.cpp +./src/common/VectorOpsComplex.cpp +./src/faster/AudioCurveCalculator.cpp +./src/faster/CompoundAudioCurve.cpp +./src/faster/HighFrequencyAudioCurve.cpp +./src/faster/PercussiveAudioCurve.cpp +./src/faster/R2Stretcher.cpp +./src/faster/SilentAudioCurve.cpp +./src/faster/StretcherChannelData.cpp +./src/faster/StretcherProcess.cpp +./src/finer/R3LiveShifter.cpp +./src/finer/R3Stretcher.cpp +./src/rubberband-c.cpp +./src/RubberBandLiveShifter.cpp +./src/RubberBandStretcher.cpp +) +#target_link_directories(rubberband PRIVATE mpg123/lib/x86_64) +#target_link_libraries(test_lockstep mpg123-0) +#target_link_libraries(rubberband ${CMAKE_SOURCE_DIR}/mpg123/lib/x86_64/libmpg123.dll.a) + +add_subdirectory(src/ext/libsndfile) +target_link_libraries(rubberband sndfile) diff --git a/main/main.cpp b/main/main.cpp index b566cb9..7dd3549 100644 --- a/main/main.cpp +++ b/main/main.cpp @@ -49,6 +49,7 @@ using RubberBand::gettimeofday; #endif #ifdef _MSC_VER +#define NOMINMAX #include static void usleep(unsigned long usec) { ::Sleep(usec == 0 ? 0 : usec < 1000 ? 1 : usec / 1000); diff --git a/src/RubberBandStretcher.cpp b/src/RubberBandStretcher.cpp index 4900541..f46cb75 100644 --- a/src/RubberBandStretcher.cpp +++ b/src/RubberBandStretcher.cpp @@ -1,4 +1,5 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +#define NOMINMAX /* Rubber Band Library diff --git a/src/common/BQResampler.cpp b/src/common/BQResampler.cpp index 153f9cc..7337d3b 100644 --- a/src/common/BQResampler.cpp +++ b/src/common/BQResampler.cpp @@ -20,6 +20,7 @@ under terms other than those of the GNU General Public License, you must obtain a valid commercial licence before doing so. */ +#define NOMINMAX #include "BQResampler.h" diff --git a/src/common/Resampler.cpp b/src/common/Resampler.cpp index 6b397f8..df8188a 100644 --- a/src/common/Resampler.cpp +++ b/src/common/Resampler.cpp @@ -1,4 +1,5 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +#define NOMINMAX /* Rubber Band Library diff --git a/src/common/VectorOpsComplex.cpp b/src/common/VectorOpsComplex.cpp index bba7cef..8df0b51 100644 --- a/src/common/VectorOpsComplex.cpp +++ b/src/common/VectorOpsComplex.cpp @@ -23,7 +23,7 @@ #include "VectorOpsComplex.h" -#include "system/sysutils.h" +//#include "system/sysutils.h" #include diff --git a/src/common/sysutils.cpp b/src/common/sysutils.cpp index dad76ba..54bd549 100644 --- a/src/common/sysutils.cpp +++ b/src/common/sysutils.cpp @@ -24,6 +24,7 @@ #include "sysutils.h" #ifdef _WIN32 +#define NOMINMAX #include #include #include diff --git a/src/faster/R2Stretcher.cpp b/src/faster/R2Stretcher.cpp index 52737a4..17199a1 100644 --- a/src/faster/R2Stretcher.cpp +++ b/src/faster/R2Stretcher.cpp @@ -1,5 +1,7 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +#define NOMINMAX + /* Rubber Band Library An audio time-stretching and pitch-shifting library. diff --git a/src/faster/StretcherChannelData.cpp b/src/faster/StretcherChannelData.cpp index 8d76f41..52a59c2 100644 --- a/src/faster/StretcherChannelData.cpp +++ b/src/faster/StretcherChannelData.cpp @@ -20,6 +20,7 @@ under terms other than those of the GNU General Public License, you must obtain a valid commercial licence before doing so. */ +#define NOMINMAX #include "StretcherChannelData.h" @@ -27,6 +28,9 @@ #include "../common/Allocators.h" #include +#include + +using std::max; namespace RubberBand { @@ -114,7 +118,7 @@ void R2Stretcher::ChannelData::setSizes(size_t windowSize, size_t fftSize) { - size_t maxSize = 2 * std::max(windowSize, fftSize); + size_t maxSize = 2*std::max(windowSize, fftSize); size_t realSize = maxSize / 2 + 1; size_t oldMax = inbuf->getSize(); size_t oldReal = oldMax / 2 + 1; diff --git a/src/faster/StretcherProcess.cpp b/src/faster/StretcherProcess.cpp index 74d09e7..7d61a3c 100644 --- a/src/faster/StretcherProcess.cpp +++ b/src/faster/StretcherProcess.cpp @@ -1,4 +1,5 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +#define NOMINMAX /* Rubber Band Library diff --git a/src/finer/R3LiveShifter.cpp b/src/finer/R3LiveShifter.cpp index 80e8bd5..e2fe1e4 100644 --- a/src/finer/R3LiveShifter.cpp +++ b/src/finer/R3LiveShifter.cpp @@ -1,4 +1,5 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +#define NOMINMAX /* Rubber Band Library diff --git a/src/finer/R3Stretcher.cpp b/src/finer/R3Stretcher.cpp index ed7d56b..7cf63be 100644 --- a/src/finer/R3Stretcher.cpp +++ b/src/finer/R3Stretcher.cpp @@ -1,4 +1,5 @@ /* -*- c-basic-offset: 4 indent-tabs-mode: nil -*- vi:set ts=8 sts=4 sw=4: */ +#define NOMINMAX /* Rubber Band Library