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 #endif
bool changed = !jackServerSettings.Equals(this->jackServerSettings);
this->jackServerSettings = jackServerSettings; this->jackServerSettings = jackServerSettings;
// take a snapshot incase a client unsusbscribes in the notification handler (in which case the mutex won't protect us) // 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); FireJackConfigurationChanged(this->jackConfiguration);
//Only if different. Trying to decrease audio server restarts.
if (changed)
{
CancelAudioRetry(); CancelAudioRetry();
guard.unlock(); guard.unlock();
RestartAudio(); RestartAudio();
}
else
{
// Only persistence requested.
guard.unlock();
}
#endif #endif
#if JACK_HOST #if JACK_HOST
@@ -1953,7 +1962,9 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
currentPreset.modified_ = this->hasPresetChanged; currentPreset.modified_ = this->hasPresetChanged;
currentPreset.preset_ = this->pedalboard; currentPreset.preset_ = this->pedalboard;
storage.SaveCurrentPreset(currentPreset); storage.SaveCurrentPreset(currentPreset);
//Only if different. Trying to decrease server restarts.
if (changed)
{
this->jackConfiguration.SetIsRestarting(true); this->jackConfiguration.SetIsRestarting(true);
FireJackConfigurationChanged(this->jackConfiguration); FireJackConfigurationChanged(this->jackConfiguration);
this->audioHost->UpdateServerConfiguration( this->audioHost->UpdateServerConfiguration(
@@ -1993,6 +2004,7 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
} }
}); });
} }
}
#endif #endif
} }