From 21f19f018b5afe555954f40b3dc5cf7dea6bf872 Mon Sep 17 00:00:00 2001 From: Paul Giblock Date: Mon, 9 Feb 2009 08:45:25 +0000 Subject: [PATCH] Fix off-by-one enum on new RC filters git-svn-id: https://lmms.svn.sf.net/svnroot/lmms/trunk/lmms@2012 0778d3d1-df1d-0410-868b-ea421aaaa00d (cherry picked from commit a48b0b6ce05fffb9afb2cf153579f6295ac51b0c) --- include/basic_filters.h | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/include/basic_filters.h b/include/basic_filters.h index 1e28b9cef..64d10ca86 100644 --- a/include/basic_filters.h +++ b/include/basic_filters.h @@ -56,6 +56,7 @@ public: Notch, AllPass, Moog, + DoubleLowPass, Lowpass_RC, Bandpass_RC, Highpass_RC, @@ -74,14 +75,16 @@ public: inline void setFilterType( const int _idx ) { - m_doubleFilter = _idx >= NumFilters; + m_doubleFilter = _idx == DoubleLowPass; if( !m_doubleFilter ) { m_type = static_cast( _idx ); return; } - m_type = static_cast( LowPass + _idx - - NumFilters ); + + // Double lowpass mode, backwards-compat for the goofy + // Add-NumFilters to signify doubleFilter stuff + m_type = static_cast( LowPass ); if( m_subFilter == NULL ) { m_subFilter = new basicFilters( @@ -127,7 +130,7 @@ public: m_oldy2[_chnl] = m_oldy3[_chnl] = 0.0f; // reset in/out historey for RC-filter - m_rclp[_chnl] = m_rchp[_chnl] = m_rcbp[_chnl] = m_rclast[_chnl] = 0.0f; + m_rclp[_chnl] = m_rcbp[_chnl] = m_rchp[_chnl] = m_rclast[_chnl] = 0.0f; } } @@ -373,7 +376,7 @@ private: frame m_y1, m_y2, m_y3, m_y4, m_oldx, m_oldy1, m_oldy2, m_oldy3; // in/out history for RC-type-filters - frame m_rclp, m_rchp, m_rcbp, m_rclast; + frame m_rcbp, m_rclp, m_rchp, m_rclast; FilterTypes m_type; bool m_doubleFilter;