Upgrade NAM gate threshold

This commit is contained in:
Robin E. R. Davies
2025-09-06 18:37:40 -04:00
parent f4d857f915
commit d41afe07a4
+21 -10
View File
@@ -2064,18 +2064,29 @@ void PiPedalModel::UpdateDefaults(PedalboardItem *pedalboardItem, std::unordered
//////// PLUGIN SPECIFIC UPGRADES ////////////////////// //////// PLUGIN SPECIFIC UPGRADES //////////////////////
if (pPlugin->uri() == "http://two-play.com/plugins/toob-nam") if (pPlugin->uri() == "http://two-play.com/plugins/toob-nam")
{ {
ControlValue *pValue = pedalboardItem->GetControlValue("inputCalibrationMode"); ControlValue *pVersion = pedalboardItem->GetControlValue("version");
if (pValue == nullptr) if (pVersion == nullptr) {
{ ControlValue *pValue = pedalboardItem->GetControlValue("inputCalibrationMode");
// calibration is OFF when upgrading. if (pValue == nullptr)
pedalboardItem->SetControlValue("inputCalibrationMode", 0.0f); {
} // calibration is OFF when upgradfing.
pValue = pedalboardItem->GetControlValue("version"); pedalboardItem->SetControlValue("inputCalibrationMode", 0.0f);
if (pValue == nullptr) }
{ // convert old gate threshold to new gate threshold.
ControlValue *pGateValue = pedalboardItem->GetControlValue("gate");
if (pGateValue) {
float value = pGateValue->value();
// Is the gate disabled?
if (value <= -100.0f)
{
value = -120.0f; // "disabled in new range."
} else {
value = value * 0.5; // correct the bug in original implementation.
}
pedalboardItem->SetControlValue("gate", value);
}
pedalboardItem->SetControlValue("version", 0.0f); pedalboardItem->SetControlValue("version", 0.0f);
} }
}
for (size_t i = 0; i < pPlugin->ports().size(); ++i) for (size_t i = 0; i < pPlugin->ports().size(); ++i)
{ {
auto port = pPlugin->ports()[i]; auto port = pPlugin->ports()[i];