mirror of https://github.com/PCSX2/pcsx2.git
SPU2-X: Trying a new (experimental) DMA option which may fix problems in DMC1, but might break more than it fixes? (we'll find out!)
Also - Added some options to DSound driver. Enabling Hardware mode on dsound might improve dsound compat on some soundcard drivers, for those who can't use XA2 or have problems with XA2 stability. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@619 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
5b09d81f36
commit
1feb143b2b
|
@ -243,45 +243,6 @@ void DoDMAWrite(int core,u16 *pMem,u32 size)
|
|||
cacheLine++;
|
||||
} while ( cacheLine != &cacheEnd );
|
||||
|
||||
#if 0
|
||||
// Pcm Cache Invalidation!
|
||||
// It's a requirement that we mask bits for the blocks that are written to *only*,
|
||||
// because doing anything else can cause the cache to fail, thanks to the progressive
|
||||
// nature of the SPU2's ADPCM encoding. (the same thing that makes it impossible
|
||||
// to use SSE optimizations on it).
|
||||
|
||||
u8* cache = (u8*)pcm_cache_flags;
|
||||
|
||||
// Step 1: Clear bits in the front remainder.
|
||||
|
||||
const int pcmTSA = Cores[core].TSA / pcm_WordsPerBlock;
|
||||
const int pcmTDA = buff1end / pcm_WordsPerBlock;
|
||||
const int remFront = pcmTSA & 31;
|
||||
const int remBack = ((buff1end+pcm_WordsPerBlock-1)/pcm_WordsPerBlock) & 31; // round up to get the end remainder
|
||||
|
||||
int flagTSA = pcmTSA / 32;
|
||||
|
||||
if( remFront )
|
||||
{
|
||||
// need to clear some upper bits of this u32
|
||||
uint mask = (1ul<<remFront)-1;
|
||||
cache[flagTSA++] &= mask;
|
||||
}
|
||||
|
||||
// Step 2: Clear the middle run
|
||||
const int flagClearLen = pcmTDA-pcmTSA;
|
||||
memset( &cache[flagTSA], 0, flagClearLen );
|
||||
|
||||
// Step 3: Clear bits in the end remainder.
|
||||
|
||||
if( remBack )
|
||||
{
|
||||
// need to clear some lower bits in this u32
|
||||
uint mask = ~(1ul<<remBack)-1;
|
||||
cache[flagTSA + flagClearLen] &= mask;
|
||||
}
|
||||
#endif
|
||||
|
||||
//ConLog( " * SPU2 : Cache Clear Range! TSA=0x%x, TDA=0x%x (low8=0x%x, high8=0x%x, len=0x%x)\n",
|
||||
// Cores[core].TSA, buff1end, flagTSA, flagTDA, clearLen );
|
||||
|
||||
|
@ -363,6 +324,10 @@ void SPU2readDMA(int core, u16* pMem, u32 size)
|
|||
const u32 buff1size = (buff1end-Cores[core].TSA);
|
||||
memcpy( pMem, GetMemPtr( Cores[core].TSA ), buff1size*2 );
|
||||
|
||||
// Note on TSA's position after our copy finishes:
|
||||
// IRQA should be measured by the end of the writepos+0x20. But the TDA
|
||||
// should be written back at the precise endpoint of the xfer.
|
||||
|
||||
if( buff2end > 0 )
|
||||
{
|
||||
// second branch needs cleared:
|
||||
|
@ -388,13 +353,15 @@ void SPU2readDMA(int core, u16* pMem, u32 size)
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
Cores[core].TDA = buff2end;
|
||||
}
|
||||
else
|
||||
{
|
||||
// Buffer doesn't wrap/overflow!
|
||||
// Just set the TDA and check for an IRQ...
|
||||
|
||||
Cores[core].TDA = buff1end;
|
||||
Cores[core].TDA = (buff1end + 0x20) & 0xfffff;
|
||||
|
||||
for( int i=0; i<2; i++ )
|
||||
{
|
||||
|
@ -411,6 +378,7 @@ void SPU2readDMA(int core, u16* pMem, u32 size)
|
|||
}
|
||||
}
|
||||
}
|
||||
Cores[core].TDA = buff1end;
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -78,6 +78,14 @@ public:
|
|||
return L"No Sound (Emulate SPU2 only)";
|
||||
}
|
||||
|
||||
void ReadSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void WriteSettings() const
|
||||
{
|
||||
}
|
||||
|
||||
} NullOut;
|
||||
|
||||
SndOutModule* mods[]=
|
||||
|
|
|
@ -339,7 +339,7 @@ class SndOutModule
|
|||
{
|
||||
public:
|
||||
// Virtual destructor, because it helps fight C+++ funny-business.
|
||||
virtual ~SndOutModule(){};
|
||||
virtual ~SndOutModule() {}
|
||||
|
||||
// Returns a unique identification string for this driver.
|
||||
// (usually just matches the driver's cpp filename)
|
||||
|
@ -352,11 +352,20 @@ public:
|
|||
virtual s32 Init()=0;
|
||||
virtual void Close()=0;
|
||||
virtual s32 Test() const=0;
|
||||
|
||||
// Gui function: Used to open the configuration box for this driver.
|
||||
#ifdef _MSC_VER
|
||||
virtual void Configure(HWND parent)=0;
|
||||
#else
|
||||
virtual void Configure(uptr parent)=0;
|
||||
#endif
|
||||
|
||||
// Loads settings from the INI file for this driver
|
||||
virtual void ReadSettings()=0;
|
||||
|
||||
// Saves settings to the INI file for this driver
|
||||
virtual void WriteSettings() const=0;
|
||||
|
||||
virtual bool Is51Out() const=0;
|
||||
|
||||
// Returns the number of empty samples in the output buffer.
|
||||
|
|
|
@ -47,7 +47,6 @@ bool timeStretchDisabled = false;
|
|||
|
||||
u32 OutputModule = 0;
|
||||
|
||||
CONFIG_DSOUNDOUT Config_DSoundOut;
|
||||
CONFIG_WAVEOUT Config_WaveOut;
|
||||
CONFIG_XAUDIO2 Config_XAudio2;
|
||||
|
||||
|
@ -65,7 +64,7 @@ void ReadSettings()
|
|||
AutoDMAPlayRate[0] = CfgReadInt(L"MIXING",L"AutoDMA_Play_Rate_0",0);
|
||||
AutoDMAPlayRate[1] = CfgReadInt(L"MIXING",L"AutoDMA_Play_Rate_1",0);
|
||||
|
||||
Interpolation = CfgReadInt(L"MIXING",L"Interpolation",1);
|
||||
Interpolation = CfgReadInt( L"MIXING",L"Interpolation", 1 );
|
||||
|
||||
timeStretchDisabled = CfgReadBool( L"OUTPUT", L"Disable_Timestretch", false );
|
||||
EffectsDisabled = CfgReadBool( L"MIXING", L"Disable_Effects", false );
|
||||
|
@ -84,11 +83,11 @@ void ReadSettings()
|
|||
dspPluginEnabled= CfgReadBool(L"DSP PLUGIN",L"Enabled",false);
|
||||
|
||||
// Read DSOUNDOUT and WAVEOUT configs:
|
||||
CfgReadStr( L"DSOUNDOUT", L"Device", Config_DSoundOut.Device, 254, L"default" );
|
||||
CfgReadStr( L"WAVEOUT", L"Device", Config_WaveOut.Device, 254, L"default" );
|
||||
Config_DSoundOut.NumBuffers = CfgReadInt( L"DSOUNDOUT", L"Buffer_Count", 5 );
|
||||
Config_WaveOut.NumBuffers = CfgReadInt( L"WAVEOUT", L"Buffer_Count", 4 );
|
||||
|
||||
DSoundOut->ReadSettings();
|
||||
|
||||
SoundtouchCfg::ReadSettings();
|
||||
DebugConfig::ReadSettings();
|
||||
|
||||
|
@ -97,9 +96,6 @@ void ReadSettings()
|
|||
|
||||
Clampify( SndOutLatencyMS, LATENCY_MIN, LATENCY_MAX );
|
||||
|
||||
Clampify( Config_DSoundOut.NumBuffers, (s8)2, (s8)8 );
|
||||
Clampify( Config_DSoundOut.NumBuffers, (s8)3, (s8)8 );
|
||||
|
||||
if( mods[OutputModule] == NULL )
|
||||
{
|
||||
// Unsupported or legacy module.
|
||||
|
@ -125,19 +121,15 @@ void WriteSettings()
|
|||
CfgWriteBool(L"OUTPUT",L"Disable_Timestretch", timeStretchDisabled);
|
||||
CfgWriteBool(L"OUTPUT",L"Disable_StereoExpansion", StereoExpansionDisabled);
|
||||
|
||||
if( Config_DSoundOut.Device.empty() ) Config_DSoundOut.Device = L"default";
|
||||
if( Config_WaveOut.Device.empty() ) Config_WaveOut.Device = L"default";
|
||||
|
||||
CfgWriteStr(L"DSOUNDOUT",L"Device",Config_DSoundOut.Device);
|
||||
CfgWriteInt(L"DSOUNDOUT",L"Buffer_Count",Config_DSoundOut.NumBuffers);
|
||||
|
||||
CfgWriteStr(L"WAVEOUT",L"Device",Config_WaveOut.Device);
|
||||
CfgWriteInt(L"WAVEOUT",L"Buffer_Count",Config_WaveOut.NumBuffers);
|
||||
|
||||
CfgWriteStr(L"DSP PLUGIN",L"Filename",dspPlugin);
|
||||
CfgWriteInt(L"DSP PLUGIN",L"ModuleNum",dspPluginModule);
|
||||
CfgWriteBool(L"DSP PLUGIN",L"Enabled",dspPluginEnabled);
|
||||
|
||||
|
||||
DSoundOut->WriteSettings();
|
||||
SoundtouchCfg::WriteSettings();
|
||||
DebugConfig::WriteSettings();
|
||||
|
||||
|
|
|
@ -128,19 +128,6 @@ struct CONFIG_XAUDIO2
|
|||
}
|
||||
};
|
||||
|
||||
// DSOUND
|
||||
struct CONFIG_DSOUNDOUT
|
||||
{
|
||||
std::wstring Device;
|
||||
s8 NumBuffers;
|
||||
|
||||
CONFIG_DSOUNDOUT() :
|
||||
Device(),
|
||||
NumBuffers( 3 )
|
||||
{
|
||||
}
|
||||
};
|
||||
|
||||
// WAVEOUT
|
||||
struct CONFIG_WAVEOUT
|
||||
{
|
||||
|
@ -154,7 +141,6 @@ struct CONFIG_WAVEOUT
|
|||
}
|
||||
};
|
||||
|
||||
extern CONFIG_DSOUNDOUT Config_DSoundOut;
|
||||
extern CONFIG_WAVEOUT Config_WaveOut;
|
||||
extern CONFIG_XAUDIO2 Config_XAudio2;
|
||||
|
||||
|
|
|
@ -25,21 +25,29 @@
|
|||
#define DIRECTSOUND_VERSION 0x1000
|
||||
#include <dsound.h>
|
||||
|
||||
static ds_device_data devices[32];
|
||||
static int ndevs;
|
||||
static GUID DevGuid; // currently employed GUID.
|
||||
static bool haveGuid;
|
||||
|
||||
class DSound: public SndOutModule
|
||||
class DSound : public SndOutModule
|
||||
{
|
||||
private:
|
||||
static const uint MAX_BUFFER_COUNT = 8;
|
||||
|
||||
static const int PacketsPerBuffer = 1;
|
||||
static const int BufferSize = SndOutPacketSize * PacketsPerBuffer;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Configuration Vars
|
||||
|
||||
u32 numBuffers; // cached copy of our configuration setting.
|
||||
wstring m_Device;
|
||||
u8 m_NumBuffers;
|
||||
bool m_DisableGlobalFocus;
|
||||
bool m_UseHardware;
|
||||
|
||||
ds_device_data m_devices[32];
|
||||
int ndevs;
|
||||
GUID DevGuid; // currently employed GUID.
|
||||
bool haveGuid;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Instance vars
|
||||
|
||||
int channel;
|
||||
int myLastWrite; // last write position, in bytes
|
||||
|
||||
|
@ -69,7 +77,7 @@ private:
|
|||
|
||||
while( dsound_running )
|
||||
{
|
||||
u32 rv = WaitForMultipleObjects(numBuffers,buffer_events,FALSE,200);
|
||||
u32 rv = WaitForMultipleObjects(m_NumBuffers,buffer_events,FALSE,200);
|
||||
|
||||
T* p1, *oldp1;
|
||||
LPVOID p2;
|
||||
|
@ -99,8 +107,6 @@ private:
|
|||
public:
|
||||
s32 Init()
|
||||
{
|
||||
numBuffers = Config_DSoundOut.NumBuffers;
|
||||
|
||||
//
|
||||
// Initialize DSound
|
||||
//
|
||||
|
@ -108,12 +114,12 @@ public:
|
|||
|
||||
try
|
||||
{
|
||||
if( Config_DSoundOut.Device.empty() )
|
||||
if( m_Device.empty() )
|
||||
throw std::runtime_error( "screw it" );
|
||||
|
||||
// Convert from unicode to ANSI:
|
||||
char guid[256];
|
||||
sprintf_s( guid, "%S", Config_DSoundOut.Device.c_str() );
|
||||
sprintf_s( guid, "%S", m_Device.c_str() );
|
||||
|
||||
if( (FAILED(GUIDFromString( guid, &cGuid ))) ||
|
||||
FAILED( DirectSoundCreate8(&cGuid,&dsound,NULL) ) )
|
||||
|
@ -155,16 +161,29 @@ public:
|
|||
|
||||
memset(&desc, 0, sizeof(DSBUFFERDESC));
|
||||
desc.dwSize = sizeof(DSBUFFERDESC);
|
||||
desc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY;// _CTRLPAN | DSBCAPS_CTRLVOLUME | DSBCAPS_CTRLFREQUENCY;
|
||||
desc.dwBufferBytes = BufferSizeBytes * numBuffers;
|
||||
desc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY;
|
||||
desc.dwBufferBytes = BufferSizeBytes * m_NumBuffers;
|
||||
desc.lpwfxFormat = &wfx;
|
||||
|
||||
desc.dwFlags |= DSBCAPS_LOCSOFTWARE;
|
||||
desc.dwFlags |= DSBCAPS_GLOBALFOCUS;
|
||||
// Try a hardware buffer first, and then fall back on a software buffer if
|
||||
// that one fails.
|
||||
|
||||
if( FAILED(dsound->CreateSoundBuffer(&desc,&buffer_,0) ) )
|
||||
throw std::runtime_error( "DirectSound Error: Interface could not be queried." );
|
||||
|
||||
desc.dwFlags |= m_UseHardware ? DSBCAPS_LOCHARDWARE : DSBCAPS_LOCSOFTWARE;
|
||||
desc.dwFlags |= m_DisableGlobalFocus ? DSBCAPS_STICKYFOCUS : DSBCAPS_GLOBALFOCUS;
|
||||
|
||||
if( FAILED(dsound->CreateSoundBuffer(&desc, &buffer_, 0) ) )
|
||||
{
|
||||
if( m_UseHardware )
|
||||
{
|
||||
desc.dwFlags = DSBCAPS_GETCURRENTPOSITION2 | DSBCAPS_CTRLPOSITIONNOTIFY | DSBCAPS_LOCSOFTWARE;
|
||||
desc.dwFlags |= m_DisableGlobalFocus ? DSBCAPS_STICKYFOCUS : DSBCAPS_GLOBALFOCUS;
|
||||
|
||||
if( FAILED(dsound->CreateSoundBuffer(&desc, &buffer_, 0) ) )
|
||||
throw std::runtime_error( "DirectSound Error: Buffer could not be created." );
|
||||
}
|
||||
|
||||
throw std::runtime_error( "DirectSound Error: Buffer could not be created." );
|
||||
}
|
||||
if( FAILED(buffer_->QueryInterface(IID_IDirectSoundBuffer8,(void**)&buffer)) )
|
||||
throw std::runtime_error( "DirectSound Error: Interface could not be queried." );
|
||||
|
||||
|
@ -173,7 +192,7 @@ public:
|
|||
|
||||
DSBPOSITIONNOTIFY not[MAX_BUFFER_COUNT];
|
||||
|
||||
for(u32 i=0;i<numBuffers;i++)
|
||||
for(uint i=0;i<m_NumBuffers;i++)
|
||||
{
|
||||
// [Air] note: wfx.nBlockAlign modifier was *10 -- seems excessive to me but maybe
|
||||
// it was needed for some quirky driver? Theoretically we want the notification as soon
|
||||
|
@ -184,7 +203,7 @@ public:
|
|||
not[i].hEventNotify = buffer_events[i];
|
||||
}
|
||||
|
||||
buffer_notify->SetNotificationPositions(numBuffers,not);
|
||||
buffer_notify->SetNotificationPositions(m_NumBuffers,not);
|
||||
|
||||
LPVOID p1=0,p2=0;
|
||||
DWORD s1=0,s2=0;
|
||||
|
@ -224,7 +243,7 @@ public:
|
|||
{
|
||||
buffer->Stop();
|
||||
|
||||
for(u32 i=0;i<numBuffers;i++)
|
||||
for(u32 i=0;i<m_NumBuffers;i++)
|
||||
{
|
||||
if( buffer_events[i] != NULL )
|
||||
CloseHandle(buffer_events[i]);
|
||||
|
@ -240,18 +259,18 @@ public:
|
|||
|
||||
private:
|
||||
|
||||
static BOOL CALLBACK DSEnumCallback( LPGUID lpGuid, LPCTSTR lpcstrDescription, LPCTSTR lpcstrModule, LPVOID lpContext )
|
||||
bool _DSEnumCallback( LPGUID lpGuid, LPCTSTR lpcstrDescription, LPCTSTR lpcstrModule, LPVOID lpContext )
|
||||
{
|
||||
devices[ndevs].name = lpcstrDescription;
|
||||
m_devices[ndevs].name = lpcstrDescription;
|
||||
|
||||
if(lpGuid)
|
||||
{
|
||||
devices[ndevs].guid = *lpGuid;
|
||||
devices[ndevs].hasGuid = true;
|
||||
m_devices[ndevs].guid = *lpGuid;
|
||||
m_devices[ndevs].hasGuid = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
devices[ndevs].hasGuid = false;
|
||||
m_devices[ndevs].hasGuid = false;
|
||||
}
|
||||
ndevs++;
|
||||
|
||||
|
@ -259,10 +278,10 @@ private:
|
|||
return FALSE;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
||||
bool _ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
int wmId,wmEvent;
|
||||
int tSel=0;
|
||||
int tSel = 0;
|
||||
|
||||
switch(uMsg)
|
||||
{
|
||||
|
@ -271,7 +290,7 @@ private:
|
|||
wchar_t temp[128];
|
||||
|
||||
char temp2[192];
|
||||
sprintf_s( temp2, "%S", Config_DSoundOut.Device.c_str() );
|
||||
sprintf_s( temp2, "%S", m_Device.c_str() );
|
||||
haveGuid = ! FAILED(GUIDFromString(temp2,&DevGuid));
|
||||
SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_RESETCONTENT,0,0);
|
||||
|
||||
|
@ -281,22 +300,21 @@ private:
|
|||
tSel=-1;
|
||||
for(int i=0;i<ndevs;i++)
|
||||
{
|
||||
SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_ADDSTRING,0,(LPARAM)devices[i].name.c_str());
|
||||
if(haveGuid && IsEqualGUID(devices[i].guid,DevGuid))
|
||||
{
|
||||
tSel=i;
|
||||
}
|
||||
SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_ADDSTRING,0,(LPARAM)m_devices[i].name.c_str());
|
||||
if(haveGuid && IsEqualGUID(m_devices[i].guid,DevGuid))
|
||||
tSel = i;
|
||||
}
|
||||
|
||||
if(tSel>=0)
|
||||
{
|
||||
SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_SETCURSEL,tSel,0);
|
||||
}
|
||||
|
||||
INIT_SLIDER( IDC_BUFFERS_SLIDER, 2, MAX_BUFFER_COUNT, 2, 1, 1 );
|
||||
SendMessage(GetDlgItem(hWnd,IDC_BUFFERS_SLIDER),TBM_SETPOS,TRUE,Config_DSoundOut.NumBuffers);
|
||||
swprintf_s(temp, L"%d (%d ms latency)",Config_DSoundOut.NumBuffers, 1000 / (96000 / (Config_DSoundOut.NumBuffers * BufferSize)));
|
||||
SendMessage(GetDlgItem(hWnd,IDC_BUFFERS_SLIDER),TBM_SETPOS,TRUE,m_NumBuffers);
|
||||
swprintf_s(temp, L"%d (%d ms latency)",m_NumBuffers, 1000 / (96000 / (m_NumBuffers * BufferSize)));
|
||||
SetWindowText(GetDlgItem(hWnd,IDC_LATENCY_LABEL),temp);
|
||||
|
||||
SET_CHECK( IDC_GLOBALFOCUS_DISABLE, m_DisableGlobalFocus );
|
||||
SET_CHECK( IDC_USE_HARDWARE, m_UseHardware );
|
||||
}
|
||||
break;
|
||||
|
||||
|
@ -310,41 +328,47 @@ private:
|
|||
switch (wmId)
|
||||
{
|
||||
case IDOK:
|
||||
{
|
||||
int i = (int)SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_GETCURSEL,0,0);
|
||||
|
||||
if(!m_devices[i].hasGuid)
|
||||
{
|
||||
int i = (int)SendMessage(GetDlgItem(hWnd,IDC_DS_DEVICE),CB_GETCURSEL,0,0);
|
||||
|
||||
if(!devices[i].hasGuid)
|
||||
{
|
||||
Config_DSoundOut.Device[0] = 0; // clear device name to ""
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf_s(temp, L"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||
devices[i].guid.Data1,
|
||||
devices[i].guid.Data2,
|
||||
devices[i].guid.Data3,
|
||||
devices[i].guid.Data4[0],
|
||||
devices[i].guid.Data4[1],
|
||||
devices[i].guid.Data4[2],
|
||||
devices[i].guid.Data4[3],
|
||||
devices[i].guid.Data4[4],
|
||||
devices[i].guid.Data4[5],
|
||||
devices[i].guid.Data4[6],
|
||||
devices[i].guid.Data4[7]
|
||||
);
|
||||
Config_DSoundOut.Device = temp;
|
||||
}
|
||||
|
||||
Config_DSoundOut.NumBuffers = (int)SendMessage( GetDlgItem( hWnd, IDC_BUFFERS_SLIDER ), TBM_GETPOS, 0, 0 );
|
||||
|
||||
if( Config_DSoundOut.NumBuffers < 2 ) Config_DSoundOut.NumBuffers = 2;
|
||||
if( Config_DSoundOut.NumBuffers > MAX_BUFFER_COUNT ) Config_DSoundOut.NumBuffers = MAX_BUFFER_COUNT;
|
||||
m_Device[0] = 0; // clear device name to ""
|
||||
}
|
||||
else
|
||||
{
|
||||
swprintf_s(temp, L"{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
|
||||
m_devices[i].guid.Data1,
|
||||
m_devices[i].guid.Data2,
|
||||
m_devices[i].guid.Data3,
|
||||
m_devices[i].guid.Data4[0],
|
||||
m_devices[i].guid.Data4[1],
|
||||
m_devices[i].guid.Data4[2],
|
||||
m_devices[i].guid.Data4[3],
|
||||
m_devices[i].guid.Data4[4],
|
||||
m_devices[i].guid.Data4[5],
|
||||
m_devices[i].guid.Data4[6],
|
||||
m_devices[i].guid.Data4[7]
|
||||
);
|
||||
m_Device = temp;
|
||||
}
|
||||
|
||||
m_NumBuffers = (int)SendMessage( GetDlgItem( hWnd, IDC_BUFFERS_SLIDER ), TBM_GETPOS, 0, 0 );
|
||||
|
||||
if( m_NumBuffers < 2 ) m_NumBuffers = 2;
|
||||
if( m_NumBuffers > MAX_BUFFER_COUNT ) m_NumBuffers = MAX_BUFFER_COUNT;
|
||||
|
||||
EndDialog(hWnd,0);
|
||||
break;
|
||||
}
|
||||
break;
|
||||
|
||||
case IDCANCEL:
|
||||
EndDialog(hWnd,0);
|
||||
break;
|
||||
break;
|
||||
|
||||
HANDLE_CHECK( IDC_GLOBALFOCUS_DISABLE, m_DisableGlobalFocus );
|
||||
HANDLE_CHECK( IDC_USE_HARDWARE, m_UseHardware );
|
||||
|
||||
default:
|
||||
return FALSE;
|
||||
}
|
||||
|
@ -355,14 +379,15 @@ private:
|
|||
{
|
||||
wmId = LOWORD(wParam);
|
||||
wmEvent = HIWORD(wParam);
|
||||
switch(wmId) {
|
||||
switch(wmId)
|
||||
{
|
||||
//case TB_ENDTRACK:
|
||||
//case TB_THUMBPOSITION:
|
||||
case TB_LINEUP:
|
||||
case TB_LINEDOWN:
|
||||
case TB_PAGEUP:
|
||||
case TB_PAGEDOWN:
|
||||
wmEvent=(int)SendMessage((HWND)lParam,TBM_GETPOS,0,0);
|
||||
wmEvent = (int)SendMessage((HWND)lParam,TBM_GETPOS,0,0);
|
||||
case TB_THUMBTRACK:
|
||||
{
|
||||
wchar_t temp[128];
|
||||
|
@ -385,6 +410,9 @@ private:
|
|||
return TRUE;
|
||||
}
|
||||
|
||||
static BOOL CALLBACK ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam);
|
||||
static BOOL CALLBACK DSEnumCallback( LPGUID lpGuid, LPCTSTR lpcstrDescription, LPCTSTR lpcstrModule, LPVOID lpContext );
|
||||
|
||||
public:
|
||||
virtual void Configure(HWND parent)
|
||||
{
|
||||
|
@ -427,7 +455,36 @@ public:
|
|||
{
|
||||
return L"DirectSound (nice)";
|
||||
}
|
||||
|
||||
void ReadSettings()
|
||||
{
|
||||
CfgReadStr( L"DSOUNDOUT", L"Device", m_Device, 254, L"default" );
|
||||
m_NumBuffers = CfgReadInt( L"DSOUNDOUT", L"Buffer_Count", 5 );
|
||||
m_DisableGlobalFocus = CfgReadBool( L"DSOUNDOUT", L"Disable_Global_Focus", false );
|
||||
m_UseHardware = CfgReadBool( L"DSOUNDOUT", L"Use_Hardware", false );
|
||||
|
||||
Clampify( m_NumBuffers, (u8)3, (u8)8 );
|
||||
}
|
||||
|
||||
void WriteSettings() const
|
||||
{
|
||||
CfgWriteStr( L"DSOUNDOUT", L"Device", m_Device.empty() ? L"default" : m_Device );
|
||||
CfgWriteInt( L"DSOUNDOUT", L"Buffer_Count", m_NumBuffers );
|
||||
CfgWriteBool( L"DSOUNDOUT", L"Disable_Global_Focus", m_DisableGlobalFocus );
|
||||
CfgWriteBool( L"DSOUNDOUT", L"Use_Hardware", m_UseHardware );
|
||||
}
|
||||
|
||||
} DS;
|
||||
|
||||
SndOutModule *DSoundOut=&DS;
|
||||
BOOL CALLBACK DSound::ConfigProc(HWND hWnd,UINT uMsg,WPARAM wParam,LPARAM lParam)
|
||||
{
|
||||
return DS._ConfigProc( hWnd, uMsg, wParam, lParam );
|
||||
}
|
||||
|
||||
BOOL CALLBACK DSound::DSEnumCallback( LPGUID lpGuid, LPCTSTR lpcstrDescription, LPCTSTR lpcstrModule, LPVOID lpContext )
|
||||
{
|
||||
jASSUME( DSoundOut != NULL );
|
||||
return DS._DSEnumCallback( lpGuid, lpcstrDescription, lpcstrModule, lpContext );
|
||||
}
|
||||
|
||||
SndOutModule *DSoundOut = &DS;
|
||||
|
|
|
@ -367,6 +367,14 @@ public:
|
|||
return L"XAudio 2 (Recommended)";
|
||||
}
|
||||
|
||||
void ReadSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void WriteSettings() const
|
||||
{
|
||||
}
|
||||
|
||||
} XA2;
|
||||
|
||||
SndOutModule *XAudio2Out = &XA2;
|
||||
|
|
|
@ -316,6 +316,14 @@ public:
|
|||
return L"waveOut (Laggy)";
|
||||
}
|
||||
|
||||
void ReadSettings()
|
||||
{
|
||||
}
|
||||
|
||||
void WriteSettings() const
|
||||
{
|
||||
}
|
||||
|
||||
} WO;
|
||||
|
||||
SndOutModule *WaveOut = &WO;
|
||||
|
|
|
@ -83,19 +83,22 @@ BEGIN
|
|||
DEFPUSHBUTTON "Close",IDOK,269,504,50,14
|
||||
END
|
||||
|
||||
IDD_DSOUND DIALOGEX 0, 0, 182, 121
|
||||
IDD_DSOUND DIALOGEX 0, 0, 196, 218
|
||||
STYLE DS_SETFONT | DS_MODALFRAME | DS_FIXEDSYS | WS_POPUP | WS_CAPTION | WS_SYSMENU
|
||||
CAPTION "DirectSound Output Module Settings"
|
||||
FONT 8, "MS Shell Dlg", 400, 0, 0x1
|
||||
BEGIN
|
||||
DEFPUSHBUTTON "OK",IDOK,67,103,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,127,103,50,14
|
||||
COMBOBOX IDC_DS_DEVICE,4,15,173,62,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
DEFPUSHBUTTON "OK",IDOK,83,200,50,14
|
||||
PUSHBUTTON "Cancel",IDCANCEL,141,200,50,14
|
||||
COMBOBOX IDC_DS_DEVICE,4,15,146,62,CBS_DROPDOWNLIST | WS_VSCROLL | WS_TABSTOP
|
||||
LTEXT "DirectSound Device",IDC_STATIC,4,3,63,8
|
||||
LTEXT "Number of Buffers",IDC_STATIC,4,40,61,11
|
||||
CONTROL "",IDC_BUFFERS_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,74,48,103,10
|
||||
LTEXT "Increase the buffer count if you are experiencing loopy or studdery audio even when games run at high FPS.",IDC_STATIC,8,66,169,27
|
||||
CTEXT "8 (80 ms latency)",IDC_LATENCY_LABEL,78,37,95,11
|
||||
CONTROL "",IDC_BUFFERS_SLIDER,"msctls_trackbar32",TBS_AUTOTICKS | WS_TABSTOP,38,137,108,10
|
||||
LTEXT "Increase the buffer count if you are experiencing loopy or studdery audio even when games run at high FPS.",IDC_STATIC,11,157,169,27
|
||||
CTEXT "8 (80 ms latency)",IDC_LATENCY_LABEL,44,123,95,11
|
||||
CONTROL "Disable Global Focus",IDC_GLOBALFOCUS_DISABLE,"Button",BS_AUTOCHECKBOX | WS_DISABLED | WS_TABSTOP,4,38,140,10
|
||||
LTEXT "If you have audio problems, try checking one or both of the options above. They don't really affect sound processing, but some drivers are picky and work nicer with different seetings.",IDC_STATIC,16,68,175,38
|
||||
CONTROL "Use Hardware Buffers",IDC_USE_HARDWARE,"Button",BS_AUTOCHECKBOX | WS_TABSTOP,4,53,140,10
|
||||
GROUPBOX "Output Buffers",IDC_STATIC,4,111,185,79
|
||||
END
|
||||
|
||||
IDD_WAVEOUT DIALOGEX 0, 0, 170, 122
|
||||
|
@ -210,9 +213,9 @@ BEGIN
|
|||
IDD_DSOUND, DIALOG
|
||||
BEGIN
|
||||
LEFTMARGIN, 4
|
||||
RIGHTMARGIN, 177
|
||||
RIGHTMARGIN, 191
|
||||
TOPMARGIN, 3
|
||||
BOTTOMMARGIN, 117
|
||||
BOTTOMMARGIN, 214
|
||||
END
|
||||
|
||||
IDD_WAVEOUT, DIALOG
|
||||
|
|
|
@ -50,6 +50,9 @@
|
|||
#define IDC_RESET_DEFAULTS 1057
|
||||
#define IDC_OPEN_CONFIG_SOUNDTOUCH 1058
|
||||
#define IDC_OPEN_CONFIG_DEBUG 1059
|
||||
#define IDC_GLOBALFOCUS_DISABLE 1060
|
||||
#define IDC_GLOBALFOCUS_DISABLE2 1061
|
||||
#define IDC_USE_HARDWARE 1061
|
||||
|
||||
// Next default values for new objects
|
||||
//
|
||||
|
@ -57,7 +60,7 @@
|
|||
#ifndef APSTUDIO_READONLY_SYMBOLS
|
||||
#define _APS_NEXT_RESOURCE_VALUE 119
|
||||
#define _APS_NEXT_COMMAND_VALUE 40001
|
||||
#define _APS_NEXT_CONTROL_VALUE 1060
|
||||
#define _APS_NEXT_CONTROL_VALUE 1061
|
||||
#define _APS_NEXT_SYMED_VALUE 101
|
||||
#endif
|
||||
#endif
|
||||
|
|
Loading…
Reference in New Issue