mirror of
https://git.do.srb2.org/KartKrew/Kart-Public.git
synced 2024-11-10 15:22:20 +00:00
Improved fix by changing the formula for how memory is allocated to arbitrary sample rate conversion.
This commit is contained in:
parent
60a115b0a7
commit
f7bbf8c6d0
1 changed files with 1 additions and 1 deletions
|
@ -152,7 +152,7 @@ static Mix_Chunk *ds2chunk(void *stream)
|
||||||
if (!(frac & 0xFFFF)) // other solid multiples (change if FRACBITS != 16)
|
if (!(frac & 0xFFFF)) // other solid multiples (change if FRACBITS != 16)
|
||||||
newsamples = samples * (frac >> FRACBITS);
|
newsamples = samples * (frac >> FRACBITS);
|
||||||
else // strange and unusual fractional frequency steps, plus anything higher than 44100hz.
|
else // strange and unusual fractional frequency steps, plus anything higher than 44100hz.
|
||||||
newsamples = FixedMul(frac, samples) + 2; // add 2 samples for security! the code below rounds up.
|
newsamples=(samples/freq + 1) *44100 ; //Result of division is not fractional, so 1 is added to ensure a roundup rather than truncation.
|
||||||
if (newsamples >= UINT32_MAX>>2)
|
if (newsamples >= UINT32_MAX>>2)
|
||||||
return NULL; // would and/or did wrap, can't store.
|
return NULL; // would and/or did wrap, can't store.
|
||||||
break;
|
break;
|
||||||
|
|
Loading…
Reference in a new issue