From 32f18a242a69ee34e31aa29a3e6adfdea15454f2 Mon Sep 17 00:00:00 2001 From: Mike Oliphant Date: Mon, 4 Nov 2024 07:35:34 -0800 Subject: [PATCH] Handle model input gain adjustment --- src/nam_plugin.cpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/nam_plugin.cpp b/src/nam_plugin.cpp index a827362..94c27c0 100644 --- a/src/nam_plugin.cpp +++ b/src/nam_plugin.cpp @@ -220,8 +220,15 @@ namespace NAM { float level; + float modelInputAdjustmentDB = 0; + + if (currentModel != nullptr) + { + modelInputAdjustmentDB = currentModel->GetRecommendedInputDBAdjustment(); + } + // convert input level from db - float desiredInputLevel = powf(10, *(ports.input_level) * 0.05f); + float desiredInputLevel = powf(10, (*(ports.input_level) + modelInputAdjustmentDB) * 0.05f); if (fabs(desiredInputLevel - inputLevel) > SMOOTH_EPSILON) { @@ -250,8 +257,6 @@ namespace NAM { if (currentModel != nullptr) { - std::vector inout( + n_samples); - currentModel->Process(ports.audio_out, ports.audio_out, n_samples); modelLoudnessAdjustmentDB = currentModel->GetRecommendedOutputDBAdjustment();