zynaddsubfx

ZynAddSubFX open source synthesizer
Log | Files | Refs | Submodules | LICENSE

commit ddb58c9edee226bb9b76451ffbab61aa12aeee93
parent e5b543aa4d684d01f452268b90475073aa9ce8a2
Author: Johannes Lorenz <johannes89@ist-einmalig.de>
Date:   Thu, 21 Jul 2016 18:21:31 +0200

Fix floats rounded unfairly to integer.

Diffstat:
Msrc/Params/EnvelopeParams.cpp | 7+++++--
1 file changed, 5 insertions(+), 2 deletions(-)

diff --git a/src/Params/EnvelopeParams.cpp b/src/Params/EnvelopeParams.cpp @@ -377,7 +377,7 @@ struct version_fixer_t { const bool mismatch; public: - int operator()(int input) + int operator()(int input) const { return (mismatch) // The errors occured when calling env_dB2rap. Let f be the @@ -385,7 +385,10 @@ public: // load values with (let "o" be the function composition symbol): // f^{-1} o (env_dB2rap^{-1}) o dB2rap o f // from the xml file. This results in the following formula: - ? 127.0f * (0.5f * log10f( 0.01f + 0.99f * powf(100, input/127.0f - 1)) + 1) + ? roundf(127.0f * (0.5f * + log10f( 0.01f + 0.99f * + powf(100, input/127.0f - 1)) + + 1)) : input; } version_fixer_t(const version_type& fileversion, int env_mode) :