mirror of https://github.com/PCSX2/pcsx2.git
SPU2-X:
Work on support for Wasapi's exclusive mode. Not enabled yet. Also lower (/8) sound out packet size. Helps the timestretcher responsiveness and quality. git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2755 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
8c0fc49f61
commit
86dcb0a1a9
|
@ -1806,6 +1806,10 @@ static HRESULT CreateAudioClient(PaWasapiSubStream *pSubStream, PaWasapiDeviceIn
|
|||
if (pSubStream->period < info->DefaultDevicePeriod)
|
||||
pSubStream->period = info->DefaultDevicePeriod;
|
||||
}
|
||||
// Issues with setting exclusive mode due to pSubStream->period beeing wrong somehow
|
||||
// Most likely reason is that framesPerLatency is hardcoded to 0.
|
||||
else if (pSubStream->shareMode == AUDCLNT_SHAREMODE_EXCLUSIVE)
|
||||
pSubStream->period = info->MinimumDevicePeriod; // Gives 3ms of latency
|
||||
|
||||
// Open the stream and associate it with an audio session
|
||||
hr = IAudioClient_Initialize(pAudioClient,
|
||||
|
|
|
@ -20,7 +20,7 @@
|
|||
// Number of stereo samples per SndOut block.
|
||||
// All drivers must work in units of this size when communicating with
|
||||
// SndOut.
|
||||
static const int SndOutPacketSize = 512;
|
||||
static const int SndOutPacketSize = 64;
|
||||
|
||||
// Overall master volume shift.
|
||||
// Converts the mixer's 32 bit value into a 16 bit value.
|
||||
|
|
|
@ -21,6 +21,7 @@
|
|||
#include "Dialogs.h"
|
||||
|
||||
#include "portaudio/include/portaudio.h"
|
||||
#include "portaudio/include/pa_win_wasapi.h"
|
||||
|
||||
#ifdef __LINUX__
|
||||
int PaLinuxCallback( const void *inputBuffer, void *outputBuffer,
|
||||
|
@ -33,10 +34,6 @@ int PaLinuxCallback( const void *inputBuffer, void *outputBuffer,
|
|||
class Portaudio : public SndOutModule
|
||||
{
|
||||
private:
|
||||
static const uint MAX_BUFFER_COUNT = 8;
|
||||
static const int PacketsPerBuffer = 1;
|
||||
static const int BufferSize = SndOutPacketSize * PacketsPerBuffer;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
// Configuration Vars (unused still)
|
||||
|
||||
|
@ -153,6 +150,13 @@ public:
|
|||
|
||||
if(deviceIndex>=0)
|
||||
{
|
||||
PaWasapiStreamInfo info = {
|
||||
sizeof(PaWasapiStreamInfo),
|
||||
paWASAPI,
|
||||
1,
|
||||
paWinWasapiExclusive
|
||||
};
|
||||
|
||||
PaStreamParameters outParams = {
|
||||
|
||||
// PaDeviceIndex device;
|
||||
|
@ -165,6 +169,7 @@ public:
|
|||
paInt32,
|
||||
0, //?
|
||||
NULL
|
||||
//&info // Use this instead of the NULL above, to pass it the Exclusive mode enable flag
|
||||
};
|
||||
|
||||
err = Pa_OpenStream(&stream,
|
||||
|
@ -258,6 +263,7 @@ public:
|
|||
writtenLastTime = writtenSoFar;
|
||||
availableLastTime = availableNow;
|
||||
|
||||
// Lowest resolution here is the SndOutPacketSize we use.
|
||||
return playedSinceLastTime;
|
||||
}
|
||||
|
||||
|
|
|
@ -55,7 +55,7 @@ float SndBuffer::GetStatusPct()
|
|||
|
||||
int drvempty = mods[OutputModule]->GetEmptySampleCount(); // / 2;
|
||||
|
||||
//ConLog( "Data %d >>> driver: %d predict: %d\n", data, drvempty, predictData );
|
||||
//ConLog( "Data %d >>> driver: %d predict: %d\n", m_data, drvempty, m_predictData );
|
||||
|
||||
float result = (float)(m_data + m_predictData - drvempty) - (m_size/2);
|
||||
result /= (m_size/2);
|
||||
|
|
|
@ -27,7 +27,7 @@ class DSound : public SndOutModule
|
|||
{
|
||||
private:
|
||||
static const uint MAX_BUFFER_COUNT = 8;
|
||||
static const int PacketsPerBuffer = 1;
|
||||
static const int PacketsPerBuffer = 8;
|
||||
static const int BufferSize = SndOutPacketSize * PacketsPerBuffer;
|
||||
|
||||
//////////////////////////////////////////////////////////////////////////////////////////
|
||||
|
|
|
@ -68,7 +68,7 @@ static const double SndOutNormalizer = (double)(1UL<<(SndOutVolumeShift+16));
|
|||
class XAudio2Mod: public SndOutModule
|
||||
{
|
||||
private:
|
||||
static const int PacketsPerBuffer = 1;
|
||||
static const int PacketsPerBuffer = 8;
|
||||
static const int MAX_BUFFER_COUNT = 3;
|
||||
|
||||
class BaseStreamingVoice : public IXAudio2VoiceCallback
|
||||
|
|
Loading…
Reference in New Issue