diff --git a/plugins/monstro/Monstro.cpp b/plugins/monstro/Monstro.cpp index 1d0d25812..dc5161959 100644 --- a/plugins/monstro/Monstro.cpp +++ b/plugins/monstro/Monstro.cpp @@ -817,18 +817,11 @@ inline void MonstroSynth::updateModulators( float * env1, float * env2, float * } -inline sample_t MonstroSynth::calcSlope1( sample_t s ) +inline sample_t MonstroSynth::calcSlope( int slope, sample_t s ) { - if( m_parent->m_slope1 == 1.0f ) return s; + if( m_parent->m_slope[slope] == 1.0f ) return s; if( s == 0.0f ) return s; - return fastPow( s, m_parent->m_slope1 ); -} - -inline sample_t MonstroSynth::calcSlope2( sample_t s ) -{ - if( m_parent->m_slope2 == 1.0f ) return s; - if( s == 0.0f ) return s; - return fastPow( s, m_parent->m_slope2 ); + return fastPow( s, m_parent->m_slope[slope] ); } @@ -1439,14 +1432,14 @@ void MonstroInstrument::updateSamplerate() void MonstroInstrument::updateSlope1() { const float slope = m_env1Slope.value(); - m_slope1 = exp10f( slope * -1.0f ); + m_slope[0] = exp10f( slope * -1.0f ); } void MonstroInstrument::updateSlope2() { const float slope = m_env2Slope.value(); - m_slope2 = exp10f( slope * -1.0f ); + m_slope[1] = exp10f( slope * -1.0f ); } diff --git a/plugins/monstro/Monstro.h b/plugins/monstro/Monstro.h index 478e25956..197efb911 100644 --- a/plugins/monstro/Monstro.h +++ b/plugins/monstro/Monstro.h @@ -177,10 +177,7 @@ private: return s1 + ( s2 - s1 ) * x; }*/ // using interpolation.h from now on - inline sample_t calcSlope1( sample_t s ); - - inline sample_t calcSlope2( sample_t s ); - + inline sample_t calcSlope( int slope, sample_t s ); // checks for lower bound for phase, upper bound is already checked by oscillator-functions in both // oscillator.h and bandlimitedwave.h so we save some cpu by only checking lower bound @@ -411,8 +408,7 @@ protected: f_cnt_t m_env1_relF; f_cnt_t m_env2_relF; - float m_slope1; - float m_slope2; + float m_slope [2]; f_cnt_t m_lfo1_att; f_cnt_t m_lfo2_att;