Play Sound With Soundpool
I need to play a short sound in my application. I wrote the following code but I have no sound and strange vibration appeared on my Samsung phone. But in the same time this code wo
Solution 1:
There might either be an issue with your volume control or with your sound file playing correctly: if you change the Sound()
function to this what does it do? If your phone is not correctly handling the R.raw.error
file format but the emulator is doing it correctly that would be VERY strange.
public void Sound(){
AudioManager audioManager = (AudioManager) getSystemService(AUDIO_SERVICE);
float volume = (float) audioManager.getStreamVolume(AudioManager.STREAM_MUSIC);
android.util.Log.v("SOUND","["+volume+"]["+spool.play(soundID, volume, volume, 1, 0, 1f)+"]");
};
Post a Comment for "Play Sound With Soundpool"