Peak Controller: improve envelope calculation

This commit is contained in:
Vesa
2014-07-12 05:27:05 +03:00
parent d7f922da75
commit 6f8c910f5c
5 changed files with 67 additions and 60 deletions

View File

@@ -72,6 +72,7 @@ protected:
friend class PeakControllerDialog;
private:
float m_currentSample;
//backward compatibility for <= 0.4.15
static int m_getCount;
static int m_loadCount;

View File

@@ -200,4 +200,19 @@ static inline float dbvToAmp( float dbv )
}
//! returns 1.0f if val >= 0.0f, -1.0 else
static inline float sign( float val )
{
return val >= 0.0f ? 1.0f : -1.0f;
}
//! if val >= 0.0f, returns sqrtf(val), else: -sqrtf(-val)
static inline float sqrt_neg( float val )
{
return sqrtf( fabs( val ) ) * sign( val );
}
#endif