我正在使用以下方法在 X 次/分钟内发送声音(X 是通过 bpm 确定的,它是一个 NumericStepper 对象)
var mainTimer:Timer = new Timer(60 / (bpm.value * 1000),0);
mainTimer.addEventListener(TimerEvent.TIMER, fl_TimerHandler,false, 0, true);
mainTimer.start();
function fl_TimerHandler(event:TimerEvent):void
{
metroTransform.volume = vol;
flash.media.SoundMixer.soundTransform = metroTransform;
metroChannel = metro.play();
mainTimer.delay = 60 / bpm.value * 1000;
}
根据这个http://www.metronomeonline.com/声音不太好。我能做些什么来解决我陷入的这个问题吗?
我得到的输出文件的路径:http://conatur.net/metroBig.swf
最佳答案
http://cookbooks.adobe.com/post_Accurate_timer-17332.html可能对你有帮助。
Problem
The delay between 2 events of the timer class depends on many factors ( fps, memory, played movie clip end i.e. ). The timeout set to property delay of timer class is only approximate so there needs to be a way to increase the accuracy of the timer.Solution
My solution to increase the accuracy is to extend the timer class and force the timer to make more cycles depending of the custom property accurate. In this way the delay between 2 events of the timer will be set delay - + accurate /2. Because the rising of the event depends form many factors truly delay between 2 events is from: delay - accurate/2 to next fired event from flash player.
关于flash - 如何使计时器准确? (闪光灯/ ActionScript 3.0),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/5955044/