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

Add some 'const' in parameter space #4863

Merged
merged 1 commit into from
Aug 18, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
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
39 changes: 21 additions & 18 deletions src/common/FilterConfiguration.h
Original file line number Diff line number Diff line change
Expand Up @@ -377,20 +377,23 @@ struct FilterSelectorMapper : public ParameterDiscreteIndexRemapper
std::cout << "BAD MAPPING TYPES" << std::endl;
}

virtual int remapStreamedIndexToDisplayIndex(int i) override { return inverseMapping[i]; }
virtual std::string nameAtStreamedIndex(int i) override { return fut_menu_names[i]; }
virtual bool hasGroupNames() override { return true; };
virtual int remapStreamedIndexToDisplayIndex(int i) const override
{
return inverseMapping.at(i);
}
virtual std::string nameAtStreamedIndex(int i) const override { return fut_menu_names[i]; }
virtual bool hasGroupNames() const override { return true; };

virtual std::string groupNameAtStreamedIndex(int i) override
virtual std::string groupNameAtStreamedIndex(int i) const override
{
return mapping[inverseMapping[i]].second;
return mapping[inverseMapping.at(i)].second;
}

virtual bool sortGroupNames() override { return false; }
bool useRemappedOrderingForGroupsIfNotSorted() override { return true; }
virtual bool sortGroupNames() const override { return false; }
bool useRemappedOrderingForGroupsIfNotSorted() const override { return true; }

virtual bool supportsTotalIndexOrdering() override { return true; }
virtual const std::vector<int> totalIndexOrdering() override
virtual bool supportsTotalIndexOrdering() const override { return true; }
virtual const std::vector<int> totalIndexOrdering() const override
{
auto res = std::vector<int>();
for (auto m : mapping)
Expand Down Expand Up @@ -626,20 +629,20 @@ struct WaveShaperSelectorMapper : public ParameterDiscreteIndexRemapper
std::cout << "BAD MAPPING TYPES" << std::endl;
}

int remapStreamedIndexToDisplayIndex(int i) override { return inverseMapping[i]; }
std::string nameAtStreamedIndex(int i) override { return wst_names[i]; }
bool hasGroupNames() override { return true; };
int remapStreamedIndexToDisplayIndex(int i) const override { return inverseMapping.at(i); }
std::string nameAtStreamedIndex(int i) const override { return wst_names[i]; }
bool hasGroupNames() const override { return true; };

std::string groupNameAtStreamedIndex(int i) override
std::string groupNameAtStreamedIndex(int i) const override
{
return mapping[inverseMapping[i]].second;
return mapping[inverseMapping.at(i)].second;
}

bool sortGroupNames() override { return false; }
bool useRemappedOrderingForGroupsIfNotSorted() override { return true; }
bool sortGroupNames() const override { return false; }
bool useRemappedOrderingForGroupsIfNotSorted() const override { return true; }

bool supportsTotalIndexOrdering() override { return true; }
const std::vector<int> totalIndexOrdering() override
bool supportsTotalIndexOrdering() const override { return true; }
const std::vector<int> totalIndexOrdering() const override
{
auto res = std::vector<int>();
for (auto m : mapping)
Expand Down
49 changes: 25 additions & 24 deletions src/common/Parameter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ void get_prefix(char *txt, ControlGroup ctrlgroup, int ctrlgroup_entry, int scen
}

void Parameter::create_fullname(const char *dn, char *fn, ControlGroup ctrlgroup,
int ctrlgroup_entry, const char *lfoPrefixOverride)
int ctrlgroup_entry, const char *lfoPrefixOverride) const
{
char prefix[PREFIX_SIZE];
bool useprefix = true;
Expand Down Expand Up @@ -233,7 +233,7 @@ void Parameter::clear_flags()
porta_curve = porta_lin;
}

bool Parameter::can_temposync()
bool Parameter::can_temposync() const
{
switch (ctrltype)
{
Expand All @@ -249,7 +249,7 @@ bool Parameter::can_temposync()
return false;
}

bool Parameter::can_extend_range()
bool Parameter::can_extend_range() const
{
switch (ctrltype)
{
Expand Down Expand Up @@ -280,7 +280,7 @@ bool Parameter::can_extend_range()
return false;
}

bool Parameter::can_be_absolute()
bool Parameter::can_be_absolute() const
{
switch (ctrltype)
{
Expand All @@ -293,7 +293,7 @@ bool Parameter::can_be_absolute()
return false;
}

bool Parameter::can_deactivate()
bool Parameter::can_deactivate() const
{
switch (ctrltype)
{
Expand All @@ -314,15 +314,15 @@ bool Parameter::can_deactivate()
return false;
}

bool Parameter::has_portaoptions()
bool Parameter::has_portaoptions() const
{
if (ctrltype == ct_portatime)
return true;
else
return false;
}

bool Parameter::has_deformoptions()
bool Parameter::has_deformoptions() const
{
switch (ctrltype)
{
Expand All @@ -338,7 +338,7 @@ bool Parameter::has_deformoptions()
return false;
}

bool Parameter::is_bipolar()
bool Parameter::is_bipolar() const
{
if (dynamicBipolar != nullptr)
{
Expand Down Expand Up @@ -390,7 +390,7 @@ bool Parameter::is_bipolar()
return res;
}

bool Parameter::is_discrete_selection()
bool Parameter::is_discrete_selection() const
{
switch (ctrltype)
{
Expand All @@ -417,7 +417,7 @@ bool Parameter::is_discrete_selection()
return false;
}

bool Parameter::is_nonlocal_on_change()
bool Parameter::is_nonlocal_on_change() const
{
switch (ctrltype)
{
Expand All @@ -431,7 +431,7 @@ bool Parameter::is_nonlocal_on_change()
return false;
}

bool Parameter::appears_deactivated()
bool Parameter::appears_deactivated() const
{
if (dynamicDeactivation)
return dynamicDeactivation->getValue(this);
Expand All @@ -442,7 +442,7 @@ bool Parameter::appears_deactivated()
return false;
}

Parameter *Parameter::get_primary_deactivation_driver()
Parameter *Parameter::get_primary_deactivation_driver() const
{
if (dynamicDeactivation)
return dynamicDeactivation->getPrimaryDeactivationDriver(this);
Expand Down Expand Up @@ -1758,7 +1758,7 @@ void Parameter::bound_value(bool force_integer)
};
}

bool Parameter::supportsDynamicName()
bool Parameter::supportsDynamicName() const
{
switch (ctrltype)
{
Expand All @@ -1776,7 +1776,7 @@ bool Parameter::supportsDynamicName()
}
return false;
}
const char *Parameter::get_name()
const char *Parameter::get_name() const
{
// We only even want to try this for specific types we know support it
if (supportsDynamicName() && dynamicName)
Expand All @@ -1785,7 +1785,7 @@ const char *Parameter::get_name()
return dispname;
}

const char *Parameter::get_full_name()
const char *Parameter::get_full_name() const
{
if (supportsDynamicName() && dynamicName)
{
Expand All @@ -1802,7 +1802,7 @@ const char *Parameter::get_internal_name() const { return name; }

const char *Parameter::get_storage_name() const { return name_storage; }

char *Parameter::get_storage_value(char *str)
char *Parameter::get_storage_value(char *str) const
{
switch (valtype)
{
Expand Down Expand Up @@ -1857,6 +1857,7 @@ float Parameter::get_extended(float f)
{
case ct_freq_reson_band1:
{
// Why the heck are we modifying this here?
val_max.f = -6.6305f; // 300 Hz
return f;
}
Expand Down Expand Up @@ -1936,7 +1937,7 @@ float Parameter::get_extended(float f)
}
}

std::string Parameter::tempoSyncNotationValue(float f)
std::string Parameter::tempoSyncNotationValue(float f) const
{
float a, b = modff(f, &a);

Expand Down Expand Up @@ -2601,7 +2602,7 @@ void Parameter::get_display_of_modulation_depth(char *txt, float modulationDepth
}
}

float Parameter::quantize_modulation(float inputval)
float Parameter::quantize_modulation(float inputval) const
{
float res;

Expand Down Expand Up @@ -2732,7 +2733,7 @@ float Parameter::quantize_modulation(float inputval)
return res;
}

void Parameter::get_display_alt(char *txt, bool external, float ef)
void Parameter::get_display_alt(char *txt, bool external, float ef) const
{

txt[0] = 0;
Expand Down Expand Up @@ -3507,7 +3508,7 @@ void Parameter::get_display(char *txt, bool external, float ef)
};
}

float Parameter::get_value_f01()
float Parameter::get_value_f01() const
{
if (ctrltype == ct_none)
return 0;
Expand All @@ -3526,7 +3527,7 @@ float Parameter::get_value_f01()
return 0;
}

float Parameter::normalized_to_value(float value)
float Parameter::normalized_to_value(float value) const
{
switch (valtype)
{
Expand All @@ -3543,7 +3544,7 @@ float Parameter::normalized_to_value(float value)
return 0;
}

float Parameter::value_to_normalized(float value)
float Parameter::value_to_normalized(float value) const
{
switch (valtype)
{
Expand All @@ -3562,7 +3563,7 @@ float Parameter::value_to_normalized(float value)

const wchar_t *Parameter::getUnit() const { return L""; }

float Parameter::get_default_value_f01()
float Parameter::get_default_value_f01() const
{
if (ctrltype == ct_none)
return 0;
Expand Down Expand Up @@ -3672,7 +3673,7 @@ void Parameter::morph(Parameter *a, Parameter *b, float x)
}
}

bool Parameter::can_setvalue_from_string()
bool Parameter::can_setvalue_from_string() const
{
switch (ctrltype)
{
Expand Down
Loading