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:
Hyunjin Song
2017-08-12 10:16:34 +09:00
committed by GitHub
parent 4d044439ab
commit 88cc58600c
2 changed files with 5 additions and 0 deletions

View File

@@ -121,6 +121,7 @@ private:
static LfoInstances * s_lfoInstances;
bool m_used;
QMutex m_paramMutex;
FloatModel m_predelayModel;
FloatModel m_attackModel;

View File

@@ -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