scummvm/scummvm — pull request #345 by countingpine (2013-06-26 15:12:32+00:00)
Title: SCUMM: More precise Player_Mac::durationToSamples

Untested, but the largest result in the whole calculation is `duration * _sampleRate`, so as long as it's divided by something greater than 473, the calculation is no more likely to overflow.

Note: the calculation could be made even more accurate by doing:

(d * s * 473 / 480) / (4*480)
= (d*s - d*s*5/480) / (4*480)
~= (d*s - d*s/480 - d*s/120) / (4*480)

But this comes at the cost of an additional division. It would also require more tweaking should 473 turn out to be 437. It's perhaps no better a solution than going to 64-bit math.