mirror of https://github.com/PCSX2/pcsx2.git
SPU2ghz: Minor tweaks to the mixer that should help get rid of overflow problems. This is the first part of a 2 part commit that should help correct some old-timey volume inaccuracies in the plugin.
git-svn-id: http://pcsx2-playground.googlecode.com/svn/trunk@403 a6443dda-0b58-4228-96e9-037be469359c
This commit is contained in:
parent
2110a33996
commit
b938d41e2b
|
@ -1007,7 +1007,7 @@ double diff=0;
|
|||
|
||||
static __forceinline s32 ApplyVolume(s32 data, s32 volume)
|
||||
{
|
||||
return (volume * data);
|
||||
return (volume * data) >> 6;
|
||||
}
|
||||
|
||||
// writes a signed value to the SPU2 ram
|
||||
|
@ -1058,6 +1058,7 @@ static __forceinline void MixVoice( V_Core& thiscore, V_Voice& vc, s32& VValL, s
|
|||
|
||||
VValL=ApplyVolume(Value,(vc.VolumeL.Value));
|
||||
VValR=ApplyVolume(Value,(vc.VolumeR.Value));
|
||||
|
||||
}
|
||||
|
||||
if (voice==1) spu2M_WriteFast( 0x400 + (core<<12) + OutPos, (s16)Value );
|
||||
|
|
|
@ -202,7 +202,7 @@ public:
|
|||
// up audio playback.
|
||||
cTempo += cTempo * 0.12f;
|
||||
eTempo += eTempo * 0.40f;
|
||||
if( eTempo > 7.5f ) eTempo = 5.0f;
|
||||
if( eTempo > 7.5f ) eTempo = 7.5f;
|
||||
pSoundTouch->setTempo( eTempo );
|
||||
|
||||
// Throw out just a little bit (two packets worth) to help
|
||||
|
@ -728,6 +728,11 @@ s32 SndWrite(s32 ValL, s32 ValR)
|
|||
bool progress = false;
|
||||
|
||||
// data prediction helps keep the tempo adjustments more accurate.
|
||||
// The timestretcher returns packets in belated "clump" form.
|
||||
// Meaning that most of the time we'll get nothing back, and then
|
||||
// suddenly we'll get several chunks back at once. Thus we use
|
||||
// data prediction to make the timestretcher more responsive.
|
||||
|
||||
sndBuffer->PredictDataWrite( (int)( sndTempProgress / eTempo ) );
|
||||
for(int i=0;i<sndTempProgress;i++) { ((float*)sndTempBuffer)[i] = sndTempBuffer[i]/2147483648.0f; }
|
||||
|
||||
|
@ -735,12 +740,6 @@ s32 SndWrite(s32 ValL, s32 ValR)
|
|||
|
||||
while( ( sndTempProgress = pSoundTouch->receiveSamples((float*)sndTempBuffer, sndTempProgress>>1)<<1 ) != 0 )
|
||||
{
|
||||
// The timestretcher returns packets in belated "clump" form.
|
||||
// Meaning that most of the time we'll get nothing back, and then
|
||||
// suddenly we'll get several chunks back at once. That's
|
||||
// why we only update the tempo below after a set of blocks has been
|
||||
// released (otherwise the tempo rates will be skewed by backlogged data)
|
||||
|
||||
// [Air] [TODO] : Implement an SSE downsampler to int.
|
||||
for(int i=0;i<sndTempProgress;i++)
|
||||
{
|
||||
|
@ -752,10 +751,9 @@ s32 SndWrite(s32 ValL, s32 ValR)
|
|||
|
||||
UpdateTempoChange();
|
||||
|
||||
if( progress )
|
||||
if( MsgOverruns() )
|
||||
{
|
||||
|
||||
if( MsgOverruns() )
|
||||
if( progress )
|
||||
{
|
||||
if( ++ts_stats_logcounter > 300 )
|
||||
{
|
||||
|
|
|
@ -23,7 +23,7 @@
|
|||
// SndOut.
|
||||
static const int SndOutPacketSize = 1024;
|
||||
|
||||
static const int SndOutVolumeShiftBase = 14;
|
||||
static const int SndOutVolumeShiftBase = 8;
|
||||
extern int SndOutVolumeShift;
|
||||
|
||||
#define pcmlog
|
||||
|
|
Loading…
Reference in New Issue