@@ -68,6 +68,7 @@ EMsgBoxResult _ShowMessageBox(iplug::igraphics::IGraphics* pGraphics, const char
6868NeuralAmpModeler::NeuralAmpModeler (const InstanceInfo& info)
6969: Plugin(info, MakeConfig(kNumParams , kNumPresets ))
7070{
71+ _InitToneStack ();
7172 nam::activations::Activation::enable_fast_tanh ();
7273 GetParam (kInputLevel )->InitGain (" Input" , 0.0 , -20.0 , 20.0 , 0.1 );
7374 GetParam (kToneBass )->InitDouble (" Bass" , 5.0 , 0.0 , 10.0 , 0.1 );
@@ -323,14 +324,8 @@ void NeuralAmpModeler::ProcessBlock(iplug::sample** inputs, iplug::sample** outp
323324 sample** gateGainOutput =
324325 noiseGateActive ? mNoiseGateGain .Process (mOutputPointers , numChannelsInternal, numFrames) : mOutputPointers ;
325326
326- sample** toneStackOutPointers = gateGainOutput;
327- if (toneStackActive)
328- {
329- sample** bassPointers = mToneBass .Process (gateGainOutput, numChannelsInternal, numFrames);
330- sample** midPointers = mToneMid .Process (bassPointers, numChannelsInternal, numFrames);
331- sample** treblePointers = mToneTreble .Process (midPointers, numChannelsInternal, numFrames);
332- toneStackOutPointers = treblePointers;
333- }
327+ sample** toneStackOutPointers = (toneStackActive && mToneStack != nullptr ) ? mToneStack ->Process (gateGainOutput, numChannelsInternal, numFrames)
328+ : gateGainOutput;
334329
335330 sample** irPointers = toneStackOutPointers;
336331 if (mIR != nullptr && GetParam (kIRToggle )->Value ())
@@ -361,6 +356,8 @@ void NeuralAmpModeler::ProcessBlock(iplug::sample** inputs, iplug::sample** outp
361356void NeuralAmpModeler::OnReset ()
362357{
363358 const auto sampleRate = GetSampleRate ();
359+ const int maxBlockSize = GetBlockSize ();
360+
364361 // Tail is because the HPF DC blocker has a decay.
365362 // 10 cycles should be enough to pass the VST3 tests checking tail behavior.
366363 // I'm ignoring the model & IR, but it's not the end of the world.
@@ -371,6 +368,7 @@ void NeuralAmpModeler::OnReset()
371368 mCheckSampleRateWarning = true ;
372369 // If there is a model or IR loaded, they need to be checked for resampling.
373370 _ResetModelAndIR (sampleRate, GetBlockSize ());
371+ mToneStack ->Reset (sampleRate, maxBlockSize);
374372}
375373
376374void NeuralAmpModeler::OnIdle ()
@@ -443,36 +441,13 @@ void NeuralAmpModeler::OnParamChange(int paramIdx)
443441 switch (paramIdx)
444442 {
445443 case kToneBass :
446- {
447- const double sampleRate = GetSampleRate ();
448- const double bassGainDB = 4.0 * (GetParam (kToneBass )->Value () - 5.0 ); // +/- 20
449- const double bassFrequency = 150.0 ;
450- const double bassQuality = 0.707 ;
451- recursive_linear_filter::BiquadParams bassParams (sampleRate, bassFrequency, bassQuality, bassGainDB);
452- mToneBass .SetParams (bassParams);
453- }
454-
444+ mToneStack ->SetParam (" bass" , GetParam (paramIdx)->Value ());
455445 break ;
456446 case kToneMid :
457- {
458- const double sampleRate = GetSampleRate ();
459- const double midGainDB = 3.0 * (GetParam (kToneMid )->Value () - 5.0 ); // +/- 15
460- const double midFrequency = 425.0 ;
461- // Wider EQ on mid bump up to sound less honky.
462- const double midQuality = midGainDB < 0.0 ? 1.5 : 0.7 ;
463- recursive_linear_filter::BiquadParams midParams (sampleRate, midFrequency, midQuality, midGainDB);
464- mToneMid .SetParams (midParams);
465- }
447+ mToneStack ->SetParam (" middle" , GetParam (paramIdx)->Value ());
466448 break ;
467449 case kToneTreble :
468- {
469- const double sampleRate = GetSampleRate ();
470- const double trebleGainDB = 2.0 * (GetParam (kToneTreble )->Value () - 5.0 ); // +/- 10
471- const double trebleFrequency = 1800.0 ;
472- const double trebleQuality = 0.707 ;
473- recursive_linear_filter::BiquadParams trebleParams (sampleRate, trebleFrequency, trebleQuality, trebleGainDB);
474- mToneTreble .SetParams (trebleParams);
475- }
450+ mToneStack ->SetParam (" treble" , GetParam (paramIdx)->Value ());
476451 break ;
477452 default : break ;
478453 }
@@ -751,6 +726,11 @@ size_t NeuralAmpModeler::_GetBufferNumFrames() const
751726 return mInputArray [0 ].size ();
752727}
753728
729+ void NeuralAmpModeler::_InitToneStack ()
730+ {
731+ // If you want to customize the tone stack, then put it here!
732+ mToneStack = std::make_unique<dsp::tone_stack::BasicNamToneStack>();
733+ }
754734void NeuralAmpModeler::_PrepareBuffers (const size_t numChannels, const size_t numFrames)
755735{
756736 const bool updateChannels = numChannels != _GetBufferNumChannels ();
0 commit comments