diff --git a/deps/NeuralAmpModelerCore b/deps/NeuralAmpModelerCore index 855bf50..9a46cb6 160000 --- a/deps/NeuralAmpModelerCore +++ b/deps/NeuralAmpModelerCore @@ -1 +1 @@ -Subproject commit 855bf50fd3cf5f754b297e8624d4aeb341ec57e9 +Subproject commit 9a46cb60c6360ec3f8c640f915de00c372e044ee diff --git a/src/nam_plugin.cpp b/src/nam_plugin.cpp index 8a2e523..96b2fb0 100644 --- a/src/nam_plugin.cpp +++ b/src/nam_plugin.cpp @@ -253,6 +253,8 @@ namespace NAM { float** outputPtrs = &ports.audio_out; + float modelLoudnessAdjustmentDB = 0; + if (currentModel != nullptr) { currentModel->process(ports.audio_out, ports.audio_out, n_samples); @@ -260,13 +262,16 @@ namespace NAM { // Apply a high pass filter at 5Hz to eliminate any DC offset outputPtrs = mHighPass.Process(outputPtrs, 1, n_samples); + + if (currentModel->HasLoudness()) + { + // Normalize model to -18dB + modelLoudnessAdjustmentDB = -58 - currentModel->GetLoudness(); + } } - // Get model normalization gain delta - float normalizeGainDelta = currentModel->GetNormalizationFactorLinear(); - // Convert output level from db - float desiredOutputLevel = powf(10, *(ports.output_level) * 0.05f) * normalizeGainDelta; + float desiredOutputLevel = powf(10, (*(ports.output_level) + modelLoudnessAdjustmentDB) * 0.05f); if (fabs(desiredOutputLevel - outputLevel) > SMOOTH_EPSILON) {