Merge pull request #2158 from Wallacoloo/EqFilterInit

Initialize all fields of EqFilter upon construction
This commit is contained in:
Dave
2015-07-11 22:50:35 +01:00

View File

@@ -38,7 +38,12 @@
class EqFilter : public StereoBiQuad
{
public:
EqFilter()
EqFilter() :
m_sampleRate(0),
m_freq(0),
m_res(0),
m_gain(0),
m_bw(0)
{
}
@@ -94,29 +99,18 @@ public:
virtual inline void setParameters( float sampleRate, float freq, float res, float gain )
{
bool hasChanged = false;
if( sampleRate != m_sampleRate )
bool hasChanged = ( sampleRate != m_sampleRate ||
freq != m_freq ||
res != m_res ||
gain != m_gain );
if ( hasChanged )
{
m_sampleRate = sampleRate;
hasChanged = true;
}
if ( freq != m_freq )
{
m_freq = freq;
hasChanged = true;
}
if ( res != m_res )
{
m_res = res;
hasChanged = true;
}
if ( gain != m_gain )
{
m_gain = gain;
hasChanged = true;
calcCoefficents();
}
if ( hasChanged ) { calcCoefficents(); }
}