stability fix

This commit is contained in:
Volker Fischer 2008-07-13 20:03:37 +00:00
parent 2ce29103c6
commit 94d6d451bc

View file

@ -83,10 +83,10 @@ bool CSound::Read ( CVector<short>& psData )
// check if device must be opened or reinitialized // check if device must be opened or reinitialized
if ( bChangParamIn ) if ( bChangParamIn )
{ {
// Reinit sound interface (init recording requires stereo buffer size) // reinit sound interface (init recording requires stereo buffer size)
InitRecordingAndPlayback ( iBufferSizeStereo ); InitRecordingAndPlayback ( iBufferSizeStereo );
// Reset flag // reset flag
bChangParamIn = false; bChangParamIn = false;
} }
@ -103,7 +103,7 @@ bool CSound::Read ( CVector<short>& psData )
} }
} }
// If the number of done buffers equals the total number of buffers, it is // if the number of done buffers equals the total number of buffers, it is
// very likely that a buffer got lost -> set error flag // very likely that a buffer got lost -> set error flag
bError = ( iInCurBlockToWrite == iCurNumSndBufIn ); bError = ( iInCurBlockToWrite == iCurNumSndBufIn );
@ -126,11 +126,11 @@ bool CSound::Read ( CVector<short>& psData )
// adjust "current block to write" pointer // adjust "current block to write" pointer
iInCurBlockToWrite--; iInCurBlockToWrite--;
}
ASIOMutex.unlock();
// in case more than one buffer was ready, reset event // in case more than one buffer was ready, reset event
ResetEvent ( m_ASIOEvent ); ResetEvent ( m_ASIOEvent );
}
ASIOMutex.unlock();
return bError; return bError;
} }
@ -628,8 +628,6 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
{ {
// TODO: buffer overrun, inform user somehow...? // TODO: buffer overrun, inform user somehow...?
} }
}
ASIOMutex.unlock();
// finally if the driver supports the ASIOOutputReady() optimization, // finally if the driver supports the ASIOOutputReady() optimization,
// do it here, all data are in place // do it here, all data are in place
@ -641,6 +639,8 @@ void CSound::bufferSwitch ( long index, ASIOBool processNow )
// set event // set event
SetEvent ( m_ASIOEvent ); SetEvent ( m_ASIOEvent );
} }
ASIOMutex.unlock();
}
long CSound::asioMessages ( long selector, long value, void* message, double* opt ) long CSound::asioMessages ( long selector, long value, void* message, double* opt )
{ {