In Midi timing, I have calculated to convert MIDI time to millisecond but contains decimal numbers (e.g. 2000.5454545454). To reduce the loss of precision, what is the best solution to convert into millisecond without the decimal so that the Actionscript can time accurately? Math.Round?开发者_如何学Python
Math.Round is a fine option. If this is a running total and you want to avoid cumulative errors you should keep the running total un-rounded and just pass the rounded value to whatever you're doing in Actionscript. That way you'll never be more than a millisecond off.
Try
trace(Math.Round(2000.54545454));
精彩评论