Browse Source

Rename Engine::setParam() etc to Engine::setParamValue() etc.

tags/v2.0.0
Andrew Belt 3 years ago
parent
commit
de3f42edc1
4 changed files with 15 additions and 15 deletions
  1. +4
    -4
      include/engine/Engine.hpp
  2. +4
    -4
      src/engine/Engine.cpp
  3. +5
    -5
      src/engine/ParamQuantity.cpp
  4. +2
    -2
      src/history.cpp

+ 4
- 4
include/engine/Engine.hpp View File

@@ -182,14 +182,14 @@ struct Engine {
Cable* getCable(int64_t cableId); Cable* getCable(int64_t cableId);


// Params // Params
void setParam(Module* module, int paramId, float value);
float getParam(Module* module, int paramId);
void setParamValue(Module* module, int paramId, float value);
float getParamValue(Module* module, int paramId);
/** Requests the parameter to smoothly change toward `value`. /** Requests the parameter to smoothly change toward `value`.
*/ */
void setSmoothParam(Module* module, int paramId, float value);
void setParamSmoothValue(Module* module, int paramId, float value);
/** Returns the target value before smoothing. /** Returns the target value before smoothing.
*/ */
float getSmoothParam(Module* module, int paramId);
float getParamSmoothValue(Module* module, int paramId);


// ParamHandles // ParamHandles
/** Adds a ParamHandle to the rack. /** Adds a ParamHandle to the rack.


+ 4
- 4
src/engine/Engine.cpp View File

@@ -1083,7 +1083,7 @@ Cable* Engine::getCable(int64_t cableId) {
} }




void Engine::setParam(Module* module, int paramId, float value) {
void Engine::setParamValue(Module* module, int paramId, float value) {
// If param is being smoothed, cancel smoothing. // If param is being smoothed, cancel smoothing.
if (internal->smoothModule == module && internal->smoothParamId == paramId) { if (internal->smoothModule == module && internal->smoothParamId == paramId) {
internal->smoothModule = NULL; internal->smoothModule = NULL;
@@ -1093,12 +1093,12 @@ void Engine::setParam(Module* module, int paramId, float value) {
} }




float Engine::getParam(Module* module, int paramId) {
float Engine::getParamValue(Module* module, int paramId) {
return module->params[paramId].value; return module->params[paramId].value;
} }




void Engine::setSmoothParam(Module* module, int paramId, float value) {
void Engine::setParamSmoothValue(Module* module, int paramId, float value) {
// If another param is being smoothed, jump value // If another param is being smoothed, jump value
if (internal->smoothModule && !(internal->smoothModule == module && internal->smoothParamId == paramId)) { if (internal->smoothModule && !(internal->smoothModule == module && internal->smoothParamId == paramId)) {
internal->smoothModule->params[internal->smoothParamId].value = internal->smoothValue; internal->smoothModule->params[internal->smoothParamId].value = internal->smoothValue;
@@ -1110,7 +1110,7 @@ void Engine::setSmoothParam(Module* module, int paramId, float value) {
} }




float Engine::getSmoothParam(Module* module, int paramId) {
float Engine::getParamSmoothValue(Module* module, int paramId) {
if (internal->smoothModule == module && internal->smoothParamId == paramId) if (internal->smoothModule == module && internal->smoothParamId == paramId)
return internal->smoothValue; return internal->smoothValue;
return module->params[paramId].value; return module->params[paramId].value;


+ 5
- 5
src/engine/ParamQuantity.cpp View File

@@ -22,13 +22,13 @@ void ParamQuantity::setSmoothValue(float value) {
value = math::clampSafe(value, getMinValue(), getMaxValue()); value = math::clampSafe(value, getMinValue(), getMaxValue());
if (snapEnabled) if (snapEnabled)
value = std::round(value); value = std::round(value);
APP->engine->setSmoothParam(module, paramId, value);
APP->engine->setParamSmoothValue(module, paramId, value);
} }


float ParamQuantity::getSmoothValue() { float ParamQuantity::getSmoothValue() {
if (!module) if (!module)
return 0.f; return 0.f;
return APP->engine->getSmoothParam(module, paramId);
return APP->engine->getParamSmoothValue(module, paramId);
} }


void ParamQuantity::setSmoothScaledValue(float scaledValue) { void ParamQuantity::setSmoothScaledValue(float scaledValue) {
@@ -38,7 +38,7 @@ void ParamQuantity::setSmoothScaledValue(float scaledValue) {
setSmoothValue(math::rescale(scaledValue, 0.f, 1.f, getMinValue(), getMaxValue())); setSmoothValue(math::rescale(scaledValue, 0.f, 1.f, getMinValue(), getMaxValue()));
} }


float ParamQuantity::getScaledValue() {
float ParamQuantity::getSmoothScaledValue() {
if (!isBounded()) if (!isBounded())
return getSmoothValue(); return getSmoothValue();
else if (getMinValue() == getMaxValue()) else if (getMinValue() == getMaxValue())
@@ -53,13 +53,13 @@ void ParamQuantity::setValue(float value) {
value = math::clampSafe(value, getMinValue(), getMaxValue()); value = math::clampSafe(value, getMinValue(), getMaxValue());
if (snapEnabled) if (snapEnabled)
value = std::round(value); value = std::round(value);
APP->engine->setParam(module, paramId, value);
APP->engine->setParamValue(module, paramId, value);
} }


float ParamQuantity::getValue() { float ParamQuantity::getValue() {
if (!module) if (!module)
return 0.f; return 0.f;
return APP->engine->getParam(module, paramId);
return APP->engine->getParamValue(module, paramId);
} }


float ParamQuantity::getMinValue() { float ParamQuantity::getMinValue() {


+ 2
- 2
src/history.cpp View File

@@ -131,14 +131,14 @@ void ParamChange::undo() {
engine::Module* module = APP->engine->getModule(moduleId); engine::Module* module = APP->engine->getModule(moduleId);
if (!module) if (!module)
return; return;
APP->engine->setParam(module, paramId, oldValue);
APP->engine->setParamValue(module, paramId, oldValue);
} }


void ParamChange::redo() { void ParamChange::redo() {
engine::Module* module = APP->engine->getModule(moduleId); engine::Module* module = APP->engine->getModule(moduleId);
if (!module) if (!module)
return; return;
APP->engine->setParam(module, paramId, newValue);
APP->engine->setParamValue(module, paramId, newValue);
} }






Loading…
Cancel
Save