AndroidAudioRenderer : propperly set the looping value on media player

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

@ -295,8 +295,10 @@ public class AndroidAudioRenderer implements AudioRenderer,
@Override
public void onCompletion(MediaPlayer mp) {
if (mp.isPlaying()) {
mp.seekTo(0);
mp.stop();
}
// XXX: This has bad performance -> maybe change overall structure of
// mediaplayer in this audiorenderer?
for (AudioNode src : musicPlaying.keySet()) {
@ -305,6 +307,7 @@ public class AndroidAudioRenderer implements AudioRenderer,
break;
}
}
}
/**
@ -342,9 +345,15 @@ public class AndroidAudioRenderer implements AudioRenderer,
if (channel == 0) {
soundpoolStillLoading.put(audioData.getId(), src);
} else {
if (src.getStatus() != Status.Stopped) {
soundPool.stop(channel);
src.setStatus(Status.Stopped);
}
src.setChannel(channel); // receive a channel at the last
setSourceParams(src);
// playing at least
}
} catch (IOException e) {
logger.log(Level.SEVERE,
@ -413,7 +422,7 @@ public class AndroidAudioRenderer implements AudioRenderer,
}
private void setSourceParams(AudioNode src, MediaPlayer mp) {
mp.setLooping(true);
mp.setLooping(src.isLooping());
mp.setVolume(src.getVolume(), src.getVolume());
//src.getDryFilter();
}

Loading…
Cancel
Save