如果我想每秒播放同一个声音 10 次,内存中是否必须有该声音的 10 个副本?
我有一个声音需要每秒播放 10 次。声音时长1秒。所以它确实重叠了 10 次。然而,据我了解 Finch 声音库,我需要 10 个不同的声音实例,以便我几乎可以同时播放 10 次。
当我只有一个实例时,声音会在每次迭代时停止并从头开始播放,但不会与其自身重叠。
怎么做呢?
I have a sound that needs to get played 10 times per second. The sound is 1 second long. So it does overlap like 10 times. However, as far as I understand the Finch sound library, I would need 10 different instances of a sound in place so that I can play it 10 times at almost the same time.
When I have just one instance, the sound would stop and play from the beginning on every iteration, but not overlap with itself.
How to do that?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
在 Finch 中,这取决于您想要同时播放特定声音的实例数。将此数字传递给
RevolverSound
类的initWithFile:rounds:
初始值设定项,它将分配所需数量的样本副本。In Finch it depends on how many instances of the particular sound you want to play simultaneously. Pass this number to the
initWithFile:rounds:
initializer of theRevolverSound
class and it will allocate the desired number of copies of the sample.不太可能。取决于您使用的声音系统/卡和 API。通常它是即发即忘(即发即加载数据流,告诉音频系统播放流 X 次)。要使其重叠,您可能需要使用多个通道。我对 finch 不熟悉,不知道它是如何处理这类事情的。
Unlikely. Depends on the sound system/card and the API you're using. Usually it's fire and forget (where fire is load the data stream, tell audio system to play stream X times). To get it to overlap, you'd may need to use multiple channels. I'm not familiar with finch to know how it handles that sort of thing.