Skip to content

Commit

Permalink
that should be 0x8000
Browse files Browse the repository at this point in the history
  • Loading branch information
nadiaholmquist committed Mar 8, 2024
1 parent faf3c0f commit b117bb8
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions src/SPU.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -659,13 +659,13 @@ s32 SPUChannel::Run()

case AudioInterpolation::SNESGaussian: {
// Avoid clipping (from fullsnes)
#define CLAMP(s) (std::clamp((s) >> 1, -0x3FFA, 0x3FF8))
#define CLAMP(s) (std::clamp((s) >> 1, -0x3FFA, 0x3FF8))
s32 out = (InterpSNESGauss[0x0FF - samplepos] * CLAMP(PrevSample[2]) >> 10);
out = out + ((InterpSNESGauss[0x1FF - samplepos] * CLAMP(PrevSample[1])) >> 10);
out = out + ((InterpSNESGauss[0x100 + samplepos] * CLAMP(PrevSample[0])) >> 10);
out = out + ((InterpSNESGauss[0x000 + samplepos] * CLAMP(val)) >> 10);
val = std::clamp(out, -0x7FFF, 0x7FFF);
#undef CLAMP
val = std::clamp(out, -0x8000, 0x7FFF);
#undef CLAMP
break;
}

Expand Down

0 comments on commit b117bb8

Please sign in to comment.