From b03edd4e771a8d3b81e60412d271dcabe1c4a033 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Sat, 12 Aug 2023 13:04:49 -0400 Subject: [PATCH 1/3] Deactivate misleading tuning typeins in Tune-After mode In Tune-After mode the typein "9/8" didn't uniformly give you a 9/8 pitch shift; it gave you that many keys shift. This was rather confusing. Some even called it "borked". So just make a clear error that this typein style is only availabel in tune-at-midi mode Closes #6977 --- src/common/Parameter.cpp | 28 ++++++++++++++++++++++++++++ src/common/Parameter.h | 1 + 2 files changed, 29 insertions(+) diff --git a/src/common/Parameter.cpp b/src/common/Parameter.cpp index 30db05b3e59..a60a5dada2b 100644 --- a/src/common/Parameter.cpp +++ b/src/common/Parameter.cpp @@ -4497,6 +4497,9 @@ bool Parameter::set_value_from_string_onto(const std::string &s, pdata &ontoThis { if (extend_range && s.find("/") != std::string::npos) { + if (!supports_tuning_value_from_string(s, errMsg)) + return false; + try { auto a = Tunings::toneFromString(s); @@ -4627,6 +4630,9 @@ bool Parameter::set_value_from_string_onto(const std::string &s, pdata &ontoThis // Check for a fraction if (s.find("/") != std::string::npos) { + if (!supports_tuning_value_from_string(s, errMsg)) + return false; + try { auto a = Tunings::toneFromString(s); @@ -4919,6 +4925,9 @@ float Parameter::calculate_modulation_value_from_string(const std::string &s, st // Check for a fraction if (s.find("/") != std::string::npos) { + if (!supports_tuning_value_from_string(s, errMsg)) + return false; + try { auto a = Tunings::toneFromString(s); @@ -5022,6 +5031,9 @@ float Parameter::calculate_modulation_value_from_string(const std::string &s, st if (s[0] == 'T' || s[0] == 't') { + if (!supports_tuning_value_from_string(s, errMsg)) + return false; + try { auto a = Tunings::toneFromString(s.c_str() + 1); @@ -5299,4 +5311,20 @@ float Parameter::calculate_modulation_value_from_string(const std::string &s, st return 0.0; } +bool Parameter::supports_tuning_value_from_string(const std::string &s, std::string &errMsg) +{ + if (!storage) + { + // Well that's odd! But let it go. + return true; + } + if (storage->tuningApplicationMode == SurgeStorage::TuningApplicationMode::RETUNE_ALL) + { + errMsg = "No tuning typesin in tune-after mode"; + return false; + } + + return true; +} + std::atomic parameterNameUpdated(false); diff --git a/src/common/Parameter.h b/src/common/Parameter.h index 46d451f6e69..cc277e5771c 100644 --- a/src/common/Parameter.h +++ b/src/common/Parameter.h @@ -462,6 +462,7 @@ class Parameter void set_value_f01(float v, bool force_integer = false); bool set_value_from_string(const std::string &s, std::string &errMsg); bool set_value_from_string_onto(const std::string &s, pdata &ontoThis, std::string &errMsg); + bool supports_tuning_value_from_string(const std::string &s, std::string &errMsg); void set_error_message(std::string &errMsg, const std::string value, const std::string unit, const ErrorMessageMode mode); void set_extend_range(bool er); From bf81dfdb12d2340c408b1f4b1c1cb37c9309a810 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Sat, 12 Aug 2023 13:31:52 -0400 Subject: [PATCH 2/3] f --- src/common/Parameter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Parameter.cpp b/src/common/Parameter.cpp index a60a5dada2b..7c61a1d0bde 100644 --- a/src/common/Parameter.cpp +++ b/src/common/Parameter.cpp @@ -5320,7 +5320,7 @@ bool Parameter::supports_tuning_value_from_string(const std::string &s, std::str } if (storage->tuningApplicationMode == SurgeStorage::TuningApplicationMode::RETUNE_ALL) { - errMsg = "No tuning typesin in tune-after mode"; + errMsg = "No tuning type-ins in tune-after mode"; return false; } From d9c19c732a8280a930e9c05f0bd81c3a0d858c95 Mon Sep 17 00:00:00 2001 From: Paul Walker Date: Sat, 12 Aug 2023 14:13:39 -0400 Subject: [PATCH 3/3] f --- src/common/Parameter.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/common/Parameter.cpp b/src/common/Parameter.cpp index 7c61a1d0bde..b07ebb2ef13 100644 --- a/src/common/Parameter.cpp +++ b/src/common/Parameter.cpp @@ -5320,7 +5320,7 @@ bool Parameter::supports_tuning_value_from_string(const std::string &s, std::str } if (storage->tuningApplicationMode == SurgeStorage::TuningApplicationMode::RETUNE_ALL) { - errMsg = "No tuning type-ins in tune-after mode"; + errMsg = "No ratio type-ins in tune-after mode"; return false; }