From 638f39e1a88908135bac6095f76b6587d762aa92 Mon Sep 17 00:00:00 2001 From: Oli Larkin Date: Sun, 15 Oct 2023 23:45:51 +0200 Subject: [PATCH] Implement resampling --- NeuralAmpModeler/NeuralAmpModeler.cpp | 1 + NeuralAmpModeler/NeuralAmpModeler.h | 2 ++ NeuralAmpModeler/NeuralAmpModelerControls.h | 4 ++-- NeuralAmpModeler/config/NeuralAmpModeler-mac.xcconfig | 2 +- iPlug2 | 2 +- 5 files changed, 7 insertions(+), 4 deletions(-) diff --git a/NeuralAmpModeler/NeuralAmpModeler.cpp b/NeuralAmpModeler/NeuralAmpModeler.cpp index c0d5451d..0642bc8d 100644 --- a/NeuralAmpModeler/NeuralAmpModeler.cpp +++ b/NeuralAmpModeler/NeuralAmpModeler.cpp @@ -355,6 +355,7 @@ void NeuralAmpModeler::OnReset() mInputSender.Reset(sampleRate); mOutputSender.Reset(sampleRate); mCheckSampleRateWarning = true; + mNonIntegerSRC.Reset(sampleRate); // Setup noise gate const auto time = 0.01; diff --git a/NeuralAmpModeler/NeuralAmpModeler.h b/NeuralAmpModeler/NeuralAmpModeler.h index a7e1f9f4..23eb37bc 100644 --- a/NeuralAmpModeler/NeuralAmpModeler.h +++ b/NeuralAmpModeler/NeuralAmpModeler.h @@ -11,6 +11,7 @@ #include "ISender.h" #include "NeuralAmpModelerFileManager.h" +#include "NonIntegerResampler.h" const int kNumPresets = 1; @@ -148,4 +149,5 @@ class NeuralAmpModeler final : public iplug::Plugin NAMSender mInputSender, mOutputSender; FileManager mModelFileManager {"nam"}, mIRFileManager {"wav"}; + iplug::NonIntegerResampler mNonIntegerSRC {48000.0f, iplug::ESRCMode::kLancsoz}; }; diff --git a/NeuralAmpModeler/NeuralAmpModelerControls.h b/NeuralAmpModeler/NeuralAmpModelerControls.h index cc6ac65c..840a0e07 100644 --- a/NeuralAmpModeler/NeuralAmpModelerControls.h +++ b/NeuralAmpModeler/NeuralAmpModelerControls.h @@ -414,7 +414,7 @@ class NAMMeterControl : public IVPeakAvgMeterControl<>, public IBitmapBase } }; -const IText _WARNING_TEXT(DEFAULT_TEXT_SIZE + 3.f, COLOR_RED, "Roboto-Regular", EAlign::Near); +const IText _WARNING_TEXT(DEFAULT_TEXT_SIZE, COLOR_RED, "Roboto-Regular", EAlign::Near); class NAMSampleRateWarningControl : public ITextControl { @@ -439,7 +439,7 @@ class NAMSampleRateWarningControl : public ITextControl void SetSampleRate(const double sampleRate) { std::stringstream ss; - ss << "WARNING: NAM model expects sample rate " << static_cast(std::round(sampleRate)); + ss << "!Resampling to: " << static_cast(std::round(sampleRate)); SetStr(ss.str().c_str()); } diff --git a/NeuralAmpModeler/config/NeuralAmpModeler-mac.xcconfig b/NeuralAmpModeler/config/NeuralAmpModeler-mac.xcconfig index f50e3baa..8fa2ed2a 100644 --- a/NeuralAmpModeler/config/NeuralAmpModeler-mac.xcconfig +++ b/NeuralAmpModeler/config/NeuralAmpModeler-mac.xcconfig @@ -24,7 +24,7 @@ EXTRA_LNK_FLAGS = -framework Accelerate -framework Metal -framework MetalKit // //------------------------------ // PREPROCESSOR MACROS -EXTRA_ALL_DEFS = OBJC_PREFIX=vNeuralAmpModeler SWELL_APP_PREFIX=Swell_vNeuralAmpModeler IGRAPHICS_NANOVG IGRAPHICS_METAL GRAYED_ALPHA=0.5f NAM_SAMPLE_FLOAT SAMPLE_TYPE_FLOAT +EXTRA_ALL_DEFS = OBJC_PREFIX=vNeuralAmpModeler SWELL_APP_PREFIX=Swell_vNeuralAmpModeler IGRAPHICS_NANOVG IGRAPHICS_METAL GRAYED_ALPHA=0.5f NAM_SAMPLE_FLOAT SAMPLE_TYPE_FLOAT IPLUG_SIMDE //EXTRA_DEBUG_DEFS = //EXTRA_RELEASE_DEFS = //EXTRA_TRACER_DEFS = diff --git a/iPlug2 b/iPlug2 index ec67edab..88a1d346 160000 --- a/iPlug2 +++ b/iPlug2 @@ -1 +1 @@ -Subproject commit ec67edab3897aeb3c495795d8eb58d4f26a3fd19 +Subproject commit 88a1d346d52f0c61b969cd85d366d25ea71982dc