From cfce6da60326c4d7d516deab60f3fcf1f99b63ed Mon Sep 17 00:00:00 2001 From: Paul Licameli Date: Sun, 28 Feb 2021 11:13:44 -0500 Subject: [PATCH] Resample into lib-math; Audacity doesn't use libsoxr directly --- cmake-proxies/CMakeLists.txt | 1 - libraries/lib-math/CMakeLists.txt | 5 +++++ {src => libraries/lib-math}/Resample.cpp | 0 {src => libraries/lib-math}/Resample.h | 4 +--- src/CMakeLists.txt | 3 --- src/effects/ChangeSpeed.cpp | 2 +- src/prefs/QualityPrefs.cpp | 2 +- 7 files changed, 8 insertions(+), 9 deletions(-) rename {src => libraries/lib-math}/Resample.cpp (100%) rename {src => libraries/lib-math}/Resample.h (98%) diff --git a/cmake-proxies/CMakeLists.txt b/cmake-proxies/CMakeLists.txt index 5de68d0c6..17e0c8f09 100644 --- a/cmake-proxies/CMakeLists.txt +++ b/cmake-proxies/CMakeLists.txt @@ -160,7 +160,6 @@ set_conan_vars_to_parent() # # directory option symbol req chk version addlib( libsndfile sndfile SNDFILE YES YES "sndfile >= 1.0.28" ) -addlib( libsoxr soxr SOXR YES YES "soxr >= 0.1.1" ) addlib( portaudio-v19 portaudio PORTAUDIO YES YES "" ) addlib( sqlite sqlite SQLITE YES YES "sqlite3 >= 3.32.0" ) diff --git a/libraries/lib-math/CMakeLists.txt b/libraries/lib-math/CMakeLists.txt index 2b87133ab..9a5693522 100644 --- a/libraries/lib-math/CMakeLists.txt +++ b/libraries/lib-math/CMakeLists.txt @@ -2,6 +2,8 @@ A library of mathematical utilities and manipulation of samples ]]# +addlib( libsoxr soxr SOXR YES YES "soxr >= 0.1.1" ) + set( SOURCES Dither.cpp Dither.h @@ -13,6 +15,8 @@ set( SOURCES Matrix.h RealFFTf.cpp RealFFTf.h + Resample.cpp + Resample.h SampleCount.cpp SampleCount.h SampleFormat.cpp @@ -22,6 +26,7 @@ set( SOURCES float_cast.h ) set( LIBRARIES + libsoxr lib-preferences-interface PRIVATE wxBase diff --git a/src/Resample.cpp b/libraries/lib-math/Resample.cpp similarity index 100% rename from src/Resample.cpp rename to libraries/lib-math/Resample.cpp diff --git a/src/Resample.h b/libraries/lib-math/Resample.h similarity index 98% rename from src/Resample.h rename to libraries/lib-math/Resample.h index dee207715..d15ee8fe4 100644 --- a/src/Resample.h +++ b/libraries/lib-math/Resample.h @@ -12,8 +12,6 @@ #ifndef __AUDACITY_RESAMPLE_H__ #define __AUDACITY_RESAMPLE_H__ - - #include "SampleFormat.h" template< typename Enum > class EnumSetting; @@ -25,7 +23,7 @@ struct soxr_deleter { }; using soxrHandle = std::unique_ptr; -class AUDACITY_DLL_API Resample final +class MATH_API Resample final { public: /// Resamplers may have more than one method, offering a diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 133f6b983..353d85ce9 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -228,8 +228,6 @@ list( APPEND SOURCES Registrar.h Registry.cpp Registry.h - Resample.cpp - Resample.h RingBuffer.cpp RingBuffer.h SampleBlock.cpp @@ -1074,7 +1072,6 @@ list( APPEND LIBRARIES expat::expat libmp3lame::libmp3lame libsndfile - libsoxr portaudio-v19 sqlite $<$:crashreports> diff --git a/src/effects/ChangeSpeed.cpp b/src/effects/ChangeSpeed.cpp index a13b3717d..f6049657f 100644 --- a/src/effects/ChangeSpeed.cpp +++ b/src/effects/ChangeSpeed.cpp @@ -25,7 +25,7 @@ #include "../LabelTrack.h" #include "Prefs.h" -#include "../Resample.h" +#include "Resample.h" #include "../Shuttle.h" #include "../ShuttleGui.h" #include "../widgets/NumericTextCtrl.h" diff --git a/src/prefs/QualityPrefs.cpp b/src/prefs/QualityPrefs.cpp index f16fc20cf..42f77dd6a 100644 --- a/src/prefs/QualityPrefs.cpp +++ b/src/prefs/QualityPrefs.cpp @@ -26,7 +26,7 @@ #include "../AudioIOBase.h" #include "Dither.h" #include "Prefs.h" -#include "../Resample.h" +#include "Resample.h" #include "../ShuttleGui.h" #define ID_SAMPLE_RATE_CHOICE 7001