mirror of
https://github.com/mikeoliphant/neural-amp-modeler-lv2.git
synced 2026-07-22 02:16:23 +02:00
Fix race condition when setting the quality scale while loading a model
This commit is contained in:
+11
-12
@@ -222,6 +222,12 @@ namespace NAM {
|
|||||||
lv2_atom_forge_set_buffer(&atom_forge, (uint8_t*)ports.notify, ports.notify->atom.size);
|
lv2_atom_forge_set_buffer(&atom_forge, (uint8_t*)ports.notify, ports.notify->atom.size);
|
||||||
lv2_atom_forge_sequence_head(&atom_forge, &sequence_frame, uris.units_frame);
|
lv2_atom_forge_sequence_head(&atom_forge, &sequence_frame, uris.units_frame);
|
||||||
|
|
||||||
|
if (*(ports.quality_scale) != loader.GetDefaultQualityScaleFactor())
|
||||||
|
{
|
||||||
|
// Do this before checking the model path parameter so we make sure to set the quality first
|
||||||
|
loader.SetDefaultQualityScaleFactor(*(ports.quality_scale));
|
||||||
|
}
|
||||||
|
|
||||||
LV2_ATOM_SEQUENCE_FOREACH(ports.control, event)
|
LV2_ATOM_SEQUENCE_FOREACH(ports.control, event)
|
||||||
{
|
{
|
||||||
if (event->body.type == uris.atom_Object)
|
if (event->body.type == uris.atom_Object)
|
||||||
@@ -254,24 +260,17 @@ namespace NAM {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (*(ports.quality_scale) != qualityScale)
|
|
||||||
{
|
|
||||||
qualityScale = *(ports.quality_scale);
|
|
||||||
|
|
||||||
loader.SetDefaultQualityScaleFactor(qualityScale);
|
|
||||||
|
|
||||||
if (currentModel != nullptr)
|
|
||||||
{
|
|
||||||
currentModel->SetQualityScaleFactor(qualityScale);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
float level;
|
float level;
|
||||||
|
|
||||||
float modelInputAdjustmentDB = 0;
|
float modelInputAdjustmentDB = 0;
|
||||||
|
|
||||||
if (currentModel != nullptr)
|
if (currentModel != nullptr)
|
||||||
{
|
{
|
||||||
|
if (*(ports.quality_scale) != currentModel->GetQualityScaleFactor())
|
||||||
|
{
|
||||||
|
currentModel->SetQualityScaleFactor(*(ports.quality_scale));
|
||||||
|
}
|
||||||
|
|
||||||
modelInputAdjustmentDB = currentModel->GetRecommendedInputDBAdjustment();
|
modelInputAdjustmentDB = currentModel->GetRecommendedInputDBAdjustment();
|
||||||
|
|
||||||
#ifdef SMART_BYPASS_ENABLED
|
#ifdef SMART_BYPASS_ENABLED
|
||||||
|
|||||||
@@ -76,7 +76,6 @@ namespace NAM {
|
|||||||
std::string currentModelPath;
|
std::string currentModelPath;
|
||||||
float prevDCInput = 0;
|
float prevDCInput = 0;
|
||||||
float prevDCOutput = 0;
|
float prevDCOutput = 0;
|
||||||
float qualityScale = 1.0f;
|
|
||||||
|
|
||||||
Plugin();
|
Plugin();
|
||||||
~Plugin();
|
~Plugin();
|
||||||
|
|||||||
Reference in New Issue
Block a user