- 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
This commit is contained in:
gigaherz 2010-10-06 00:34:02 +00:00
parent d61d46bd7b
commit decf1da763
1 changed files with 8 additions and 12 deletions

View File

@ -22,6 +22,8 @@
#include "portaudio.h" #include "portaudio.h"
#include "wchar.h"
#ifdef __WIN32__ #ifdef __WIN32__
#include "pa_win_wasapi.h" #include "pa_win_wasapi.h"
#endif #endif
@ -120,16 +122,9 @@ public:
if(apiinfo->type == m_ApiId) if(apiinfo->type == m_ApiId)
{ {
#ifdef __WIN32__
static wchar_t buffer [1000]; static wchar_t buffer [1000];
MultiByteToWideChar(CP_UTF8,0,info->name,strlen(info->name),buffer,999); mbstowcs(buffer,info->name,1000);
buffer[999]=0; 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) if(m_Device == buffer)
{ {
@ -182,7 +177,7 @@ public:
deviceIndex, deviceIndex,
2, 2,
paInt32, paInt32,
0, //? 0.2f,
infoPtr infoPtr
}; };
@ -250,9 +245,10 @@ public:
stream=NULL; stream=NULL;
} }
PaError err = Pa_Terminate(); // Seems to do more harm than good.
if( err != paNoError ) //PaError err = Pa_Terminate();
fprintf(stderr,"* SPU2-X: PortAudio error: %s\n", Pa_GetErrorText( err ) ); //if( err != paNoError )
// fprintf(stderr,"* SPU2-X: PortAudio error: %s\n", Pa_GetErrorText( err ) );
started=false; started=false;
} }