add interpolation at loop boundary

Fixes crackling in small streams and correctly interpolates chip-style samples
This commit is contained in:
Ruben 2019-10-28 15:28:09 +11:00 committed by GitHub
parent 46980d7732
commit 0dc75ca089
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 13 additions and 15 deletions

View File

@ -1058,12 +1058,12 @@ template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE void Fetch8Bi
u32 loc = sputrunc(chan->sampcnt);
if(INTERPOLATE_MODE != SPUInterpolation_None)
{
s32 a = (s32)(read_s8(chan->addr + loc) << 8);
if(loc < (chan->totlength << 2) - 1) {
s32 b = (s32)(read_s8(chan->addr + loc + 1) << 8);
a = Interpolate<INTERPOLATE_MODE>(a, b, chan->sampcnt);
}
*data = a;
s32 a = (s32)(read_s8(chan->addr + loc) << 8), b = a;
if(loc < (chan->totlength << 2) - 1)
b = (s32)(read_s8(chan->addr + loc + 1) << 8);
else if(chan->repeat == 1)
b = (s32)(read_s8(chan->addr + chan->loopstart*4) << 8);
*data = Interpolate<INTERPOLATE_MODE>(a, b, chan->sampcnt);
}
else
*data = (s32)read_s8(chan->addr + loc)<< 8;
@ -1077,20 +1077,18 @@ template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE void Fetch16B
return;
}
u32 loc = sputrunc(chan->sampcnt);
if(INTERPOLATE_MODE != SPUInterpolation_None)
{
u32 loc = sputrunc(chan->sampcnt);
s32 a = (s32)read16(loc*2 + chan->addr), b;
s32 a = (s32)read16(loc*2 + chan->addr), b = a;
if(loc < (chan->totlength << 1) - 1)
{
b = (s32)read16(loc*2 + chan->addr + 2);
a = Interpolate<INTERPOLATE_MODE>(a, b, chan->sampcnt);
}
*data = a;
b = (s32)read16(chan->addr + loc*2 + 2);
else if(chan->repeat == 1)
b = (s32)read16(chan->addr + chan->loopstart*2);
*data = Interpolate<INTERPOLATE_MODE>(a, b, chan->sampcnt);
}
else
*data = read16(chan->addr + sputrunc(chan->sampcnt)*2);
*data = read16(chan->addr + loc*2);
}
template<SPUInterpolationMode INTERPOLATE_MODE> static FORCEINLINE void FetchADPCMData(channel_struct * const chan, s32 * const data)