Skip to content

Commit

Permalink
Handle model input gain adjustment
Browse files Browse the repository at this point in the history
  • Loading branch information
mikeoliphant committed Nov 4, 2024
1 parent d48e4a4 commit 32f18a2
Showing 1 changed file with 8 additions and 3 deletions.
11 changes: 8 additions & 3 deletions src/nam_plugin.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand Down Expand Up @@ -250,8 +257,6 @@ namespace NAM {

if (currentModel != nullptr)
{
std::vector<float> inout( + n_samples);

currentModel->Process(ports.audio_out, ports.audio_out, n_samples);

modelLoudnessAdjustmentDB = currentModel->GetRecommendedOutputDBAdjustment();
Expand Down

0 comments on commit 32f18a2

Please sign in to comment.