mirror of https://github.com/PCSX2/pcsx2.git
Build on the preivous dsp fix so that it can work with dsp plugins that return partial blocks. It's not tested properly since I don't know of any plugin which does that.
git-svn-id: http://pcsx2.googlecode.com/svn/trunk@2789 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
parent
db63162c0d
commit
294705aea6
|
@ -264,7 +264,7 @@ void SndBuffer::Init()
|
||||||
m_underrun_freeze = false;
|
m_underrun_freeze = false;
|
||||||
|
|
||||||
sndTempBuffer = new StereoOut32[SndOutPacketSize];
|
sndTempBuffer = new StereoOut32[SndOutPacketSize];
|
||||||
sndTempBuffer16 = new StereoOut16[SndOutPacketSize];
|
sndTempBuffer16 = new StereoOut16[SndOutPacketSize * 2]; // in case of leftovers.
|
||||||
}
|
}
|
||||||
catch( std::bad_alloc& )
|
catch( std::bad_alloc& )
|
||||||
{
|
{
|
||||||
|
@ -340,11 +340,12 @@ void SndBuffer::Write( const StereoOut32& Sample )
|
||||||
{
|
{
|
||||||
// Convert in, send to winamp DSP, and convert out.
|
// Convert in, send to winamp DSP, and convert out.
|
||||||
|
|
||||||
for( int i=0; i<SndOutPacketSize; ++i ) { sndTempBuffer16[i] = sndTempBuffer[i].DownSample(); }
|
int ei= m_dsp_progress;
|
||||||
m_dsp_progress += DspProcess( (s16*)sndTempBuffer16, SndOutPacketSize );
|
for( int i=0; i<SndOutPacketSize; ++i, ++ei ) { sndTempBuffer16[ei] = sndTempBuffer[i].DownSample(); }
|
||||||
|
m_dsp_progress += DspProcess( (s16*)sndTempBuffer16 + m_dsp_progress, SndOutPacketSize );
|
||||||
|
|
||||||
// Some ugly code to ensure full packet handling:
|
// Some ugly code to ensure full packet handling:
|
||||||
int ei = 0;
|
ei = 0;
|
||||||
while( m_dsp_progress >= SndOutPacketSize )
|
while( m_dsp_progress >= SndOutPacketSize )
|
||||||
{
|
{
|
||||||
for( int i=0; i<SndOutPacketSize; ++i, ++ei ) { sndTempBuffer[i] = sndTempBuffer16[ei].UpSample(); }
|
for( int i=0; i<SndOutPacketSize; ++i, ++ei ) { sndTempBuffer[i] = sndTempBuffer16[ei].UpSample(); }
|
||||||
|
@ -360,7 +361,7 @@ void SndBuffer::Write( const StereoOut32& Sample )
|
||||||
// copy any leftovers to the front of the dsp buffer.
|
// copy any leftovers to the front of the dsp buffer.
|
||||||
if( m_dsp_progress > 0 )
|
if( m_dsp_progress > 0 )
|
||||||
{
|
{
|
||||||
memcpy( &sndTempBuffer16[ei], sndTempBuffer16,
|
memcpy( sndTempBuffer16, &sndTempBuffer16[ei],
|
||||||
sizeof(sndTempBuffer16[0]) * m_dsp_progress
|
sizeof(sndTempBuffer16[0]) * m_dsp_progress
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue