Fix knob linking / refactor linking (#7883)

Closes #7869

This PR aims to fix linking bugs and it aims to make linking code faster. In the future I would like to replace controller and automation code with linked models, so it is essential for this feature to work as efficiently as possible.

Before this PR:

- AutomatableModels store a list of AutomatableModels that they are linked to.
- setValue() and other functions make recursive calls to themself resulting in the #7869 crash.
- Each AutomatableModel can unlink from other AutomatableModels, unlinking is the inverse operation to linking.

After this PR:

- AutomatableModels store a pointer to an other AutomatableModel making a linked list. The end is connected to the first element resulting in a "ring".
- setValue() and others are now recursion free, the code runs for every linked model, more efficiently than before.
- Each AutomatableModel can NOT unlink form other AutomatableModels, unlinking is NOT the inverse operation to linking. AutomatableModels can unlink themself from the linked list, they can not unlink themself from single models.

---------

Co-authored-by: allejok96 <allejok96@gmail.com>
This commit is contained in:
szeli1
2025-12-22 23:37:40 +01:00
committed by GitHub
parent c92741f567
commit 69f7c3243d
13 changed files with 338 additions and 221 deletions

View File

@@ -1052,8 +1052,8 @@ void ManageVestigeInstrumentView::syncPlugin( void )
std::snprintf(paramStr.data(), paramStr.size(), "param%d", i);
s_dumpValues = dump[paramStr.data()].split(":");
float f_value = LocaleHelper::toFloat(s_dumpValues.at(2));
m_vi->knobFModel[ i ]->setAutomatedValue( f_value );
m_vi->knobFModel[ i ]->setInitValue( f_value );
m_vi->knobFModel[i]->setValue(f_value, true);
m_vi->knobFModel[i]->setInitValue(f_value);
}
}
syncParameterText();

View File

@@ -455,8 +455,8 @@ void ManageVSTEffectView::syncPlugin()
std::snprintf(paramStr.data(), paramStr.size(), "param%d", i);
s_dumpValues = dump[paramStr.data()].split(":");
float f_value = LocaleHelper::toFloat(s_dumpValues.at(2));
m_vi2->knobFModel[ i ]->setAutomatedValue( f_value );
m_vi2->knobFModel[ i ]->setInitValue( f_value );
m_vi2->knobFModel[i]->setValue(f_value, true);
m_vi2->knobFModel[i]->setInitValue(f_value);
}
}
syncParameterText();