- 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 "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;
}