我点击按钮时会使用声音池播放声音
mVolume = 6
,maxVolume = 10
,minVolume = 0
playButton.setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View v) {
if (canPlaySound){
mSoundPool.play(soundId, (float) mVolume / maxVolume,
(float) mVolume / minVolume, 1, 0
, 1.0f);
}
}
});
Debbuging canPlaySound
始终为true,但单击第一行按钮时,声音仅播放一次。