mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-09-05 19:08:12 +00:00
SDL_ResampleAudio: Fix float accumulation error
While78f97108f9
reduced the accumulation error, it was still big enough to cause distortions. Fixes #6196. (cherry picked from commit8145212103
)
This commit is contained in:

committed by
Ryan C. Gordon

parent
3acd1ad25f
commit
f3c466ec1e
@@ -198,7 +198,6 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate,
|
||||
typedef float ResampleFloatType;
|
||||
|
||||
const ResampleFloatType finrate = (ResampleFloatType) inrate;
|
||||
const ResampleFloatType outtimeincr = ((ResampleFloatType) 1.0f) / ((ResampleFloatType) outrate);
|
||||
const ResampleFloatType ratio = ((float) outrate) / ((float) inrate);
|
||||
const int paddinglen = ResamplerPadding(inrate, outrate);
|
||||
const int framelen = chans * (int)sizeof (float);
|
||||
@@ -243,7 +242,7 @@ SDL_ResampleAudio(const int chans, const int inrate, const int outrate,
|
||||
*(dst++) = outsample;
|
||||
}
|
||||
|
||||
outtime = outtimeincr * i;
|
||||
outtime = ((ResampleFloatType) i) / ((ResampleFloatType) outrate);
|
||||
}
|
||||
|
||||
return outframes * chans * sizeof(float);
|
||||
|
Reference in New Issue
Block a user