Android SounPool 不重叠

发布于 2024-10-06 05:00:56 字数 149 浏览 0 评论 0原文

我想在 Android 中按顺序播放 3 种声音。我创建了一个 SoundPool 并将“maxStreams”设置为“1”,认为在 for 循环中声音会“一次播放一个”而不是同时播放。不幸的是,这是错误的。如何使用 soundPool 按顺序播放声音而不是一次性播放所有声音。谢谢。

I have 3 sounds that I would like to play sequentially in Android. I have created a SoundPool and set the "maxStreams" to "1" thinking that in the for loop the sounds would play "one at a time" not all at once. This, unfortunately, is wrong. How do I play the sounds sequentially and NOT all at once using soundPool. Thanks.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

吃不饱 2024-10-13 05:00:56

SoundPool 没有队列功能。当需要流时,它只会停止以前的声音。

如果超过最大流数,SoundPool 将
首先根据优先级自动停止先前播放的流
然后按该优先级内的年龄。

SoundPool 文档

The SoundPool has no queue feature. It will just stop previous sounds when a stream is needed.

If the maximum number of streams is exceeded, SoundPool will
automatically stop a previously playing stream based first on priority
and then by age within that priority.

SoundPool documentation

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文