mirror of
https://github.com/Ryujinx/SDL.git
synced 2025-01-09 22:45:39 +00:00
SDL_ResampleAudio: Fix float accumulation error
While 78f97108f9
reduced the accumulation error, it was still big enough to cause distortions.
Fixes #6196.
This commit is contained in:
parent
2df39e64ab
commit
8145212103
|
@ -202,7 +202,6 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate,
|
||||||
typedef float ResampleFloatType;
|
typedef float ResampleFloatType;
|
||||||
|
|
||||||
const ResampleFloatType finrate = (ResampleFloatType) inrate;
|
const ResampleFloatType finrate = (ResampleFloatType) inrate;
|
||||||
const ResampleFloatType outtimeincr = ((ResampleFloatType) 1.0f) / ((ResampleFloatType) outrate);
|
|
||||||
const ResampleFloatType ratio = ((float) outrate) / ((float) inrate);
|
const ResampleFloatType ratio = ((float) outrate) / ((float) inrate);
|
||||||
const int paddinglen = ResamplerPadding(inrate, outrate);
|
const int paddinglen = ResamplerPadding(inrate, outrate);
|
||||||
const int framelen = chans * (int)sizeof (float);
|
const int framelen = chans * (int)sizeof (float);
|
||||||
|
@ -247,7 +246,7 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate,
|
||||||
*(dst++) = outsample;
|
*(dst++) = outsample;
|
||||||
}
|
}
|
||||||
|
|
||||||
outtime = outtimeincr * i;
|
outtime = ((ResampleFloatType) i) / ((ResampleFloatType) outrate);
|
||||||
}
|
}
|
||||||
|
|
||||||
return outframes * chans * sizeof (float);
|
return outframes * chans * sizeof (float);
|
||||||
|
|
Loading…
Reference in a new issue