use of com.badlogic.gdx.audio.Music in project Catacomb-Snatch by Catacomb-Snatch.
the class GdxSoundPlayer method loadMusic.
private void loadMusic(Sounds music) {
try {
Gdx.app.log(TAG, Gdx.files.internal("music/" + music.name + ".ogg").file().getAbsolutePath());
Music file = Gdx.audio.newMusic(Gdx.files.internal("music/" + music.name + ".ogg"));
// If background track, add to playlist
if (music.name.toLowerCase().startsWith("background"))
backgroundMusicList.add(file);
musicMap.put(music.name, file);
} catch (GdxRuntimeException e) {
Gdx.app.log(TAG, "Error loading musicfile: " + music.name + ": " + e.getMessage());
}
}
use of com.badlogic.gdx.audio.Music in project libgdx by libgdx.
the class MusicLoader method loadSync.
@Override
public Music loadSync(AssetManager manager, String fileName, FileHandle file, MusicParameter parameter) {
Music music = this.music;
this.music = null;
return music;
}
use of com.badlogic.gdx.audio.Music in project libgdx by libgdx.
the class ExternalMusicTest method create.
@Override
public void create() {
// copy an internal mp3 to the external storage
FileHandle src = Gdx.files.internal("data/8.12.mp3");
FileHandle dst = Gdx.files.external("8.12.mp3");
src.copyTo(dst);
// create a music instance and start playback
Music music = Gdx.audio.newMusic(dst);
music.play();
}
use of com.badlogic.gdx.audio.Music in project ultimate-java by pantinor.
the class Sounds method play.
public static Music play(Sound sound, OnCompletionListener ocl) {
Music m = sounds.get(sound);
if (m == null) {
m = Gdx.audio.newMusic(Gdx.files.internal("assets/sound/" + sound.getFile()));
m.setVolume(sound.getVolume());
m.setLooping(sound.getLooping());
sounds.put(sound, m);
}
m.setOnCompletionListener(ocl);
m.play();
return m;
}
use of com.badlogic.gdx.audio.Music in project Catacomb-Snatch by Catacomb-Snatch.
the class GdxSoundPlayer method stopTitleMusic.
@Override
public void stopTitleMusic() {
Music titleMusic = getMusic(Sounds.TITLE_THEME);
if (titleMusic == null) {
return;
}
if (titleMusic.isPlaying()) {
titleMusic.stop();
}
TitleIsPlaying = false;
}
Aggregations