Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Deactivate misleading tuning typeins in Tune-After mode #7178

Merged
merged 3 commits into from
Aug 12, 2023
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions src/common/Parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down Expand Up @@ -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";
mkruselj marked this conversation as resolved.
Show resolved Hide resolved
return false;
}

return true;
}

std::atomic<bool> parameterNameUpdated(false);
1 change: 1 addition & 0 deletions src/common/Parameter.h
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down