SPU2ghz: XAudio 2 crash fix attempt, take #341. Action! *clip*

git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@304 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
Jake.Stine 2008-11-05 16:14:55 +00:00 committed by Gregory Hainaut
parent 3968775bc6
commit 29bf736daa
1 changed files with 16 additions and 14 deletions

View File

@ -172,20 +172,18 @@ public:
void Close()
{
//
// Clean up
//
if( pSourceVoice != NULL )
{
pSourceVoice->FlushSourceBuffers();
//pSourceVoice->Stop( 0 );
Sleep(10); // give the engine some time to flush voices
pSourceVoice->DestroyVoice();
voiceContext.sndout = NULL;
voiceContext.pSourceVoice = NULL;
pSourceVoice = NULL;
}
// Clean up?
// Apparently XA2 would just rather we NOT clean up...
Sleep(10); // give the engine some more time, because I don't trust it.
/*if( pSourceVoice != NULL )
{
//pSourceVoice->FlushSourceBuffers();
//pSourceVoice->Stop( 0 );
//Sleep(10); // give the engine some time to flush voices
//pSourceVoice->DestroyVoice();
}*/
//Sleep(10); // give the engine some more time, because I don't trust it.
//
// Cleanup XAudio2
@ -196,11 +194,15 @@ public:
if( pMasteringVoice != NULL )
pMasteringVoice->DestroyVoice();
pMasteringVoice = NULL;
SAFE_RELEASE( pXAudio2 );
SAFE_DELETE_ARRAY( qbuffer );
pMasteringVoice = NULL;
voiceContext.sndout = NULL;
voiceContext.pSourceVoice = NULL;
pSourceVoice = NULL;
CoUninitialize();
}