Fix producing of NaN from Env/LFO parameter change while playing (#3761)
Guarantee thread safety to ensure fillLevel() not to read value from wrong buffer address.
This commit is contained in:
@@ -121,6 +121,7 @@ private:
|
||||
static LfoInstances * s_lfoInstances;
|
||||
bool m_used;
|
||||
|
||||
QMutex m_paramMutex;
|
||||
|
||||
FloatModel m_predelayModel;
|
||||
FloatModel m_attackModel;
|
||||
|
||||
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user