Revert
This commit is contained in:
+17
-32
@@ -1911,7 +1911,7 @@ void PiPedalModel::SetOnboarding(bool value)
|
|||||||
SetJackServerSettings(this->jackServerSettings);
|
SetJackServerSettings(this->jackServerSettings);
|
||||||
}
|
}
|
||||||
|
|
||||||
void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSettings, bool persist)
|
void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSettings)
|
||||||
{
|
{
|
||||||
std::unique_lock<std::recursive_mutex> guard(mutex);
|
std::unique_lock<std::recursive_mutex> guard(mutex);
|
||||||
|
|
||||||
@@ -1922,7 +1922,6 @@ 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)
|
||||||
@@ -1933,25 +1932,14 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
|
|||||||
}
|
}
|
||||||
|
|
||||||
#if ALSA_HOST
|
#if ALSA_HOST
|
||||||
if (persist)
|
storage.SetJackServerSettings(jackServerSettings);
|
||||||
{
|
|
||||||
storage.SetJackServerSettings(jackServerSettings);
|
|
||||||
}
|
|
||||||
|
|
||||||
FireJackConfigurationChanged(this->jackConfiguration);
|
FireJackConfigurationChanged(this->jackConfiguration);
|
||||||
//Only if different. Trying to decrease audio server restarts.
|
|
||||||
if (changed)
|
|
||||||
{
|
|
||||||
CancelAudioRetry();
|
|
||||||
|
|
||||||
guard.unlock();
|
CancelAudioRetry();
|
||||||
RestartAudio();
|
|
||||||
}
|
guard.unlock();
|
||||||
else
|
RestartAudio();
|
||||||
{
|
|
||||||
// Only persistence requested.
|
|
||||||
guard.unlock();
|
|
||||||
}
|
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
#if JACK_HOST
|
#if JACK_HOST
|
||||||
@@ -1962,15 +1950,13 @@ 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);
|
||||||
{
|
FireJackConfigurationChanged(this->jackConfiguration);
|
||||||
this->jackConfiguration.SetIsRestarting(true);
|
this->audioHost->UpdateServerConfiguration(
|
||||||
FireJackConfigurationChanged(this->jackConfiguration);
|
jackServerSettings,
|
||||||
this->audioHost->UpdateServerConfiguration(
|
[this](bool success, const std::string &errorMessage)
|
||||||
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)
|
||||||
{
|
{
|
||||||
@@ -2002,8 +1988,7 @@ void PiPedalModel::SetJackServerSettings(const JackServerSettings &jackServerSet
|
|||||||
UpdateRealtimeMonitorPortSubscriptions();
|
UpdateRealtimeMonitorPortSubscriptions();
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
@@ -3035,7 +3020,6 @@ void PiPedalModel::OnAlsaDriverTerminatedAbnormally()
|
|||||||
if (audioRestartRetries == 0)
|
if (audioRestartRetries == 0)
|
||||||
{
|
{
|
||||||
this->audioRetryPostHandle = this->Post(
|
this->audioRetryPostHandle = this->Post(
|
||||||
|
|
||||||
// No lock to avoid deadlocks!
|
// No lock to avoid deadlocks!
|
||||||
[this]() {
|
[this]() {
|
||||||
Lv2Log::info("Restarting audio.");
|
Lv2Log::info("Restarting audio.");
|
||||||
@@ -3067,7 +3051,7 @@ void PiPedalModel::OnAlsaDriverTerminatedAbnormally()
|
|||||||
}
|
}
|
||||||
++audioRestartRetries;
|
++audioRestartRetries;
|
||||||
} else {
|
} else {
|
||||||
Lv2Log::error(SS("Unable to restart audio."));
|
Lv2Log::error(SS("Unable to reastart audio."));
|
||||||
|
|
||||||
} });
|
} });
|
||||||
}
|
}
|
||||||
@@ -3105,7 +3089,7 @@ void PiPedalModel::SetTone3000Auth(const std::string &apiKey)
|
|||||||
{
|
{
|
||||||
std::lock_guard<std::recursive_mutex> lock(mutex);
|
std::lock_guard<std::recursive_mutex> lock(mutex);
|
||||||
storage.SetTone3000Auth(apiKey);
|
storage.SetTone3000Auth(apiKey);
|
||||||
|
|
||||||
std::vector<IPiPedalModelSubscriber::ptr> t{subscribers.begin(), subscribers.end()};
|
std::vector<IPiPedalModelSubscriber::ptr> t{subscribers.begin(), subscribers.end()};
|
||||||
bool hasAuth = apiKey != "";
|
bool hasAuth = apiKey != "";
|
||||||
for (auto &subscriber : t)
|
for (auto &subscriber : t)
|
||||||
@@ -3120,3 +3104,4 @@ bool PiPedalModel::HasTone3000Auth() const
|
|||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
@@ -449,7 +449,7 @@ namespace pipedal
|
|||||||
return this->audioHost->getJackStatus();
|
return this->audioHost->getJackStatus();
|
||||||
}
|
}
|
||||||
JackServerSettings GetJackServerSettings();
|
JackServerSettings GetJackServerSettings();
|
||||||
void SetJackServerSettings(const JackServerSettings &jackServerSettings, bool persist = true);
|
void SetJackServerSettings(const JackServerSettings &jackServerSettings);
|
||||||
|
|
||||||
void ListenForMidiEvent(int64_t clientId, int64_t clientHandle);
|
void ListenForMidiEvent(int64_t clientId, int64_t clientHandle);
|
||||||
void CancelListenForMidiEvent(int64_t clientId, int64_t clientHandle);
|
void CancelListenForMidiEvent(int64_t clientId, int64_t clientHandle);
|
||||||
|
|||||||
+1
-74
@@ -41,73 +41,11 @@
|
|||||||
#include "SysExec.hpp"
|
#include "SysExec.hpp"
|
||||||
#include "PiPedalAlsa.hpp"
|
#include "PiPedalAlsa.hpp"
|
||||||
#include <filesystem>
|
#include <filesystem>
|
||||||
#include <sstream>
|
|
||||||
#include "FileEntry.hpp"
|
#include "FileEntry.hpp"
|
||||||
|
|
||||||
using namespace std;
|
using namespace std;
|
||||||
using namespace pipedal;
|
using namespace pipedal;
|
||||||
|
|
||||||
static std::string JoinStrings(const std::vector<std::string> &values, const std::string &sep = ", ")
|
|
||||||
{
|
|
||||||
std::stringstream ss;
|
|
||||||
for (size_t i = 0; i < values.size(); ++i)
|
|
||||||
{
|
|
||||||
if (i != 0)
|
|
||||||
ss << sep;
|
|
||||||
ss << values[i];
|
|
||||||
}
|
|
||||||
return ss.str();
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CheckJackServerSettings(const JackServerSettings &settings)
|
|
||||||
{
|
|
||||||
std::vector<std::string> missing;
|
|
||||||
if (settings.GetAlsaInputDevice().empty())
|
|
||||||
missing.push_back("alsaInputDevice");
|
|
||||||
if (settings.GetAlsaOutputDevice().empty())
|
|
||||||
missing.push_back("alsaOutputDevice");
|
|
||||||
if (settings.GetSampleRate() == 0)
|
|
||||||
missing.push_back("sampleRate");
|
|
||||||
if (settings.GetBufferSize() == 0)
|
|
||||||
missing.push_back("bufferSize");
|
|
||||||
if (settings.GetNumberOfBuffers() == 0)
|
|
||||||
missing.push_back("numberOfBuffers");
|
|
||||||
if (!missing.empty())
|
|
||||||
throw PiPedalArgumentException("Missing properties: " + JoinStrings(missing));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CheckWifiConfigSettings(const WifiConfigSettings &settings)
|
|
||||||
{
|
|
||||||
std::vector<std::string> missing;
|
|
||||||
if (settings.countryCode_.empty())
|
|
||||||
missing.push_back("countryCode");
|
|
||||||
if (settings.hotspotName_.empty())
|
|
||||||
missing.push_back("hotspotName");
|
|
||||||
if (settings.channel_.empty())
|
|
||||||
missing.push_back("channel");
|
|
||||||
if (settings.IsEnabled() && !settings.hasSavedPassword_ && settings.password_.empty())
|
|
||||||
missing.push_back("password");
|
|
||||||
if (!missing.empty())
|
|
||||||
throw PiPedalArgumentException("Missing properties: " + JoinStrings(missing));
|
|
||||||
}
|
|
||||||
|
|
||||||
static void CheckWifiDirectConfigSettings(const WifiDirectConfigSettings &settings)
|
|
||||||
{
|
|
||||||
std::vector<std::string> missing;
|
|
||||||
if (settings.countryCode_.empty())
|
|
||||||
missing.push_back("countryCode");
|
|
||||||
if (settings.hotspotName_.empty())
|
|
||||||
missing.push_back("hotspotName");
|
|
||||||
if (settings.pin_.empty())
|
|
||||||
missing.push_back("pin");
|
|
||||||
if (settings.channel_.empty())
|
|
||||||
missing.push_back("channel");
|
|
||||||
if (settings.wlan_.empty())
|
|
||||||
missing.push_back("wlan");
|
|
||||||
if (!missing.empty())
|
|
||||||
throw PiPedalArgumentException("Missing properties: " + JoinStrings(missing));
|
|
||||||
}
|
|
||||||
|
|
||||||
class PathPatchPropertyChangedBody
|
class PathPatchPropertyChangedBody
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
@@ -1284,17 +1222,8 @@ public:
|
|||||||
{
|
{
|
||||||
JackServerSettings jackServerSettings;
|
JackServerSettings jackServerSettings;
|
||||||
pReader->read(&jackServerSettings);
|
pReader->read(&jackServerSettings);
|
||||||
CheckJackServerSettings(jackServerSettings);
|
this->model.SetJackServerSettings(jackServerSettings);
|
||||||
this->model.SetJackServerSettings(jackServerSettings, true);
|
|
||||||
this->Reply(replyTo, "setJackserverSettings");
|
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")
|
else if (message == "setGovernorSettings")
|
||||||
{
|
{
|
||||||
@@ -1312,7 +1241,6 @@ public:
|
|||||||
{
|
{
|
||||||
WifiConfigSettings wifiConfigSettings;
|
WifiConfigSettings wifiConfigSettings;
|
||||||
pReader->read(&wifiConfigSettings);
|
pReader->read(&wifiConfigSettings);
|
||||||
CheckWifiConfigSettings(wifiConfigSettings);
|
|
||||||
if (!GetAdminClient().CanUseAdminClient())
|
if (!GetAdminClient().CanUseAdminClient())
|
||||||
{
|
{
|
||||||
throw PiPedalException("Can't change server settings when running interactively.");
|
throw PiPedalException("Can't change server settings when running interactively.");
|
||||||
@@ -1334,7 +1262,6 @@ public:
|
|||||||
{
|
{
|
||||||
WifiDirectConfigSettings wifiDirectConfigSettings;
|
WifiDirectConfigSettings wifiDirectConfigSettings;
|
||||||
pReader->read(&wifiDirectConfigSettings);
|
pReader->read(&wifiDirectConfigSettings);
|
||||||
CheckWifiDirectConfigSettings(wifiDirectConfigSettings);
|
|
||||||
if (!GetAdminClient().CanUseAdminClient())
|
if (!GetAdminClient().CanUseAdminClient())
|
||||||
{
|
{
|
||||||
throw PiPedalException("Can't change server settings when running interactively.");
|
throw PiPedalException("Can't change server settings when running interactively.");
|
||||||
|
|||||||
@@ -1,4 +1,3 @@
|
|||||||
@@ -1,3543 +1,3543 @@
|
|
||||||
// Copyright (c) 2022 Robin Davies
|
// Copyright (c) 2022 Robin Davies
|
||||||
//
|
//
|
||||||
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
// Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||||
@@ -3540,3 +3539,5 @@ export class PiPedalModelFactory {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user