From fb974f5af5ab837e23bdec0cfbe6bbd3b45e271a Mon Sep 17 00:00:00 2001 From: Extremesecrecy <10959169+extremesecrecy@users.noreply.github.com> Date: Thu, 24 Jul 2025 16:59:17 -0700 Subject: [PATCH] Legacy Modifications Added legacy integration so that upon upgrade, the device does not fail. --- src/JackServerSettings.cpp | 1 + src/JackServerSettings.hpp | 5 ++++- src/Storage.cpp | 8 ++++++++ 3 files changed, 13 insertions(+), 1 deletion(-) diff --git a/src/JackServerSettings.cpp b/src/JackServerSettings.cpp index bfbe8e0..1a085ab 100644 --- a/src/JackServerSettings.cpp +++ b/src/JackServerSettings.cpp @@ -254,6 +254,7 @@ JSON_MAP_REFERENCE(JackServerSettings, valid) JSON_MAP_REFERENCE(JackServerSettings, isOnboarding) JSON_MAP_REFERENCE(JackServerSettings, rebootRequired) JSON_MAP_REFERENCE(JackServerSettings, isJackAudio) +JSON_MAP_REFERENCE(JackServerSettings, alsaDevice) // legacy field JSON_MAP_REFERENCE(JackServerSettings, alsaInputDevice) JSON_MAP_REFERENCE(JackServerSettings, alsaOutputDevice) JSON_MAP_REFERENCE(JackServerSettings, sampleRate) diff --git a/src/JackServerSettings.hpp b/src/JackServerSettings.hpp index 7983bc8..285af30 100644 --- a/src/JackServerSettings.hpp +++ b/src/JackServerSettings.hpp @@ -33,6 +33,7 @@ namespace pipedal bool rebootRequired_ = false; std::string alsaInputDevice_; std::string alsaOutputDevice_; + std::string alsaDevice_; // legacy uint64_t sampleRate_ = 0; uint32_t bufferSize_ = 64; uint32_t numberOfBuffers_ = 3; @@ -61,7 +62,9 @@ namespace pipedal uint32_t GetBufferSize() const { return bufferSize_; } uint32_t GetNumberOfBuffers() const { return numberOfBuffers_; } const std::string &GetAlsaInputDevice() const { return alsaInputDevice_; } - const std::string &GetAlsaOutputDevice() const { return alsaOutputDevice_; } + const std::string &GetAlsaOutputDevice() const { return alsaOutputDevice_; } + const std::string &GetLegacyAlsaDevice() const { return alsaDevice_; } //legacy + void SetLegacyAlsaDevice(const std::string &d) { alsaDevice_ = d; } void UseDummyAudioDevice() { this->valid_ = true; if (sampleRate_ == 0) sampleRate_ = 48000; diff --git a/src/Storage.cpp b/src/Storage.cpp index 29872c5..f8bb149 100644 --- a/src/Storage.cpp +++ b/src/Storage.cpp @@ -1573,6 +1573,14 @@ std::map Storage::GetFavorites() const { json_reader reader(f); reader.read(&result); + if (!result.GetLegacyAlsaDevice().empty() && + result.GetAlsaInputDevice().empty() && + result.GetAlsaOutputDevice().empty()) + { + result.SetAlsaInputDevice(result.GetLegacyAlsaDevice()); + result.SetAlsaOutputDevice(result.GetLegacyAlsaDevice()); + result.SetLegacyAlsaDevice(""); + } } return result; }