Properly stopping and resetting Medialayer in AndroidAudioRenderer to be able to play an audio node more than once without failing.

git-svn-id: https://jmonkeyengine.googlecode.com/svn/trunk@9243 75d07b2b-3a1a-0410-a2c5-0572b91ccdca
3.0
rem..om 13 years ago
parent d6bf9372bf
commit 218f082c8b
  1. 9
      engine/src/android/com/jme3/audio/android/AndroidAudioRenderer.java

@ -328,7 +328,13 @@ public class AndroidAudioRenderer implements AudioRenderer,
AudioKey assetKey = (AudioKey) audioData.getAssetKey();
try {
if (audioData.getId() < 0) { // found something to load
System.out.println("Loading "+ assetKey.getName());
String[] files = assetManager.list(".");
for (String string : files) {
System.out.println("file "+ string);
}
int soundId = soundPool.load(
assetManager.openFd(assetKey.getName()), 1);
audioData.setId(soundId);
@ -455,7 +461,8 @@ public class AndroidAudioRenderer implements AudioRenderer,
MediaPlayer mp = musicPlaying.get(src);
if (mp != null) {
mp.stop();
src.setStatus(Status.Paused);
mp.reset();
src.setStatus(Status.Stopped);
} else {
int channel = src.getChannel();
if (channel != -1) {

Loading…
Cancel
Save