Handle multiple server restarts

Trying to decrease by only taking steps if different.
This commit is contained in:
Extremesecrecy
2025-07-26 13:49:19 -07:00
parent c7bcc7c240
commit 8b3cdcf3f3
+14 -2
View File
@@ -1922,6 +1922,7 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
}
#endif
bool changed = !jackServerSettings.Equals(this->jackServerSettings);
this->jackServerSettings = jackServerSettings;
// take a snapshot incase a client unsusbscribes in the notification handler (in which case the mutex won't protect us)
@@ -1938,11 +1939,19 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
}
FireJackConfigurationChanged(this->jackConfiguration);
//Only if different. Trying to decrease audio server restarts.
if (changed)
{
CancelAudioRetry();
guard.unlock();
RestartAudio();
}
else
{
// Only persistence requested.
guard.unlock();
}
#endif
#if JACK_HOST
@@ -1953,7 +1962,9 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
currentPreset.modified_ = this->hasPresetChanged;
currentPreset.preset_ = this->pedalboard;
storage.SaveCurrentPreset(currentPreset);
//Only if different. Trying to decrease server restarts.
if (changed)
{
this->jackConfiguration.SetIsRestarting(true);
FireJackConfigurationChanged(this->jackConfiguration);
this->audioHost->UpdateServerConfiguration(
@@ -1993,6 +2004,7 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
}
});
}
}
#endif
}