NeuralAmpModelerPlugin

Plugin for Neural Amp Modeler
Log | Files | Refs | Submodules | README | LICENSE

commit 501f837c894ade837e200840e26f6c84b04e15ac
parent ddd5ff85bf21c6ab939c7819bada901954c5282d
Author: Steven Atkinson <[email protected]>
Date:   Sun, 26 May 2024 17:52:15 -0700

Remove resampling message (#476)


Diffstat:
MNeuralAmpModeler/NeuralAmpModeler.cpp | 35++---------------------------------
MNeuralAmpModeler/NeuralAmpModeler.h | 6------
MNeuralAmpModeler/NeuralAmpModelerControls.h | 34----------------------------------
3 files changed, 2 insertions(+), 73 deletions(-)

diff --git a/NeuralAmpModeler/NeuralAmpModeler.cpp b/NeuralAmpModeler/NeuralAmpModeler.cpp @@ -164,9 +164,6 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info) // Misc Areas const auto helpButtonArea = mainArea.GetFromTRHC(50, 50).GetCentredInside(20, 20); - // Making it centered under the big title - const auto sampleRateWarningArea = titleArea.GetFromBottom(16.f).GetTranslated(117.f, 6.f).GetFromLeft(300.f); - //modelArea.GetFromBottom(16.f).GetTranslated(12.f, 16.f).GetFromLeft(300.f); // Model loader button auto loadModelCompletionHandler = [&](const WDL_String& fileName, const WDL_String& path) { @@ -223,7 +220,8 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info) new NAMFileBrowserControl(irArea, kMsgTagClearIR, defaultIRString.c_str(), "wav", loadIRCompletionHandler, style, fileSVG, crossSVG, leftArrowSVG, rightArrowSVG, fileBackgroundBitmap), kCtrlTagIRFileBrowser); - pGraphics->AttachControl(new NAMSwitchControl(ngToggleArea, kNoiseGateActive, "Noise Gate", style, switchHandleBitmap)); + pGraphics->AttachControl( + new NAMSwitchControl(ngToggleArea, kNoiseGateActive, "Noise Gate", style, switchHandleBitmap)); pGraphics->AttachControl(new NAMSwitchControl(eqToggleArea, kEQActive, "EQ", style, switchHandleBitmap)); pGraphics->AttachControl( new NAMSwitchControl(outNormToggleArea, kOutNorm, "Normalize", style, switchHandleBitmap), kCtrlTagOutNorm); @@ -243,9 +241,6 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info) pGraphics->AttachControl(new NAMMeterControl(inputMeterArea, meterBackgroundBitmap, style), kCtrlTagInputMeter); pGraphics->AttachControl(new NAMMeterControl(outputMeterArea, meterBackgroundBitmap, style), kCtrlTagOutputMeter); - // A warning when NAM isn't being run in the right sample rate: - pGraphics->AttachControl(new NAMSampleRateWarningControl(sampleRateWarningArea), kCtrlTagSampleRateWarning); - // Help/about box pGraphics->AttachControl(new NAMCircleButtonControl( helpButtonArea, @@ -368,7 +363,6 @@ void NeuralAmpModeler::OnReset() SetTailSize(tailCycles * (int)(sampleRate / kDCBlockerFrequency)); mInputSender.Reset(sampleRate); mOutputSender.Reset(sampleRate); - mCheckSampleRateWarning = true; // If there is a model or IR loaded, they need to be checked for resampling. _ResetModelAndIR(sampleRate, GetBlockSize()); mToneStack->Reset(sampleRate, maxBlockSize); @@ -386,10 +380,6 @@ void NeuralAmpModeler::OnIdle() mNewModelLoadedInDSP = false; } - if (mCheckSampleRateWarning) - { - _CheckSampleRateWarning(); - } } bool NeuralAmpModeler::SerializeState(IByteChunk& chunk) const @@ -454,7 +444,6 @@ void NeuralAmpModeler::OnUIOpen() if (mModel != nullptr) GetUI()->GetControlWithTag(kCtrlTagOutNorm)->SetDisabled(!mModel->HasLoudness()); - mCheckSampleRateWarning = true; } void NeuralAmpModeler::OnParamChange(int paramIdx) @@ -542,7 +531,6 @@ void NeuralAmpModeler::_ApplyDSPStaging() mModel = nullptr; mNAMPath.Set(""); mShouldRemoveModel = false; - mCheckSampleRateWarning = true; SetLatency(0); } if (mShouldRemoveIR) @@ -558,7 +546,6 @@ void NeuralAmpModeler::_ApplyDSPStaging() mModel = std::move(mStagedModel); mStagedModel = nullptr; mNewModelLoadedInDSP = true; - mCheckSampleRateWarning = true; SetLatency(mModel->GetLatency()); } if (mStagedIR != nullptr) @@ -568,24 +555,6 @@ void NeuralAmpModeler::_ApplyDSPStaging() } } -void NeuralAmpModeler::_CheckSampleRateWarning() -{ - if (auto* pGraphics = GetUI()) - { - auto* control = pGraphics->GetControlWithTag(kCtrlTagSampleRateWarning)->As<NAMSampleRateWarningControl>(); - bool showWarning = false; - if (_HaveModel()) - { - const auto pluginSampleRate = GetSampleRate(); - const auto namSampleRate = mModel->GetEncapsulatedSampleRate(); - control->SetSampleRate(namSampleRate); - showWarning = pluginSampleRate != namSampleRate; - } - control->SetDisabled(!showWarning); - mCheckSampleRateWarning = false; - } -} - void NeuralAmpModeler::_DeallocateIOPointers() { if (mInputPointers != nullptr) diff --git a/NeuralAmpModeler/NeuralAmpModeler.h b/NeuralAmpModeler/NeuralAmpModeler.h @@ -54,7 +54,6 @@ enum ECtrlTags kCtrlTagOutputMeter, kCtrlTagAboutBox, kCtrlTagOutNorm, - kCtrlTagSampleRateWarning, kNumCtrlTags }; @@ -232,9 +231,6 @@ private: // partially-instantiated. void _ApplyDSPStaging(); // Deallocates mInputPointers and mOutputPointers - // Check whether the sample rate is correct for the NAM model. - // Adjust the warning control accordingly. - void _CheckSampleRateWarning(); void _DeallocateIOPointers(); // Fallback that just copies inputs to outputs if mDSP doesn't hold a model. void _FallbackDSP(iplug::sample** inputs, iplug::sample** outputs, const size_t numChannels, const size_t numFrames); @@ -300,8 +296,6 @@ private: std::atomic<bool> mShouldRemoveIR = false; std::atomic<bool> mNewModelLoadedInDSP = false; - // Flag to check whether the playback sample rate is correct for the model being used. - std::atomic<bool> mCheckSampleRateWarning = true; // Tone stack modules std::unique_ptr<dsp::tone_stack::AbstractToneStack> mToneStack; diff --git a/NeuralAmpModeler/NeuralAmpModelerControls.h b/NeuralAmpModeler/NeuralAmpModelerControls.h @@ -435,40 +435,6 @@ public: } }; -const IText _WARNING_TEXT(DEFAULT_TEXT_SIZE + 3.f, PluginColors::NAM_THEMECOLOR, "Roboto-Regular", EAlign::Near); - -class NAMSampleRateWarningControl : public ITextControl -{ -public: - NAMSampleRateWarningControl(const IRECT& bounds) - : ITextControl(bounds, "", _WARNING_TEXT) - { - // Default to disabled so that we don't get a flash every time we open the UI. - SetDisabled(true); - SetSampleRate(48000.0); - } - void SetDisabled(bool disable) override - { - { - mBlend.mWeight = (disable ? mDisabledBlend : mEnabledBlend); - mDisabled = disable; - SetDirty(false); - } - } - // Adjust what's displayed according to the provided smalpe rate. - // Assumes that the given value is valid. - void SetSampleRate(const double sampleRate) - { - std::stringstream ss; - ss << "[INFO] Resampling to " << static_cast<long>(std::round(sampleRate)) << " Hz"; - SetStr(ss.str().c_str()); - } - -protected: - float mDisabledBlend = 0.0f; // when this is disabled, it's completely gone. - float mEnabledBlend = 1.0f; // Like normal -}; - class NAMAboutBoxControl : public IContainerBase { public: