mirror of
https://git.do.srb2.org/STJr/SRB2.git
synced 2025-01-29 12:40:58 +00:00
Uses fixed-point math to properly calculate the exact amount of space needed.
This commit is contained in:
parent
f7bbf8c6d0
commit
b21d5c55c9
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)
|
||||
newsamples = samples * (frac >> FRACBITS);
|
||||
else // strange and unusual fractional frequency steps, plus anything higher than 44100hz.
|
||||
newsamples=(samples/freq + 1) *44100 ; //Result of division is not fractional, so 1 is added to ensure a roundup rather than truncation.
|
||||
newsamples = FixedMul(FixedDiv(samples, freq), 44100) + 1; // add 1 to counter truncation.
|
||||
if (newsamples >= UINT32_MAX>>2)
|
||||
return NULL; // would and/or did wrap, can't store.
|
||||
break;
|
||||
|
|
Loading…
Reference in a new issue