KrossX3 coded user selectable audio expansion (Still Xaudio2 only) support.
Since the automatic detection fails on some systems, this is the next best option.

Tested and works as expected. Thanks a bunch, KrossX3 ;)

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@3041 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2010-05-18 15:26:16 +00:00
parent 56175a7b26
commit 951e1ec90e
7 changed files with 31 additions and 17 deletions

View File

@ -63,6 +63,7 @@ extern wchar_t RegDumpFileName[255];
extern int Interpolation;
extern int ReverbBoost;
extern int numSpeakers;
extern bool EffectsDisabled;
extern u32 OutputModule;
@ -75,7 +76,6 @@ extern wchar_t dspPlugin[];
extern int dspPluginModule;
extern bool dspPluginEnabled;
extern bool StereoExpansionEnabled;
#endif
namespace SoundtouchCfg

View File

@ -80,7 +80,6 @@ extern int dspPluginModule;
extern bool dspPluginEnabled;
extern bool timeStretchEnabled;
extern bool asyncMixingEnabled;
extern bool StereoExpansionEnabled;
namespace SoundtouchCfg
{

View File

@ -53,7 +53,7 @@ bool dspPluginEnabled = false;
int dspPluginModule = 0;
wchar_t dspPlugin[256];
bool StereoExpansionEnabled = false;
int numSpeakers = 0;
/*****************************************************************************/
@ -66,7 +66,7 @@ void ReadSettings()
asyncMixingEnabled = CfgReadBool( L"OUTPUT", L"Enable_AsyncMixing", false );
EffectsDisabled = CfgReadBool( L"MIXING", L"Disable_Effects", false );
StereoExpansionEnabled = CfgReadBool( L"OUTPUT", L"Enable_StereoExpansion", false );
numSpeakers = CfgReadInt( L"OUTPUT", L"XAudio2_SpeakerConfiguration", 0);
SndOutLatencyMS = CfgReadInt(L"OUTPUT",L"Latency", 150);
wchar_t omodid[128];
@ -115,7 +115,7 @@ void WriteSettings()
CfgWriteInt(L"OUTPUT",L"Latency", SndOutLatencyMS);
CfgWriteBool(L"OUTPUT",L"Enable_Timestretch", timeStretchEnabled);
CfgWriteBool(L"OUTPUT",L"Enable_AsyncMixing", asyncMixingEnabled);
CfgWriteBool(L"OUTPUT",L"Enable_StereoExpansion", StereoExpansionEnabled);
CfgWriteInt(L"OUTPUT",L"XAudio2_SpeakerConfiguration", numSpeakers);
if( Config_WaveOut.Device.empty() ) Config_WaveOut.Device = L"default";
CfgWriteStr(L"WAVEOUT",L"Device",Config_WaveOut.Device);
@ -157,6 +157,13 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
SendDialogMsg( hWnd, IDC_REVERB_BOOST, CB_ADDSTRING,0,(LPARAM) L"4X - Reverb Volume * 4" );
SendDialogMsg( hWnd, IDC_REVERB_BOOST, CB_ADDSTRING,0,(LPARAM) L"8X - Reverb Volume * 8" );
SendDialogMsg( hWnd, IDC_REVERB_BOOST, CB_SETCURSEL,ReverbBoost,0 );
SendDialogMsg( hWnd, IDC_SPEAKERS, CB_RESETCONTENT,0,0 );
SendDialogMsg( hWnd, IDC_SPEAKERS, CB_ADDSTRING,0,(LPARAM) L"Stereo (none, default)" );
SendDialogMsg( hWnd, IDC_SPEAKERS, CB_ADDSTRING,0,(LPARAM) L"Quadrafonic" );
SendDialogMsg( hWnd, IDC_SPEAKERS, CB_ADDSTRING,0,(LPARAM) L"Surround 5.1" );
SendDialogMsg( hWnd, IDC_SPEAKERS, CB_ADDSTRING,0,(LPARAM) L"Surround 7.1" );
SendDialogMsg( hWnd, IDC_SPEAKERS, CB_SETCURSEL,numSpeakers,0 );
SendDialogMsg( hWnd, IDC_OUTPUT, CB_RESETCONTENT,0,0 );
@ -181,7 +188,6 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
EnableWindow( GetDlgItem( hWnd, IDC_OPEN_CONFIG_DEBUG ), DebugEnabled );
SET_CHECK(IDC_EFFECTS_DISABLE, EffectsDisabled);
SET_CHECK(IDC_EXPANSION_ENABLE,StereoExpansionEnabled);
SET_CHECK(IDC_TS_ENABLE, timeStretchEnabled);
SET_CHECK(IDC_DEBUG_ENABLE, DebugEnabled);
SET_CHECK(IDC_DSP_ENABLE, dspPluginEnabled);
@ -202,7 +208,8 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
Interpolation = (int)SendDialogMsg( hWnd, IDC_INTERPOLATE, CB_GETCURSEL,0,0 );
ReverbBoost = (int)SendDialogMsg( hWnd, IDC_REVERB_BOOST, CB_GETCURSEL,0,0 );
OutputModule = (int)SendDialogMsg( hWnd, IDC_OUTPUT, CB_GETCURSEL,0,0 );
OutputModule = (int)SendDialogMsg( hWnd, IDC_OUTPUT, CB_GETCURSEL,0,0 );
numSpeakers = (int)SendDialogMsg( hWnd, IDC_SPEAKERS, CB_GETCURSEL,0,0 );
WriteSettings();
EndDialog(hWnd,0);
@ -238,7 +245,6 @@ BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
HANDLE_CHECK(IDC_EFFECTS_DISABLE,EffectsDisabled);
HANDLE_CHECK(IDC_DSP_ENABLE,dspPluginEnabled);
HANDLE_CHECK(IDC_EXPANSION_ENABLE,StereoExpansionEnabled);
HANDLE_CHECKNB(IDC_TS_ENABLE,timeStretchEnabled);
EnableWindow( GetDlgItem( hWnd, IDC_OPEN_CONFIG_SOUNDTOUCH ), timeStretchEnabled );
break;

View File

@ -265,11 +265,19 @@ public:
XAUDIO2_DEVICE_DETAILS deviceDetails;
pXAudio2->GetDeviceDetails( 0, &deviceDetails );
// Defaults to Stereo
int speakers = 2;
// nChannels gives the current Windows' Speaker setup (6 if 5.1)
if( StereoExpansionEnabled )
speakers = deviceDetails.OutputFormat.Format.nChannels;
// Stereo Expansion was planned to grab the currently configured number of
// Speakers from Windows's audio config.
// This doesn't always work though, so let it be a user configurable option.
int speakers;
switch(numSpeakers) // speakers = (numSpeakers + 1) *2; ?
{
case 0: speakers = 2; break; // Stereo
case 1: speakers = 4; break; // Quadrafonic
case 2: speakers = 6; break; // Surround 5.1
case 3: speakers = 8; break; // Surround 7.1
default: speakers = 2;
}
// Any windows driver should support stereo at the software level, I should think!
jASSUME( deviceDetails.OutputFormat.Format.nChannels > 1 );

View File

@ -95,7 +95,7 @@ public:
#if 0
int speakerConfig;
if( StereoExpansionEnabled )
//if( StereoExpansionEnabled )
speakerConfig = 2; // better not mess with this in wavout :p (rama)
// Any windows driver should support stereo at the software level, I should think!

View File

@ -73,8 +73,9 @@ BEGIN
PUSHBUTTON "Configure Debug Options...",IDC_OPEN_CONFIG_DEBUG,14,167,108,14
CHECKBOX "Enable Debug Options",IDC_DEBUG_ENABLE,14,153,104,10,NOT WS_TABSTOP
GROUPBOX "",IDC_STATIC,6,143,129,46
CONTROL "Enable Audio Expansion",IDC_EXPANSION_ENABLE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,150,152,135,10
LTEXT "Audio expansion to 5.1. Currently for XAudio2 only. WIP.",IDC_STATIC,162,164,146,44
LTEXT "Audio Expansion Mode:",IDC_STATIC,161,152,135,9,NOT WS_GROUP
COMBOBOX IDC_SPEAKERS,163,161,135,84,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "WIP - XAudio2 Only",IDC_STATIC,161,180,135,9,NOT WS_GROUP
COMBOBOX IDC_REVERB_BOOST,14,99,114,84,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
LTEXT "Reverb Boost Factor",IDC_STATIC,12,88,75,10,NOT WS_GROUP
END

View File

@ -25,6 +25,7 @@
#define IDC_REVERB_BOOST 1012
#define IDC_OUTPUT 1013
#define IDC_BUFFERS_SLIDER 1014
#define IDC_SPEAKERS 1015
#define IDC_MSGKEY 1020
#define IDC_MSGDMA 1021
#define IDC_MSGADMA 1022
@ -44,7 +45,6 @@
#define IDC_OVERLAP_SLIDER 1045
#define IDC_MSG_PUBLIC_BUILD 1048
#define IDC_XA2_TRIBLE_BUFFER 1050
#define IDC_EXPANSION_ENABLE 1051
#define IDC_LABEL_VERSION_INFO 1054
#define IDC_LINK_WEBSITE 1055
#define IDC_LINK_GOOGLECODE 1056