可以在ActionScript和工人用来播放/产生声音在一个单独的线程?线程、工人、声音、ActionScript

2023-09-08 13:44:34 作者:最后一次颓废

我很新的动作工人,但我想知道这是可能的。

I'm very new to ActionScript Workers, but I would like to know if this is possible.

从我已阅读,动作工人(ASW)都是这样,可以做更多的CPU密集型的计算,而无需中断主线程(这是执行你的主SWF文件)单独的线程。

From what I have read, ActionScript Workers (ASW) are like separate threads that can do more CPU intensive calculations without interrupting the Main thread (which is executing your main SWF file).

我真正看到踢周围的唯一例子是一个说明打出了一致的速度,而反潜照顾负荷或计算密集的一些数学公式动画。

The only example I really seen kicking around was the one illustrating animation playing at a consistent rate while an ASW took care of loading or calculating some intensive math formulas.

时的声音API可以ActionScriptWorkers?

Is the Sound API available for ActionScriptWorkers?

推荐答案

(在我的正确登录转载)的

(Reposted under my proper login)

他们当然可以!看看我最近的一篇博客上的正是这一点:

They certainly can! Check out my recent blog post on exactly this:

http://flexmonkey.blogspot.co.uk/2012/09/multi-threaded-sound-synthesis-in-flex.html#!/2012/09/multi-threaded-sound-synthesis-in-flex.html

修修补补的公平一点之后,我竟产生了后台工作一个字节数组,然后将数据写回向SampleDataEvent的数据属性在原始线程(即用户界面)。

After a fair bit of tinkering, I actually generate a byte array in a background worker and then write the data back to the SampleDataEvent's data property in the primordial thread (i.e. the user interface).

我写从previous的SampleDataEvent工人中的数据,而工人产生了数据的下一个 - 这样的FlashPlayer实际上是在做三个任务同时进行:提供一个反应灵敏的用户界面,播放提示音,并产生下一个音调

I write the data from the worker from the previous SampleDataEvent while the worker generates the data for the next one - so FlashPlayer is actually doing three tasks simultaneously: offering a responsive UI, playing a tone and generating the next tone.

西蒙