(Android版)如何判断一个声音在玩的Soundpool [英] (Android) How to tell if a sound is playing in soundpool

查看:233
本文介绍了(Android版)如何判断一个声音在玩的Soundpool的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

有没有一种方法,如果某个声音在播放的Soundpool我可以告诉大家?
即。

Is there a way I can tell if a certain sound is playing in SoundPool??? I.E.

    if(MySound./*Command Goes Here*/()==true{
//Do stuff
        }

我AP preciate如果你能指出我在正确的方向,或给我的code。我无法找到,这是否对文档的任何事情。
在先进的感谢。

I would appreciate if you could point me in the right direction or give me the code. I am not able to find any thing that does this on the docs. Thanks in advanced.

推荐答案

这是不可能使用的Soundpool

请参阅Android的Soundpool:得到通知时起到结束的另外两个思路:

See Android SoundPool: get notified when end of played for two other ideas:


  • 使用的MediaPlayer ,它提供了一个 OnCompletionListener ,而不是的Soundpool

  • 使用的MediaPlayer 的Soundpool 一起。加载在的MediaPlayer 事先声音得到持续时间和跟踪的声音是否是做打根据其持续时间与的Soundpool

  • Use MediaPlayer, which provides an OnCompletionListener, instead of SoundPool
  • Use MediaPlayer in conjunction with SoundPool. Load the sound in a MediaPlayer beforehand to get the duration and keep track of whether the sound is done playing based its duration when played with SoundPool.

这篇关于(Android版)如何判断一个声音在玩的Soundpool的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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