use of com.badlogic.gdx.audio.Music in project Catacomb-Snatch by Catacomb-Snatch.
the class GdxSoundPlayer method startTitleMusic.
@Override
public void startTitleMusic() {
stopBackgroundMusic();
stopEndMusic();
Music titleMusic = getMusic(Sounds.TITLE_THEME);
if (titleMusic == null) {
return;
}
if (musicVolume > 0.0f && !titleMusic.isPlaying() && !paused) {
titleMusic.setLooping(true);
titleMusic.setVolume(musicVolume);
titleMusic.play();
}
TitleIsPlaying = true;
}
use of com.badlogic.gdx.audio.Music in project Catacomb-Snatch by Catacomb-Snatch.
the class GdxSoundPlayer method startBackgroundMusic.
@Override
public void startBackgroundMusic() {
stopTitleMusic();
stopEndMusic();
if (musicVolume > 0.0f && backgroundMusicList.size > 0 && !paused) {
if (backgroundPlaying < 0)
backgroundPlaying = 0;
Music music = backgroundMusicList.get(backgroundPlaying);
if (music == null)
return;
if (!music.isPlaying()) {
if (songEnded == 0) {
songEnded = System.currentTimeMillis();
backgroundPlaying = (backgroundPlaying + 1) >= backgroundMusicList.size ? 0 : backgroundPlaying + 1;
music = backgroundMusicList.get(backgroundPlaying);
}
if (songEnded == 0 || (songEnded + (timeBetweenSongs * 1000)) < System.currentTimeMillis()) {
music.setLooping(false);
music.setVolume(musicVolume);
music.play();
songEnded = 0;
}
}
}
backgroundIsPlaying = true;
}
use of com.badlogic.gdx.audio.Music 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;
}
}
}
use of com.badlogic.gdx.audio.Music in project ultimate-java by pantinor.
the class Sounds method play.
public static Music play(Sound sound, float volume) {
Music m = sounds.get(sound);
if (m == null) {
m = Gdx.audio.newMusic(Gdx.files.internal("assets/sound/" + sound.getFile()));
sounds.put(sound, m);
}
m.setLooping(sound.getLooping());
m.setVolume(volume);
m.play();
return m;
}
Aggregations