From ea7c96fa710f930f91b065a7d3f35f962ab40677 Mon Sep 17 00:00:00 2001 From: Colin Wallace Date: Sat, 4 Jul 2015 01:33:33 +0000 Subject: [PATCH] less repetitive setParameters logic --- plugins/Eq/EqFilter.h | 25 +++++++------------------ 1 file changed, 7 insertions(+), 18 deletions(-) diff --git a/plugins/Eq/EqFilter.h b/plugins/Eq/EqFilter.h index 364f2ba4b..b970d7fa5 100644 --- a/plugins/Eq/EqFilter.h +++ b/plugins/Eq/EqFilter.h @@ -38,7 +38,7 @@ class EqFilter : public StereoBiQuad { public: - EqFilter() : + EqFilter() : m_sampleRate(0), m_freq(0), m_res(0), @@ -99,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(); } }