New "Peops SPU2-like" async mixing mode.
Can only be toggled in source for now, as it will lower compatibility.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2835 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2010-04-11 22:08:32 +00:00
parent 3cc6bbf584
commit ab2897a417
3 changed files with 32 additions and 10 deletions

View File

@ -379,9 +379,10 @@ private:
static void PredictDataWrite( int samples ); static void PredictDataWrite( int samples );
static float GetStatusPct(); static float GetStatusPct();
static void UpdateTempoChange(); static void UpdateTempoChangeSoundTouch();
public: public:
static void UpdateTempoChangeAsyncMixing();
static void Init(); static void Init();
static void Cleanup(); static void Cleanup();
static void Write( const StereoOut32& Sample ); static void Write( const StereoOut32& Sample );

View File

@ -61,7 +61,7 @@ float SndBuffer::GetStatusPct()
return result; return result;
} }
void SndBuffer::UpdateTempoChange() void SndBuffer::UpdateTempoChangeSoundTouch()
{ {
float statusPct = GetStatusPct(); float statusPct = GetStatusPct();
float pctChange = statusPct - lastPct; float pctChange = statusPct - lastPct;
@ -200,6 +200,23 @@ void SndBuffer::UpdateTempoChange()
} }
} }
extern int TickInterval;
void SndBuffer::UpdateTempoChangeAsyncMixing()
{
float statusPct = GetStatusPct();
lastPct = statusPct;
if( statusPct < -0.1f )
{
TickInterval = 100;
}
else if( statusPct > 0.1f )
{
TickInterval = 9000;
}
else TickInterval = 768;
}
void SndBuffer::timeStretchUnderrun() void SndBuffer::timeStretchUnderrun()
{ {
// timeStretcher failed it's job. We need to slow down the audio some. // timeStretcher failed it's job. We need to slow down the audio some.
@ -272,7 +289,7 @@ void SndBuffer::timeStretchWrite()
progress = true; progress = true;
} }
UpdateTempoChange(); UpdateTempoChangeSoundTouch();
if( MsgOverruns() ) if( MsgOverruns() )
{ {

View File

@ -269,12 +269,10 @@ void V_Voice::Stop()
ADSR.Phase = 0; ADSR.Phase = 0;
} }
static const int TickInterval = 768; int TickInterval = 768;
static const int SanityInterval = 4800; static const int SanityInterval = 4800;
u32 TicksCore = 0; //#define USE_ASYNC_MIXING
u32 TicksThread = 0;
__forceinline void TimeUpdate(u32 cClocks) __forceinline void TimeUpdate(u32 cClocks)
{ {
@ -298,7 +296,9 @@ __forceinline void TimeUpdate(u32 cClocks)
} }
//UpdateDebugDialog(); //UpdateDebugDialog();
#ifdef USE_ASYNC_MIXING
SndBuffer::UpdateTempoChangeAsyncMixing();
#endif
//Update Mixing Progress //Update Mixing Progress
while(dClocks>=TickInterval) while(dClocks>=TickInterval)
{ {
@ -855,7 +855,7 @@ static void __fastcall RegWrite_Core( u16 value )
// When we have exact cycle update info from the Pcsx2 IOP unit, then use // When we have exact cycle update info from the Pcsx2 IOP unit, then use
// the more accurate delayed initialization system. // the more accurate delayed initialization system.
ConLog( " * SPU2: Runtime core%d reset\n", core ); ConLog( " * SPU2: Runtime core%d reset\n", core );
#ifndef USE_ASYNC_MIXING
if(cyclePtr != NULL) if(cyclePtr != NULL)
{ {
thiscore.InitDelay = 1; thiscore.InitDelay = 1;
@ -866,6 +866,10 @@ static void __fastcall RegWrite_Core( u16 value )
thiscore.Reset(thiscore.Index); thiscore.Reset(thiscore.Index);
} }
} }
#else
thiscore.Reset(thiscore.Index);
}
#endif
thiscore.AttrBit0 =(value>> 0) & 0x01; //1 bit thiscore.AttrBit0 =(value>> 0) & 0x01; //1 bit
thiscore.DMABits =(value>> 1) & 0x07; //3 bits thiscore.DMABits =(value>> 1) & 0x07; //3 bits
@ -895,7 +899,7 @@ static void __fastcall RegWrite_Core( u16 value )
} }
if(thiscore.IRQEnable!=irqe) if(thiscore.IRQEnable!=irqe)
{ {
ConLog(" * SPU2: IRQ %s\n",((thiscore.IRQEnable==0)?"disabled":"enabled")); ConLog(" * SPU2: IRQ %s at cycle %d\n",((thiscore.IRQEnable==0)?"disabled":"enabled"), Cycles);
if(!thiscore.IRQEnable) if(!thiscore.IRQEnable)
Spdif.Info &= ~(4 << thiscore.Index); Spdif.Info &= ~(4 << thiscore.Index);
} }