在Android中稳定,准确地计时 [英] Steady, accurate timing in Android
问题描述
我正在尝试为Android设备创建音乐音序器应用,希望能获得一些有关如何实现可靠的计时功能的建议.
I'm trying to create a music sequencer app for Android devices and would appreciate some advice as to how to achieve rock-solid timing functionality.
如果我将Runnable传递给Handler.postDelayed并指定x毫秒的延迟时间,那么Runnable是否保证在正好x毫秒的时间内执行?
If I pass a Runnable to Handler.postDelayed and specify a delay time of x milliseconds, is that Runnable guaranteed to be executed in exactly x ms time?
如果使用Handler无法获得稳定而准确的计时,还有什么其他选择可供我选择?
If I can't achieve steady and accurate timing with Handler, what other options are open to me?
提前谢谢
推荐答案
经过大量的搜索后,我设法在这里找到答案:
After much googling I managed to find the answers here:
http://masterex.github.com/存档/2012/05/28/android-audio-synthesis.html
处理程序,Thread.sleep()和计时器似乎不是解决之道.
Handlers, Thread.sleep() and timers are not the way to go it seems.
感谢DrA的回答,我们非常感激-很抱歉没有尽快确认,我已经离开了一段时间.
Thank you DrA for your answer, it was appreciated - sorry for not acknowledging sooner, I've been away for a while.
这篇关于在Android中稳定,准确地计时的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!