Prevent the WASAPI code from trying to compile in linux/mac, and add a setting to enable exclusive mode selection from the settings (.ini only for now)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2756 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
gigaherz 2010-03-19 21:47:24 +00:00
parent 86dcb0a1a9
commit 3e6b6c86c1
1 changed files with 19 additions and 2 deletions

View File

@ -21,7 +21,10 @@
#include "Dialogs.h"
#include "portaudio/include/portaudio.h"
#ifdef __WIN32__
#include "portaudio/include/pa_win_wasapi.h"
#endif
#ifdef __LINUX__
int PaLinuxCallback( const void *inputBuffer, void *outputBuffer,
@ -42,6 +45,8 @@ private:
bool m_UseHardware;
bool m_WasapiExclusiveMode;
//////////////////////////////////////////////////////////////////////////////////////////
// Instance vars
@ -150,6 +155,9 @@ public:
if(deviceIndex>=0)
{
void* infoPtr = NULL;
#ifdef __WIN32__
PaWasapiStreamInfo info = {
sizeof(PaWasapiStreamInfo),
paWASAPI,
@ -157,6 +165,13 @@ public:
paWinWasapiExclusive
};
if((m_ApiId == paWASAPI) && m_WasapiExclusiveMode)
{
// Pass it the Exclusive mode enable flag
infoPtr = &info;
}
#endif
PaStreamParameters outParams = {
// PaDeviceIndex device;
@ -168,8 +183,7 @@ public:
2,
paInt32,
0, //?
NULL
//&info // Use this instead of the NULL above, to pass it the Exclusive mode enable flag
infoPtr
};
err = Pa_OpenStream(&stream,
@ -300,6 +314,7 @@ public:
if(api == L"WASAPI") m_ApiId = paWASAPI;
if(api == L"AudioScienceHPI") m_ApiId = paAudioScienceHPI;
m_WasapiExclusiveMode = CfgReadBool( L"PORTAUDIO", L"Wasapi_Exclusive_Mode", false);
}
void WriteSettings() const
@ -326,6 +341,8 @@ public:
CfgWriteStr( L"PORTAUDIO", L"HostApi", api);
CfgWriteStr( L"PORTAUDIO", L"Device", m_Device);
CfgWriteBool( L"PORTAUDIO", L"Wasapi_Exclusive_Mode", m_WasapiExclusiveMode);
}
} static PA;