Move playhandle-adding to the correct spot so playhandles won't get delayed

This commit is contained in:
Vesa
2014-07-09 21:39:04 +03:00
parent e6582fcd17
commit cacb27d12f

View File

@@ -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<PlayHandleList>( m_playHandles );