From 82f2160a5e2edeb1f696ab028b2579bd891d1251 Mon Sep 17 00:00:00 2001 From: spacy51 Date: Wed, 3 Sep 2008 20:08:02 +0000 Subject: [PATCH] FIX: Do not use stereo to surround upmixing, when no matrix available. git-svn-id: https://svn.code.sf.net/p/vbam/code/trunk@692 a31d4220-a93d-0410-bf67-fe4944624d44 --- src/win32/XAudio2.cpp | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/win32/XAudio2.cpp b/src/win32/XAudio2.cpp index 3213a7b9..ca1ec086 100644 --- a/src/win32/XAudio2.cpp +++ b/src/win32/XAudio2.cpp @@ -230,6 +230,7 @@ bool XAudio2_Output::init() ASSERT( hr == S_OK ); float *matrix = NULL; matrix = (float*)malloc( sizeof( float ) * 2 * dd.OutputFormat.Format.nChannels ); + bool matrixAvailable = true; switch( dd.OutputFormat.Format.nChannels ) { case 4: // 4.0 //Speaker \ Left Source Right Source @@ -276,9 +277,14 @@ bool XAudio2_Output::init() /*Side L*/ matrix[12] = 1.0000f; matrix[13] = 0.0000f; /*Side R*/ matrix[14] = 0.0000f; matrix[15] = 1.0000f; break; + default: + matrixAvailable = false; + break; + } + if( matrixAvailable ) { + hr = sVoice->SetOutputMatrix( NULL, 2, dd.OutputFormat.Format.nChannels, matrix ); + ASSERT( hr == S_OK ); } - hr = sVoice->SetOutputMatrix( NULL, 2, dd.OutputFormat.Format.nChannels, matrix ); - ASSERT( hr == S_OK ); free( matrix ); matrix = NULL; }