MCPcopy Create free account
hub / github.com/LMMS/lmms / logToLinearScale

Function logToLinearScale

include/lmms_math.h:214–225  ·  view source on GitHub ↗

@brief Scales @value from linear to logarithmic. Value should be within [0,1]

Source from the content-addressed store, hash-verified

212//! @brief Scales @value from linear to logarithmic.
213//! Value should be within [0,1]
214static inline float logToLinearScale( float min, float max, float value )
215{
216 if( min < 0 )
217 {
218 const float mmax = qMax( qAbs( min ), qAbs( max ) );
219 const float val = value * ( max - min ) + min;
220 float result = signedPowf( val / mmax, F_E ) * mmax;
221 return isnan( result ) ? 0 : result;
222 }
223 float result = powf( value, F_E ) * ( max - min ) + min;
224 return isnan( result ) ? 0 : result;
225}
226
227
228//! @brief Scales value from logarithmic to linear. Value should be in min-max range.

Callers 3

logToLinearScaleMethod · 0.85
controllerValueMethod · 0.85
valueBufferMethod · 0.85

Calls 1

signedPowfFunction · 0.85

Tested by

no test coverage detected