diff --git a/include/EnvelopeAndLfoParameters.h b/include/EnvelopeAndLfoParameters.h index 4bafbde4b..747bb94c2 100644 --- a/include/EnvelopeAndLfoParameters.h +++ b/include/EnvelopeAndLfoParameters.h @@ -121,6 +121,7 @@ private: static LfoInstances * s_lfoInstances; bool m_used; + QMutex m_paramMutex; FloatModel m_predelayModel; FloatModel m_attackModel; diff --git a/src/core/EnvelopeAndLfoParameters.cpp b/src/core/EnvelopeAndLfoParameters.cpp index d044f98f3..d1fbaeb03 100644 --- a/src/core/EnvelopeAndLfoParameters.cpp +++ b/src/core/EnvelopeAndLfoParameters.cpp @@ -291,6 +291,8 @@ void EnvelopeAndLfoParameters::fillLevel( float * _buf, f_cnt_t _frame, const f_cnt_t _release_begin, const fpp_t _frames ) { + QMutexLocker m(&m_paramMutex); + if( _frame < 0 || _release_begin < 0 ) { return; @@ -402,6 +404,8 @@ void EnvelopeAndLfoParameters::loadSettings( const QDomElement & _this ) void EnvelopeAndLfoParameters::updateSampleVars() { + QMutexLocker m(&m_paramMutex); + const float frames_per_env_seg = SECS_PER_ENV_SEGMENT * Engine::mixer()->processingSampleRate(); // TODO: Remove the expKnobVals, time should be linear