mirror of
https://github.com/mikeoliphant/neural-amp-modeler-lv2.git
synced 2026-05-10 12:40:13 +02:00
Update to latest NAM core. Handle model normalization with output gain.
This commit is contained in:
Vendored
+1
-1
Submodule deps/NeuralAmpModelerCore updated: 8904227e93...855bf50fd3
+8
-5
@@ -113,9 +113,6 @@ namespace NAM {
|
|||||||
|
|
||||||
model = get_dsp(msg->path).release();
|
model = get_dsp(msg->path).release();
|
||||||
|
|
||||||
// Enable model loudness normalization
|
|
||||||
model->SetNormalize(true);
|
|
||||||
|
|
||||||
// Pre-run model to ensure all needed buffers are allocated in advance
|
// Pre-run model to ensure all needed buffers are allocated in advance
|
||||||
if (const int32_t numSamples = nam->maxBufferSize)
|
if (const int32_t numSamples = nam->maxBufferSize)
|
||||||
{
|
{
|
||||||
@@ -241,6 +238,7 @@ namespace NAM {
|
|||||||
|
|
||||||
ports.audio_out[i] = ports.audio_in[i] * level;
|
ports.audio_out[i] = ports.audio_in[i] * level;
|
||||||
}
|
}
|
||||||
|
|
||||||
inputLevel = level;
|
inputLevel = level;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@@ -264,12 +262,16 @@ namespace NAM {
|
|||||||
outputPtrs = mHighPass.Process(outputPtrs, 1, n_samples);
|
outputPtrs = mHighPass.Process(outputPtrs, 1, n_samples);
|
||||||
}
|
}
|
||||||
|
|
||||||
// convert output level from db
|
// Get model normalization gain delta
|
||||||
float desiredOutputLevel = powf(10, *(ports.output_level) * 0.05f);
|
float normalizeGainDelta = currentModel->GetNormalizationFactorLinear();
|
||||||
|
|
||||||
|
// Convert output level from db
|
||||||
|
float desiredOutputLevel = powf(10, *(ports.output_level) * 0.05f) * normalizeGainDelta;
|
||||||
|
|
||||||
if (fabs(desiredOutputLevel - outputLevel) > SMOOTH_EPSILON)
|
if (fabs(desiredOutputLevel - outputLevel) > SMOOTH_EPSILON)
|
||||||
{
|
{
|
||||||
level = outputLevel;
|
level = outputLevel;
|
||||||
|
|
||||||
for (unsigned int i = 0; i < n_samples; i++)
|
for (unsigned int i = 0; i < n_samples; i++)
|
||||||
{
|
{
|
||||||
// do very basic smoothing
|
// do very basic smoothing
|
||||||
@@ -277,6 +279,7 @@ namespace NAM {
|
|||||||
|
|
||||||
ports.audio_out[i] = outputPtrs[0][i] * outputLevel;
|
ports.audio_out[i] = outputPtrs[0][i] * outputLevel;
|
||||||
}
|
}
|
||||||
|
|
||||||
outputLevel = level;
|
outputLevel = level;
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
|
|||||||
Reference in New Issue
Block a user