@Override public void dispose () { batch.dispose(); buttons.getTexture().dispose(); music.dispose(); } }
void setSong (Song song) { if (music != null) { music.dispose(); } switch (song) { default: case MP3: music = Gdx.audio.newMusic(Gdx.files.internal("data/8.12.mp3")); songDuration = 183; break; case OGG: music = Gdx.audio.newMusic(Gdx.files.internal("data/cloudconnected.ogg")); songDuration = 22; break; case WAV: music = Gdx.audio.newMusic(Gdx.files.internal("data/8.12.loop.wav")); songDuration = 4; break; } music.setLooping(btLoop.isChecked()); music.play(); }
@Override public void dispose() { for (Music song : songs) { song.dispose(); } }
public void dispose() { music.dispose(); }
public void stop() { if (player != null) { player.stop(); player.dispose(); player = null; } }
@Override public void dispose() { super.dispose(); music.dispose(); }
@Override public void dispose() { for (Texture t : images.values()) t.dispose(); images.clear(); credits.clear(); if (music != null) { music.stop(); music.dispose(); music = null; } }
/**卸载所有音乐,清除循环*/ public void disposeAll() { Stream.of(manager.values()).forEach(p -> p.music.dispose()); manager.clear(); //取消循环托管 Timer.remove(loopTask); }
private void disposeInstance() { if (currentMusic != null) { currentMusic.stop(); currentMusic.dispose(); } if (EventManager.instance != null) EventManager.instance.unsubscribe(this, Events.MUSIC_NEXT_CMD, Events.MUSIC_PLAYPAUSE_CMD, Events.MUSIC_PREVIOUS_CMD, Events.MUSIC_VOLUME_CMD, Events.MUSIC_RELOAD_CMD); }
public void dispose(){ for(Music music:musics.values()){ if(null!=music)music.dispose(); } this.musics.clear(); this.musicVolume = 1.0f; } }
private void disposeOf(Music mus) { if(mus == null) return;; if(mus.isPlaying()) mus.stop(); mus.dispose(); }
/** * Cleans up resources. To be called when this instance is no longer needed. */ public void dispose() { if (isPlaying()) { throw new RuntimeException("Cannot dispose of a music instance that is currently playing"); } if(currentTrack.isPlaying()) { currentTrack.stop(); } if(nextTrack.isPlaying()) { nextTrack.stop(); } currentTrack.dispose(); nextTrack.dispose(); scheduledExecutorService.shutdown(); }
private void processCreditMusic(final String s) { if (music != null) music.dispose(); final String sound = EngineAssetManager.getInstance().checkIOSSoundName("music/" + s); new Thread() { @Override public void run() { music = Gdx.audio.newMusic(EngineAssetManager.getInstance().getAsset(sound)); try { music.play(); } catch(Exception e) { // sometimes the play method fails on desktop. EngineLogger.error("Error Playing music: " + s, e); } } }.start(); }
@Override public void dispose() { map.dispose(); renderer.dispose(); atlas.dispose(); batch.dispose(); song.dispose(); }
@Override public void dispose() { dropImage.dispose(); bucketImage.dispose(); dropSound.dispose(); rainMusic.dispose(); batch.dispose(); }
@Override public void clicked(InputEvent event, float x, float y) { if (theSong != null) { theSong.stop(); theSong.dispose(); } ((Game) Gdx.app.getApplicationListener()).setScreen(new SongSelectionScreen()); } }));
@Override public void clicked(InputEvent event, float x, float y) { if (theSong != null) { theSong.stop(); theSong.dispose(); } ((Game) Gdx.app.getApplicationListener()).setScreen(new SongScreen()); } }));
@Override public boolean keyUp(int keycode) { if (keycode == Input.Keys.BACK || keycode == Input.Keys.ESCAPE) { if (theSong != null) { theSong.stop(); theSong.dispose(); } ((Game) Gdx.app.getApplicationListener()).setScreen(new SongSelectionScreen()); // do nothing return true; } return false; }
@Override public void dispose() { if (stage != null) { stage.dispose(); stage = null; if (bgTexFile != null) { bgTexFile.dispose(); bgTexFile = null; } if (titleTexFile != null) { titleTexFile.dispose(); titleTexFile = null; } if (music != null) { music.stop(); music.dispose(); music = null; } } }
private void playIndex(int i) { FileHandle f = musicFiles.get(i); if (currentMusic != null) { if (currentMusic.isPlaying()) { currentMusic.stop(); } currentMusic.dispose(); } try { currentMusic = Gdx.audio.newMusic(f); currentMusic.setVolume(volume); currentMusic.setOnCompletionListener(new OnCompletionListener() { @Override public void onCompletion(Music music) { playNextMusic(); } }); currentMusic.play(); EventManager.instance.post(Events.MUSIC_TRACK_INFO, musicFiles.get(i).name()); logger.info(I18n.bundle.format("gui.music.playing", musicFiles.get(i).name())); } catch (Exception e) { logger.error(e); } }