diff options
| author | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2021-07-19 20:46:56 +0300 |
|---|---|---|
| committer | Vasile Vilvoiu <vasi@vilvoiu.ro> | 2021-07-19 20:46:56 +0300 |
| commit | 5a3eb9f10863abeea248adb2acf5df44a2b0a048 (patch) | |
| tree | 26b6675ca93085801ef1f318ebd8efb5fcba261c /src/value-map.cpp | |
| parent | 78225142a8b3c0f95090b089eef32c244ed03551 (diff) | |
Move normalization from ValueMap to FFT class.
Diffstat (limited to 'src/value-map.cpp')
| -rw-r--r-- | src/value-map.cpp | 5 |
1 files changed, 2 insertions, 3 deletions
diff --git a/src/value-map.cpp b/src/value-map.cpp index 2627ed3..51e3944 100644 --- a/src/value-map.cpp +++ b/src/value-map.cpp @@ -49,7 +49,7 @@ RealWindow LinearValueMap::Map(const RealWindow &input) RealWindow output(n); for (unsigned int i = 0; i < n; i ++) { - output[i] = std::clamp<double>(input[i] / n, this->lower_, this->upper_); + output[i] = std::clamp<double>(input[i], this->lower_, this->upper_); output[i] = (output[i] - this->lower_) / (this->upper_ - this->lower_); } @@ -67,7 +67,7 @@ RealWindow DecibelValueMap::Map(const RealWindow &input) RealWindow output(n); for (unsigned int i = 0; i < n; i ++) { - output[i] = 20.0 * std::log10(input[i] / n); + output[i] = 20.0 * std::log10(input[i]); output[i] = std::clamp<double>(output[i], this->lower_, this->upper_); output[i] = (output[i] - this->lower_) / (this->upper_ - this->lower_); } @@ -79,4 +79,3 @@ std::string DecibelValueMap::GetUnit() const { return "dB" + unit_; } - |
