Skip to content

Commit 501f837

Browse files
authored
Remove resampling message (#476)
1 parent ddd5ff8 commit 501f837

File tree

3 files changed

+2
-73
lines changed

3 files changed

+2
-73
lines changed

NeuralAmpModeler/NeuralAmpModeler.cpp

Lines changed: 2 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -164,9 +164,6 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info)
164164

165165
// Misc Areas
166166
const auto helpButtonArea = mainArea.GetFromTRHC(50, 50).GetCentredInside(20, 20);
167-
// Making it centered under the big title
168-
const auto sampleRateWarningArea = titleArea.GetFromBottom(16.f).GetTranslated(117.f, 6.f).GetFromLeft(300.f);
169-
//modelArea.GetFromBottom(16.f).GetTranslated(12.f, 16.f).GetFromLeft(300.f);
170167

171168
// Model loader button
172169
auto loadModelCompletionHandler = [&](const WDL_String& fileName, const WDL_String& path) {
@@ -223,7 +220,8 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info)
223220
new NAMFileBrowserControl(irArea, kMsgTagClearIR, defaultIRString.c_str(), "wav", loadIRCompletionHandler, style,
224221
fileSVG, crossSVG, leftArrowSVG, rightArrowSVG, fileBackgroundBitmap),
225222
kCtrlTagIRFileBrowser);
226-
pGraphics->AttachControl(new NAMSwitchControl(ngToggleArea, kNoiseGateActive, "Noise Gate", style, switchHandleBitmap));
223+
pGraphics->AttachControl(
224+
new NAMSwitchControl(ngToggleArea, kNoiseGateActive, "Noise Gate", style, switchHandleBitmap));
227225
pGraphics->AttachControl(new NAMSwitchControl(eqToggleArea, kEQActive, "EQ", style, switchHandleBitmap));
228226
pGraphics->AttachControl(
229227
new NAMSwitchControl(outNormToggleArea, kOutNorm, "Normalize", style, switchHandleBitmap), kCtrlTagOutNorm);
@@ -243,9 +241,6 @@ NeuralAmpModeler::NeuralAmpModeler(const InstanceInfo& info)
243241
pGraphics->AttachControl(new NAMMeterControl(inputMeterArea, meterBackgroundBitmap, style), kCtrlTagInputMeter);
244242
pGraphics->AttachControl(new NAMMeterControl(outputMeterArea, meterBackgroundBitmap, style), kCtrlTagOutputMeter);
245243

246-
// A warning when NAM isn't being run in the right sample rate:
247-
pGraphics->AttachControl(new NAMSampleRateWarningControl(sampleRateWarningArea), kCtrlTagSampleRateWarning);
248-
249244
// Help/about box
250245
pGraphics->AttachControl(new NAMCircleButtonControl(
251246
helpButtonArea,
@@ -368,7 +363,6 @@ void NeuralAmpModeler::OnReset()
368363
SetTailSize(tailCycles * (int)(sampleRate / kDCBlockerFrequency));
369364
mInputSender.Reset(sampleRate);
370365
mOutputSender.Reset(sampleRate);
371-
mCheckSampleRateWarning = true;
372366
// If there is a model or IR loaded, they need to be checked for resampling.
373367
_ResetModelAndIR(sampleRate, GetBlockSize());
374368
mToneStack->Reset(sampleRate, maxBlockSize);
@@ -386,10 +380,6 @@ void NeuralAmpModeler::OnIdle()
386380

387381
mNewModelLoadedInDSP = false;
388382
}
389-
if (mCheckSampleRateWarning)
390-
{
391-
_CheckSampleRateWarning();
392-
}
393383
}
394384

395385
bool NeuralAmpModeler::SerializeState(IByteChunk& chunk) const
@@ -454,7 +444,6 @@ void NeuralAmpModeler::OnUIOpen()
454444

455445
if (mModel != nullptr)
456446
GetUI()->GetControlWithTag(kCtrlTagOutNorm)->SetDisabled(!mModel->HasLoudness());
457-
mCheckSampleRateWarning = true;
458447
}
459448

460449
void NeuralAmpModeler::OnParamChange(int paramIdx)
@@ -542,7 +531,6 @@ void NeuralAmpModeler::_ApplyDSPStaging()
542531
mModel = nullptr;
543532
mNAMPath.Set("");
544533
mShouldRemoveModel = false;
545-
mCheckSampleRateWarning = true;
546534
SetLatency(0);
547535
}
548536
if (mShouldRemoveIR)
@@ -558,7 +546,6 @@ void NeuralAmpModeler::_ApplyDSPStaging()
558546
mModel = std::move(mStagedModel);
559547
mStagedModel = nullptr;
560548
mNewModelLoadedInDSP = true;
561-
mCheckSampleRateWarning = true;
562549
SetLatency(mModel->GetLatency());
563550
}
564551
if (mStagedIR != nullptr)
@@ -568,24 +555,6 @@ void NeuralAmpModeler::_ApplyDSPStaging()
568555
}
569556
}
570557

571-
void NeuralAmpModeler::_CheckSampleRateWarning()
572-
{
573-
if (auto* pGraphics = GetUI())
574-
{
575-
auto* control = pGraphics->GetControlWithTag(kCtrlTagSampleRateWarning)->As<NAMSampleRateWarningControl>();
576-
bool showWarning = false;
577-
if (_HaveModel())
578-
{
579-
const auto pluginSampleRate = GetSampleRate();
580-
const auto namSampleRate = mModel->GetEncapsulatedSampleRate();
581-
control->SetSampleRate(namSampleRate);
582-
showWarning = pluginSampleRate != namSampleRate;
583-
}
584-
control->SetDisabled(!showWarning);
585-
mCheckSampleRateWarning = false;
586-
}
587-
}
588-
589558
void NeuralAmpModeler::_DeallocateIOPointers()
590559
{
591560
if (mInputPointers != nullptr)

NeuralAmpModeler/NeuralAmpModeler.h

Lines changed: 0 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ enum ECtrlTags
5454
kCtrlTagOutputMeter,
5555
kCtrlTagAboutBox,
5656
kCtrlTagOutNorm,
57-
kCtrlTagSampleRateWarning,
5857
kNumCtrlTags
5958
};
6059

@@ -232,9 +231,6 @@ class NeuralAmpModeler final : public iplug::Plugin
232231
// partially-instantiated.
233232
void _ApplyDSPStaging();
234233
// Deallocates mInputPointers and mOutputPointers
235-
// Check whether the sample rate is correct for the NAM model.
236-
// Adjust the warning control accordingly.
237-
void _CheckSampleRateWarning();
238234
void _DeallocateIOPointers();
239235
// Fallback that just copies inputs to outputs if mDSP doesn't hold a model.
240236
void _FallbackDSP(iplug::sample** inputs, iplug::sample** outputs, const size_t numChannels, const size_t numFrames);
@@ -300,8 +296,6 @@ class NeuralAmpModeler final : public iplug::Plugin
300296
std::atomic<bool> mShouldRemoveIR = false;
301297

302298
std::atomic<bool> mNewModelLoadedInDSP = false;
303-
// Flag to check whether the playback sample rate is correct for the model being used.
304-
std::atomic<bool> mCheckSampleRateWarning = true;
305299

306300
// Tone stack modules
307301
std::unique_ptr<dsp::tone_stack::AbstractToneStack> mToneStack;

NeuralAmpModeler/NeuralAmpModelerControls.h

Lines changed: 0 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -435,40 +435,6 @@ class NAMMeterControl : public IVPeakAvgMeterControl<>, public IBitmapBase
435435
}
436436
};
437437

438-
const IText _WARNING_TEXT(DEFAULT_TEXT_SIZE + 3.f, PluginColors::NAM_THEMECOLOR, "Roboto-Regular", EAlign::Near);
439-
440-
class NAMSampleRateWarningControl : public ITextControl
441-
{
442-
public:
443-
NAMSampleRateWarningControl(const IRECT& bounds)
444-
: ITextControl(bounds, "", _WARNING_TEXT)
445-
{
446-
// Default to disabled so that we don't get a flash every time we open the UI.
447-
SetDisabled(true);
448-
SetSampleRate(48000.0);
449-
}
450-
void SetDisabled(bool disable) override
451-
{
452-
{
453-
mBlend.mWeight = (disable ? mDisabledBlend : mEnabledBlend);
454-
mDisabled = disable;
455-
SetDirty(false);
456-
}
457-
}
458-
// Adjust what's displayed according to the provided smalpe rate.
459-
// Assumes that the given value is valid.
460-
void SetSampleRate(const double sampleRate)
461-
{
462-
std::stringstream ss;
463-
ss << "[INFO] Resampling to " << static_cast<long>(std::round(sampleRate)) << " Hz";
464-
SetStr(ss.str().c_str());
465-
}
466-
467-
protected:
468-
float mDisabledBlend = 0.0f; // when this is disabled, it's completely gone.
469-
float mEnabledBlend = 1.0f; // Like normal
470-
};
471-
472438
class NAMAboutBoxControl : public IContainerBase
473439
{
474440
public:

0 commit comments

Comments
 (0)