From c33c69899c882e2c20537ebcfd1e1c6c3175cd5a Mon Sep 17 00:00:00 2001 From: Extremesecrecy <10959169+extremesecrecy@users.noreply.github.com> Date: Fri, 25 Jul 2025 19:58:43 -0700 Subject: [PATCH] Adding persist - T2 Adding model persist so that the apply can be used for testing. Previous did not persist as intented. --- src/PiPedalModel.cpp | 7 +++++-- src/PiPedalModel.hpp | 2 +- src/PiPedalSocket.cpp | 10 +++++++++- vite/src/pipedal/JackServerSettingsDialog.tsx | 2 +- vite/src/pipedal/PiPedalModel.tsx | 6 ++++++ 5 files changed, 22 insertions(+), 5 deletions(-) diff --git a/src/PiPedalModel.cpp b/src/PiPedalModel.cpp index a3b4e95..89323d6 100644 --- a/src/PiPedalModel.cpp +++ b/src/PiPedalModel.cpp @@ -1911,7 +1911,7 @@ void PiPedalModel::SetOnboarding(bool value) SetJackServerSettings(this->jackServerSettings); } -void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSettings) +void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSettings, bool persist) { std::unique_lock guard(mutex); @@ -1932,7 +1932,10 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet } #if ALSA_HOST - storage.SetJackServerSettings(jackServerSettings); + if (persist) + { + storage.SetJackServerSettings(jackServerSettings); + } FireJackConfigurationChanged(this->jackConfiguration); diff --git a/src/PiPedalModel.hpp b/src/PiPedalModel.hpp index 9145be4..012c5ab 100644 --- a/src/PiPedalModel.hpp +++ b/src/PiPedalModel.hpp @@ -449,7 +449,7 @@ namespace pipedal return this->audioHost->getJackStatus(); } JackServerSettings GetJackServerSettings(); - void SetJackServerSettings(const JackServerSettings &jackServerSettings); + void SetJackServerSettings(const JackServerSettings &jackServerSettings, bool persist = true); void ListenForMidiEvent(int64_t clientId, int64_t clientHandle); void CancelListenForMidiEvent(int64_t clientId, int64_t clientHandle); diff --git a/src/PiPedalSocket.cpp b/src/PiPedalSocket.cpp index 00c5624..15a1a2a 100644 --- a/src/PiPedalSocket.cpp +++ b/src/PiPedalSocket.cpp @@ -1285,8 +1285,16 @@ public: JackServerSettings jackServerSettings; pReader->read(&jackServerSettings); CheckJackServerSettings(jackServerSettings); - this->model.SetJackServerSettings(jackServerSettings); + this->model.SetJackServerSettings(jackServerSettings, true); this->Reply(replyTo, "setJackserverSettings"); + } + else if (message == "applyJackServerSettings") + { + JackServerSettings jackServerSettings; + pReader->read(&jackServerSettings); + CheckJackServerSettings(jackServerSettings); + this->model.SetJackServerSettings(jackServerSettings, false); + this->Reply(replyTo, "applyJackServerSettings"); } else if (message == "setGovernorSettings") { diff --git a/vite/src/pipedal/JackServerSettingsDialog.tsx b/vite/src/pipedal/JackServerSettingsDialog.tsx index db75c81..8d4f106 100644 --- a/vite/src/pipedal/JackServerSettingsDialog.tsx +++ b/vite/src/pipedal/JackServerSettingsDialog.tsx @@ -544,7 +544,7 @@ const JackServerSettingsDialog = withStyles( // Apply immediately so the status display can confirm // whether the selected devices are working. s.valid = true; - this.model.setJackServerSettings(s); + this.model.applyJackServerSettings(s); this.startStatusTimer(); } }; diff --git a/vite/src/pipedal/PiPedalModel.tsx b/vite/src/pipedal/PiPedalModel.tsx index 4d4d64e..0c7e486 100644 --- a/vite/src/pipedal/PiPedalModel.tsx +++ b/vite/src/pipedal/PiPedalModel.tsx @@ -2530,6 +2530,12 @@ export class PiPedalModel //implements PiPedalModel this.showAlert(error); }); } + applyJackServerSettings(jackServerSettings: JackServerSettings): void { + this.webSocket?.request("applyJackServerSettings", jackServerSettings) + .catch((error) => { + this.showAlert(error); + }); + } updateVst3State(pedalboard: Pedalboard) { // let it = pedalboard.itemsGenerator();