From 3634059dcd924401ad8456c8db526c6eb0bee1db Mon Sep 17 00:00:00 2001 From: Andrew Belt Date: Wed, 20 Feb 2019 06:19:18 -0500 Subject: [PATCH] Revise Param documentation. Fix Param::getDisplayValue() formula for logarithmic bases. --- include/engine/Param.hpp | 5 ++--- src/app/ParamQuantity.cpp | 2 +- 2 files changed, 3 insertions(+), 4 deletions(-) diff --git a/include/engine/Param.hpp b/include/engine/Param.hpp index abddd1e8..b7d50bc8 100644 --- a/include/engine/Param.hpp +++ b/include/engine/Param.hpp @@ -37,11 +37,10 @@ struct Param { */ std::string label; /** The numerical unit of measurement appended to the value. - Use a space before non-abbreviations to separate the numerical value. - e.g. " semitones", "Hz", "%", "V" + Use a space before units to separate the numerical value from the number (e.g. " semitones", " Hz", " V"), unless the unit should have no space (e.g. "%", "ยบ"). */ std::string unit; - /** Set to 0 for linear, nonzero for exponential. */ + /** Set to 0 for linear, positive for exponential, negative for logarithmic. */ float displayBase = 0.f; float displayMultiplier = 1.f; float displayOffset = 0.f; diff --git a/src/app/ParamQuantity.cpp b/src/app/ParamQuantity.cpp index a59f1661..026383b6 100644 --- a/src/app/ParamQuantity.cpp +++ b/src/app/ParamQuantity.cpp @@ -85,7 +85,7 @@ void ParamQuantity::setDisplayValue(float displayValue) { } else if (displayBase < 0.f) { // Logarithmic - v = std::pow(displayBase, v); + v = std::pow(-displayBase, v); } else { // Exponential