Handle multiple server restarts
Trying to decrease by only taking steps if different.
This commit is contained in:
+24
-12
@@ -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();
|
||||||
|
RestartAudio();
|
||||||
guard.unlock();
|
}
|
||||||
RestartAudio();
|
else
|
||||||
|
{
|
||||||
|
// Only persistence requested.
|
||||||
|
guard.unlock();
|
||||||
|
}
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#if JACK_HOST
|
#if JACK_HOST
|
||||||
@@ -1953,13 +1962,15 @@ 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.
|
||||||
this->jackConfiguration.SetIsRestarting(true);
|
if (changed)
|
||||||
FireJackConfigurationChanged(this->jackConfiguration);
|
{
|
||||||
this->audioHost->UpdateServerConfiguration(
|
this->jackConfiguration.SetIsRestarting(true);
|
||||||
jackServerSettings,
|
FireJackConfigurationChanged(this->jackConfiguration);
|
||||||
[this](bool success, const std::string &errorMessage)
|
this->audioHost->UpdateServerConfiguration(
|
||||||
{
|
jackServerSettings,
|
||||||
|
[this](bool success, const std::string &errorMessage)
|
||||||
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
if (!success)
|
if (!success)
|
||||||
{
|
{
|
||||||
@@ -1991,7 +2002,8 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
|
|||||||
UpdateRealtimeMonitorPortSubscriptions();
|
UpdateRealtimeMonitorPortSubscriptions();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
}
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user