Some games use volume slides combined with reversed phase. 
Gigaherz tweaked the code to handle this nicer (fixes Mashed Drive to Survive noises).

git-svn-id: http://pcsx2.googlecode.com/svn/trunk@5139 96395faa-99c1-11dd-bbfe-3dabce05a288
This commit is contained in:
ramapcsx2 2012-04-01 14:09:24 +00:00
parent b6954701e8
commit 03db2fcf4e
1 changed files with 14 additions and 10 deletions

View File

@ -196,21 +196,23 @@ void V_VolumeSlide::Update()
if( Increment == 0x7f ) return; if( Increment == 0x7f ) return;
s32 value = abs(Value);
if (Mode & VOLFLAG_DECREMENT) if (Mode & VOLFLAG_DECREMENT)
{ {
// Decrement // Decrement
if(Mode & VOLFLAG_EXPONENTIAL) if(Mode & VOLFLAG_EXPONENTIAL)
{ {
u32 off = InvExpOffsets[(Value>>28)&7]; u32 off = InvExpOffsets[(value>>28)&7];
Value -= PsxRates[(Increment^0x7f)-0x1b+off+32]; value -= PsxRates[(Increment^0x7f)-0x1b+off+32];
} }
else else
Value -= PsxRates[(Increment^0x7f)-0xf+32]; value -= PsxRates[(Increment^0x7f)-0xf+32];
if (Value < 0) if (value < 0)
{ {
Value = 0; value = 0;
Mode = 0; // disable slide Mode = 0; // disable slide
} }
} }
@ -220,16 +222,18 @@ void V_VolumeSlide::Update()
// Pseudo-exponential increments, as done by the SPU2 (really!) // Pseudo-exponential increments, as done by the SPU2 (really!)
// Above 75% slides slow, below 75% slides fast. It's exponential, pseudo'ly speaking. // Above 75% slides slow, below 75% slides fast. It's exponential, pseudo'ly speaking.
if( (Mode & VOLFLAG_EXPONENTIAL) && (Value>=0x60000000)) if( (Mode & VOLFLAG_EXPONENTIAL) && (value>=0x60000000))
Value += PsxRates[(Increment^0x7f)-0x18+32]; value += PsxRates[(Increment^0x7f)-0x18+32];
else else
// linear / Pseudo below 75% (they're the same) // linear / Pseudo below 75% (they're the same)
Value += PsxRates[(Increment^0x7f)-0x10+32]; value += PsxRates[(Increment^0x7f)-0x10+32];
if( Value < 0 ) // wrapped around the "top"? if( value < 0 ) // wrapped around the "top"?
{ {
Value = 0x7fffffff; value = 0x7fffffff;
Mode = 0; // disable slide Mode = 0; // disable slide
} }
} }
Value = (Value < 0) ? -value : value;
} }