From decf1da7638fe97f8f48b77e5ee3b46bc9785db4 Mon Sep 17 00:00:00 2001 From: gigaherz Date: Wed, 6 Oct 2010 00:34:02 +0000 Subject: [PATCH] SPU2-X: - Use the cross-platform mbstowcs() function to convert from ansi/ascii/multibyte/utf8 (whatever) to widechar instead of MultiByteToWideChar. Allows linux people to configure the portaudio device in the .ini. - Set the requested portaudio latency to 0.2f (200ms) instead of 0, since apparently it's bad to request 0, and 200ms is a sensible(ish) default. - Comment out the call to Pa_Terminate on Close, since it causes issues when re-initializing later. Preferably, we should add some Init() + Shutdown()/Terminate() functions to the output module system to allow for one-time initialization and termination, but this will have to do for now. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3880 96395faa-99c1-11dd-bbfe-3dabce05a288 --- plugins/spu2-x/src/SndOut_Portaudio.cpp | 20 ++++++++------------ 1 file changed, 8 insertions(+), 12 deletions(-) diff --git a/plugins/spu2-x/src/SndOut_Portaudio.cpp b/plugins/spu2-x/src/SndOut_Portaudio.cpp index 50d8b5bdad..dd69f988af 100644 --- a/plugins/spu2-x/src/SndOut_Portaudio.cpp +++ b/plugins/spu2-x/src/SndOut_Portaudio.cpp @@ -22,6 +22,8 @@ #include "portaudio.h" +#include "wchar.h" + #ifdef __WIN32__ #include "pa_win_wasapi.h" #endif @@ -120,16 +122,9 @@ public: if(apiinfo->type == m_ApiId) { -#ifdef __WIN32__ static wchar_t buffer [1000]; - MultiByteToWideChar(CP_UTF8,0,info->name,strlen(info->name),buffer,999); + mbstowcs(buffer,info->name,1000); buffer[999]=0; -#else -//# error TODO - static wchar_t buffer [1000]; - //MultiByteToWideChar(CP_UTF8,0,info->name,strlen(info->name),buffer,999); - buffer[999]=0; -#endif if(m_Device == buffer) { @@ -182,7 +177,7 @@ public: deviceIndex, 2, paInt32, - 0, //? + 0.2f, infoPtr }; @@ -250,9 +245,10 @@ public: stream=NULL; } - PaError err = Pa_Terminate(); - if( err != paNoError ) - fprintf(stderr,"* SPU2-X: PortAudio error: %s\n", Pa_GetErrorText( err ) ); + // Seems to do more harm than good. + //PaError err = Pa_Terminate(); + //if( err != paNoError ) + // fprintf(stderr,"* SPU2-X: PortAudio error: %s\n", Pa_GetErrorText( err ) ); started=false; }