可以在ActionScript和工人用来播放/产生声音在一个单独的线程? [英] Can ActionScript Workers be used to play / generate Sounds in a separate thread?

查看:197
本文介绍了可以在ActionScript和工人用来播放/产生声音在一个单独的线程?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

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

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:

<一个href="http://flexmonkey.blogspot.co.uk/2012/09/multi-threaded-sound-synthesis-in-flex.html#!/2012/09/multi-threaded-sound-synthesis-in-flex.html" rel="nofollow">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.

西蒙

这篇关于可以在ActionScript和工人用来播放/产生声音在一个单独的线程?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆