- Various small changes and a fix by gigaherz for dsp plugins when timestretching is disabled.

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2788 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2010-03-28 20:48:52 +00:00
parent 07045d1f4a
commit db63162c0d
4 changed files with 19 additions and 19 deletions

View File

@ -274,6 +274,7 @@ void V_Core::PlainDMAWrite(u16 *pMem, u32 size)
if ((Cores[i].IRQEnable && (Cores[i].IRQA >= TSA)) || (Cores[i].IRQA < TDA)) if ((Cores[i].IRQEnable && (Cores[i].IRQA >= TSA)) || (Cores[i].IRQA < TDA))
{ {
ConLog("DMAwrite Core %d: IRQ Called (IRQ passed). IRQA = %x Cycles = %d\n", i, Cores[i].IRQA, Cycles );
Spdif.Info |= 4 << i; Spdif.Info |= 4 << i;
SetIrqCall(); SetIrqCall();
} }
@ -303,6 +304,7 @@ void V_Core::PlainDMAWrite(u16 *pMem, u32 size)
if( Cores[i].IRQEnable && (Cores[i].IRQA >= TSA) && (Cores[i].IRQA < TDA) ) if( Cores[i].IRQEnable && (Cores[i].IRQA >= TSA) && (Cores[i].IRQA < TDA) )
{ {
ConLog("DMAwrite Core %d: IRQ Called (IRQ passed). IRQA = %x Cycles = %d\n", i, Cores[i].IRQA, Cycles );
Spdif.Info |= 4 << i; Spdif.Info |= 4 << i;
SetIrqCall(); SetIrqCall();
} }
@ -420,8 +422,9 @@ void V_Core::DoDMAwrite(u16* pMem, u32 size)
} }
else else
{ {
if(MsgDMA()) ConLog(" * SPU2: DMA%c Transfer of %d bytes to %x (%02x %x %04x).\n", if(MsgDMA()) ConLog(" * SPU2: DMA%c Transfer of %d bytes to %x (%02x %x %04x). IRQE = %d IRQA = %x \n",
GetDmaIndexChar(),size<<1,TSA,DMABits,AutoDMACtrl,(~Regs.ATTR)&0x7fff); GetDmaIndexChar(),size<<1,TSA,DMABits,AutoDMACtrl,(~Regs.ATTR)&0x7fff,
Cores[0].IRQEnable, Cores[0].IRQA);
PlainDMAWrite(pMem,size); PlainDMAWrite(pMem,size);
} }

View File

@ -127,7 +127,7 @@ bool SndBuffer::CheckUnderrunStatus( int& nSamples, int& quietSampleCount )
quietSampleCount = 0; quietSampleCount = 0;
if( m_underrun_freeze ) if( m_underrun_freeze )
{ {
int toFill = (int)(m_size * ( timeStretchDisabled ? 0.50f : 0.1f ) ); int toFill = (int)(m_size * ( timeStretchDisabled ? 0.50f : 0.02f ) );
toFill = GetAlignedBufferSize( toFill ); toFill = GetAlignedBufferSize( toFill );
// toFill is now aligned to a SndOutPacket // toFill is now aligned to a SndOutPacket
@ -229,6 +229,14 @@ void SndBuffer::_WriteSamples(StereoOut32 *bData, int nSamples)
m_wpos += nSamples; m_wpos += nSamples;
memcpy( wposbuffer, bData, nSamples * sizeof( *bData ) ); memcpy( wposbuffer, bData, nSamples * sizeof( *bData ) );
// Use to monitor buffer levels in real time
/*int drvempty = mods[OutputModule]->GetEmptySampleCount();
float result = (float)(m_data + m_predictData - drvempty) - (m_size/2);
result /= (m_size/2);
if (result > 0.6 || result < -0.5)
printf("buffer: %f\n",result);
}*/
} }
void SndBuffer::Init() void SndBuffer::Init()
@ -302,7 +310,7 @@ int SndBuffer::ssFreeze = 0;
void SndBuffer::ClearContents() void SndBuffer::ClearContents()
{ {
SndBuffer::soundtouchClearContents(); SndBuffer::soundtouchClearContents();
SndBuffer::ssFreeze = 30; //Delays sound output for about half a second. SndBuffer::ssFreeze = 256; //Delays sound output for about 1 second.
} }
void SndBuffer::Write( const StereoOut32& Sample ) void SndBuffer::Write( const StereoOut32& Sample )
@ -325,10 +333,10 @@ void SndBuffer::Write( const StereoOut32& Sample )
if ( ssFreeze > 0 ) if ( ssFreeze > 0 )
{ {
ssFreeze--; ssFreeze--;
return; memset( sndTempBuffer, 0, sizeof(StereoOut32) * SndOutPacketSize ); // Play silence
} }
#ifndef __LINUX__ #ifndef __LINUX__
else if( dspPluginEnabled ) if( dspPluginEnabled )
{ {
// Convert in, send to winamp DSP, and convert out. // Convert in, send to winamp DSP, and convert out.
@ -344,7 +352,7 @@ void SndBuffer::Write( const StereoOut32& Sample )
if( !timeStretchDisabled ) if( !timeStretchDisabled )
timeStretchWrite(); timeStretchWrite();
else else
_WriteSamples(sndTempBuffer, sndTempProgress); _WriteSamples(sndTempBuffer, SndOutPacketSize);
m_dsp_progress -= SndOutPacketSize; m_dsp_progress -= SndOutPacketSize;
} }

View File

@ -364,7 +364,6 @@ private:
static float lastEmergencyAdj; static float lastEmergencyAdj;
static float cTempo; static float cTempo;
static float eTempo; static float eTempo;
static int freezeTempo;
static int ssFreeze; static int ssFreeze;
static void _InitFail(); static void _InitFail();

View File

@ -36,7 +36,6 @@ float SndBuffer::lastEmergencyAdj;
float SndBuffer::cTempo = 1; float SndBuffer::cTempo = 1;
float SndBuffer::eTempo = 1; float SndBuffer::eTempo = 1;
int SndBuffer::freezeTempo = 0;
void SndBuffer::PredictDataWrite( int samples ) void SndBuffer::PredictDataWrite( int samples )
{ {
@ -64,11 +63,6 @@ float SndBuffer::GetStatusPct()
void SndBuffer::UpdateTempoChange() void SndBuffer::UpdateTempoChange()
{ {
if( --freezeTempo > 0 )
{
return;
}
float statusPct = GetStatusPct(); float statusPct = GetStatusPct();
float pctChange = statusPct - lastPct; float pctChange = statusPct - lastPct;
@ -317,9 +311,6 @@ void SndBuffer::soundtouchInit()
lastPct = 0; lastPct = 0;
lastEmergencyAdj = 0; lastEmergencyAdj = 0;
// just freeze tempo changes for a while at startup.
// the driver buffers are bogus anyway.
freezeTempo = 16;
m_predictData = 0; m_predictData = 0;
} }
@ -336,11 +327,10 @@ void SndBuffer::soundtouchClearContents()
lastPct = 0; lastPct = 0;
lastEmergencyAdj = 0; lastEmergencyAdj = 0;
freezeTempo = 16;
m_predictData = 0; m_predictData = 0;
} }
void SndBuffer::soundtouchCleanup() void SndBuffer::soundtouchCleanup()
{ {
safe_delete( pSoundTouch ); safe_delete( pSoundTouch );
} }