Search in sources :

Example 1 with Music

use of com.badlogic.gdx.audio.Music in project Catacomb-Snatch by Catacomb-Snatch.

the class GdxSoundPlayer method startEndMusic.

@Override
public void startEndMusic() {
    stopBackgroundMusic();
    stopTitleMusic();
    Music endMusic = getMusic(Sounds.END_THEME);
    if (endMusic == null) {
        return;
    }
    if (musicVolume > 0.0f && !endMusic.isPlaying() && !paused) {
        endMusic.setLooping(true);
        endMusic.setVolume(musicVolume);
        endMusic.play();
    }
    TheEndIsPlaying = true;
}
Also used : Music(com.badlogic.gdx.audio.Music)

Example 2 with Music

use of com.badlogic.gdx.audio.Music in project Catacomb-Snatch by Catacomb-Snatch.

the class GdxSoundPlayer method shutdown.

@Override
public void shutdown() {
    Music music;
    // unloading Title music
    stopTitleMusic();
    music = getMusic(Sounds.TITLE_THEME);
    if (music != null) {
        music.dispose();
    }
    // unloading End music
    stopEndMusic();
    music = getMusic(Sounds.END_THEME);
    if (music != null) {
        music.dispose();
    }
    // unloading Background music
    stopBackgroundMusic();
    for (Music m : backgroundMusicList) {
        if (m.isPlaying())
            m.stop();
        m.dispose();
    }
    // unloading sounds
    if (soundsMap.size > 0) {
        for (Sound s : soundsMap.values()) {
            s.stop();
            s.dispose();
        }
    }
}
Also used : Music(com.badlogic.gdx.audio.Music) Sound(com.badlogic.gdx.audio.Sound)

Example 3 with Music

use of com.badlogic.gdx.audio.Music in project Catacomb-Snatch by Catacomb-Snatch.

the class GdxSoundPlayer method stopEndMusic.

@Override
public void stopEndMusic() {
    Music endMusic = getMusic(Sounds.END_THEME);
    if (endMusic == null) {
        return;
    }
    if (endMusic.isPlaying()) {
        endMusic.stop();
    }
    TheEndIsPlaying = false;
}
Also used : Music(com.badlogic.gdx.audio.Music)

Example 4 with Music

use of com.badlogic.gdx.audio.Music in project Catacomb-Snatch by Catacomb-Snatch.

the class GdxSoundPlayer method stopBackgroundMusic.

@Override
public void stopBackgroundMusic() {
    if (backgroundPlaying < 0)
        return;
    for (Music m : backgroundMusicList) {
        if (m.isPlaying())
            m.stop();
    }
    backgroundPlaying = -1;
    backgroundIsPlaying = false;
}
Also used : Music(com.badlogic.gdx.audio.Music)

Example 5 with Music

use of com.badlogic.gdx.audio.Music in project Catacomb-Snatch by Catacomb-Snatch.

the class GdxSoundPlayer method pauseBackgroundMusic.

@Override
public void pauseBackgroundMusic() {
    paused = true;
    if (backgroundPlaying >= 0)
        backgroundMusicList.get(backgroundPlaying).pause();
    Music music;
    music = getMusic(Sounds.TITLE_THEME);
    if (music != null && TitleIsPlaying) {
        music.pause();
    }
    music = getMusic(Sounds.END_THEME);
    if (music != null && TheEndIsPlaying) {
        music.pause();
    }
}
Also used : Music(com.badlogic.gdx.audio.Music)

Aggregations

Music (com.badlogic.gdx.audio.Music)14 GdxRuntimeException (com.badlogic.gdx.utils.GdxRuntimeException)2 OnCompletionListener (com.badlogic.gdx.audio.Music.OnCompletionListener)1 Sound (com.badlogic.gdx.audio.Sound)1 FileHandle (com.badlogic.gdx.files.FileHandle)1