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
This commit is contained in:
parent
d6bf9372bf
commit
218f082c8b
@ -328,7 +328,13 @@ public class AndroidAudioRenderer implements AudioRenderer,
|
|||||||
AudioKey assetKey = (AudioKey) audioData.getAssetKey();
|
AudioKey assetKey = (AudioKey) audioData.getAssetKey();
|
||||||
|
|
||||||
try {
|
try {
|
||||||
|
|
||||||
if (audioData.getId() < 0) { // found something to load
|
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(
|
int soundId = soundPool.load(
|
||||||
assetManager.openFd(assetKey.getName()), 1);
|
assetManager.openFd(assetKey.getName()), 1);
|
||||||
audioData.setId(soundId);
|
audioData.setId(soundId);
|
||||||
@ -455,7 +461,8 @@ public class AndroidAudioRenderer implements AudioRenderer,
|
|||||||
MediaPlayer mp = musicPlaying.get(src);
|
MediaPlayer mp = musicPlaying.get(src);
|
||||||
if (mp != null) {
|
if (mp != null) {
|
||||||
mp.stop();
|
mp.stop();
|
||||||
src.setStatus(Status.Paused);
|
mp.reset();
|
||||||
|
src.setStatus(Status.Stopped);
|
||||||
} else {
|
} else {
|
||||||
int channel = src.getChannel();
|
int channel = src.getChannel();
|
||||||
if (channel != -1) {
|
if (channel != -1) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user