From 29bf736daaa94db9c22353647f06c12b1112cb21 Mon Sep 17 00:00:00 2001 From: "Jake.Stine" Date: Wed, 5 Nov 2008 16:14:55 +0000 Subject: [PATCH] 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 --- plugins/spu2ghz/xaudio2out.cpp | 30 ++++++++++++++++-------------- 1 file changed, 16 insertions(+), 14 deletions(-) diff --git a/plugins/spu2ghz/xaudio2out.cpp b/plugins/spu2ghz/xaudio2out.cpp index 41685ba133..9b808ab454 100644 --- a/plugins/spu2ghz/xaudio2out.cpp +++ b/plugins/spu2ghz/xaudio2out.cpp @@ -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(); }