From c0932bd75e0311ee847e46ec1f31848b709028d5 Mon Sep 17 00:00:00 2001 From: Vesa Date: Thu, 15 Jan 2015 17:14:50 +0200 Subject: [PATCH] Fix monstro slopes properly --- plugins/monstro/Monstro.cpp | 24 ++++-------------------- plugins/monstro/Monstro.h | 3 +-- 2 files changed, 5 insertions(+), 22 deletions(-) diff --git a/plugins/monstro/Monstro.cpp b/plugins/monstro/Monstro.cpp index a521bb286..1ef89c16b 100644 --- a/plugins/monstro/Monstro.cpp +++ b/plugins/monstro/Monstro.cpp @@ -819,25 +819,9 @@ inline void MonstroSynth::updateModulators( float * env1, float * env2, float * inline sample_t MonstroSynth::calcSlope( int slope, sample_t s ) { - if(slope==0) - { - if( m_parent->m_slope1 == 1.0f ) return s; - if( s == 0.0f ) return s; - return fastPow( s, m_parent->m_slope1 ); - } - else if(slope==1) - { - if( m_parent->m_slope2 == 1.0f ) return s; - if( s == 0.0f ) return s; - return fastPow( s, m_parent->m_slope2 ); - } -} - -inline sample_t MonstroSynth::calcSlope2( sample_t s ) -{ - if( m_parent->m_slope2 == 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_slope2 ); + return fastPow( s, m_parent->m_slope[slope] ); } @@ -1449,14 +1433,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 769271f48..7061551be 100644 --- a/plugins/monstro/Monstro.h +++ b/plugins/monstro/Monstro.h @@ -409,8 +409,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;