diff --git a/src/core/Mixer.cpp b/src/core/Mixer.cpp index 4e53e8388..bd97cf9a2 100644 --- a/src/core/Mixer.cpp +++ b/src/core/Mixer.cpp @@ -337,15 +337,9 @@ const surroundSampleFrame * Mixer::renderNextBuffer() m_inputBufferFrames[ m_inputBufferWrite ] = 0; unlockInputFrames(); - // now we have to make sure no other thread does anything bad // while we're acting... lock(); - // add all play-handles that have to be added - m_playHandleMutex.lock(); - m_playHandles += m_newPlayHandles; - m_newPlayHandles.clear(); - m_playHandleMutex.unlock(); // remove all play-handles that have to be deleted and delete // them if they still exist... @@ -380,6 +374,11 @@ const surroundSampleFrame * Mixer::renderNextBuffer() // create play-handles for new notes, samples etc. engine::getSong()->processNextBuffer(); + // add all play-handles that have to be added + m_playHandleMutex.lock(); + m_playHandles += m_newPlayHandles; + m_newPlayHandles.clear(); + m_playHandleMutex.unlock(); // STAGE 1: run and render all play handles MixerWorkerThread::fillJobQueue( m_playHandles );