创建和关闭网络音频振荡器或继续运行并操纵增益是否更昂贵?
所以我正在构建一个网络应用程序,它有几种不同的可能的声音,可以通过按下按钮来触发。类似选项单选列表之类的东西,您选择您的选项,然后点击播放按钮,它就会播放。
之前只有 2 个源,我创建了整个网络音频路径(振荡器 > 增益 > 平移 > 目的地),然后启动振荡器并更改增益节点以打开和关闭不同的声音。虽然让 6 个网络音频源始终运行(但其中两个增益为 0),但这似乎是一个坏主意。
所以我的问题是:运行 6 个源,并切换我想要打开的一两个源的增益节点并将另外两个设为 0(以“关闭它们”)是否更好,还是最好在每个周期启动和停止不同的振荡器节点(将它们留给垃圾回收)。
在给定的会话中,用户可能会以不同的频率创建数百个小嘘声和嘟嘟声 - 因此控制创建和销毁每个声音感觉很麻烦。但与此同时,我不希望我的应用程序性能因在后台不断运行 6 个网络音频源而受到影响。
有什么想法或想法吗?
So I have a web app I'm building that has several different possible sounds that can be triggered by a button press. Something like a radio list of options and you choose your option and then hit the play button and it plays.
previously with only 2 sources, I created the entire web audio pathway (oscillator > gain > pan > destination) and then started the oscillator and just changed the with the gain node to turn on and off different sounds. It seems like a bad idea though to have 6 web audio sources always running (but with two of them at 0 gain).
So my question is this: Is it better to run 6 sources, and toggle the gain node for the one or two I want to be on and the other two to be 0 (to "turn them off"), or is it better to start and stop the different oscillator nodes (leaving them for garbage collection) on each cycle.
In a given session, a user may create hundreds of little boops and beeps at different frequencies - so it feels like trouble to control creating and destroying each one. But at the same time, I don't want my apps performance to suffer by constantly running 6 web audio sources in the background.
Any thoughts or ideas?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论