Merge pull request #913 from LMMS/stable-1.1

Syncing...
This commit is contained in:
Vesa V
2014-06-30 12:49:02 +03:00
8 changed files with 976 additions and 949 deletions

View File

@@ -23,11 +23,10 @@
*/
#ifndef _DSP_EFFECT_LIBRARY_H
#define _DSP_EFFECT_LIBRARY_H
#include <math.h>
#ifndef DSP_EFFECT_LIBRARY_H
#define DSP_EFFECT_LIBRARY_H
#include "lmms_math.h"
#include "templates.h"
#include "lmms_constants.h"
#include "lmms_basics.h"
@@ -213,8 +212,7 @@ namespace DspEffectLibrary
{
// TODO: somehow remove these horrible aliases...
m_cap = ( _in + m_cap*m_frequency ) * m_gain1;
return( /*saturate<sample_t>(*/ ( _in + m_cap*m_ratio ) *
m_gain2/* )*/ );
return( ( _in + m_cap*m_ratio ) * m_gain2 );
}
void setFrequency( const sample_t _frequency )
@@ -335,10 +333,10 @@ namespace DspEffectLibrary
void nextSample( sample_t& inLeft, sample_t& inRight )
{
const float toRad = 3.141592 / 180;
inLeft += inRight * sinf( m_wideCoeff * .5 * toRad);
inRight -= inLeft * sinf( m_wideCoeff * .5 * toRad);
const float toRad = F_PI / 180;
const sample_t tmp = inLeft;
inLeft += inRight * sinf( m_wideCoeff * ( .5 * toRad ) );
inRight -= tmp * sinf( m_wideCoeff * ( .5 * toRad ) );
}
private:

View File

@@ -28,6 +28,7 @@
#include <stdint.h>
#include "lmms_constants.h"
#include <QtCore/QtGlobal>
#include <math.h>
@@ -164,4 +165,29 @@ static inline float linearToLogScale( float min, float max, float value )
return powf( val, EXP ) * ( max - min ) + min;
}
//! @brief Converts linear amplitude (0-1.0) to dBV scale.
//! @param amp Linear amplitude, where 1.0 = 0dBV.
//! @return Amplitude in dBV. -inf for 0 amplitude.
static inline float ampToDbv( float amp )
{
return amp == 0.0f
? -INFINITY
: log10f( amp ) * 20.0f;
}
//! @brief Converts dBV-scale to linear amplitude with 0dBV = 1.0
//! @param dbv The dBV value to convert: all infinites are treated as -inf and result in 0
//! @return Linear amplitude
static inline float dbvToAmp( float dbv )
{
return isinff( dbv )
? 0.0f
: powf( 10.0f, dbv * 0.05f );
}
#endif