use of com.badlogic.gdx.audio.Music.OnCompletionListener in project bladecoder-adventure-engine by bladecoder.
the class VoiceManager method retrieveAssets.
@Override
public void retrieveAssets() {
if (voice == null && fileName != null) {
if (!EngineAssetManager.getInstance().isLoaded(EngineAssetManager.VOICE_DIR + fileName)) {
loadAssets();
try {
EngineAssetManager.getInstance().finishLoading();
} catch (GdxRuntimeException e) {
EngineLogger.error(e.getMessage());
voice = null;
fileName = null;
textManager.next();
return;
}
}
EngineLogger.debug("RETRIEVING VOICE: " + fileName);
voice = EngineAssetManager.getInstance().get(EngineAssetManager.VOICE_DIR + fileName, Music.class);
voice.setOnCompletionListener(new OnCompletionListener() {
@Override
public void onCompletion(Music music) {
if (textManager.getCurrentText() != null)
textManager.getCurrentText().setAutoTime();
}
});
if (voice != null)
voice.setVolume(volume);
if (isPlayingSer) {
voice.play();
if (voice != null) {
voice.setPosition(voicePosSer);
}
isPlayingSer = false;
voicePosSer = 0f;
}
}
}
Aggregations