Tabnine Logo
Music.stop
Code IndexAdd Tabnine to your IDE (free)

How to use
stop
method
in
com.badlogic.gdx.audio.Music

Best Java code snippets using com.badlogic.gdx.audio.Music.stop (Showing top 20 results out of 315)

origin: libgdx/libgdx

@Override
public void render () {
  currentPosition = music.getPosition();
  Gdx.gl.glClear(GL20.GL_COLOR_BUFFER_BIT);
  batch.begin();
  batch.draw(buttons, 0, 0);
  font.draw(batch, (int)currentPosition / 60 + ":" + (int)currentPosition % 60, 365, 35);
  batch.end();
  sliderUpdating = true;
  slider.setValue((currentPosition / songDuration) * 100f);
  sliderUpdating = false;
  stage.act();
  stage.draw();
  if (Gdx.input.justTouched()) {
    if (Gdx.input.getY() > Gdx.graphics.getHeight() - 64) {
      if (Gdx.input.getX() < 64) {
        music.play();
      }
      if (Gdx.input.getX() > 64 && Gdx.input.getX() < 128) {
        music.stop();
      }
      if (Gdx.input.getX() > 128 && Gdx.input.getX() < 192) {
        music.pause();
      }
    }
  }
}
origin: Var3D/var3dframe

/**
 * 停止音乐
 */
public void stopMusic() {
  if (music != null) {
    music.stop();
    music = null;
  }
}
origin: moribitotech/MTX

public void stopMusic() {
  if (currentMusic != null) {
    currentMusic.stop();
  }
}
origin: nifty-gui/nifty-gui

@Override
public void stop() {
 music.stop();
}
origin: moribitotech/MTX

private void clearCurrentMusic() {
  if (currentMusic != null) {
    currentMusic.stop();
    currentMusic = null;
  }
}
origin: com.github.nifty-gui/nifty-libgdx-renderer

@Override
public void stop() {
 music.stop();
}
origin: bladecoder/bladecoder-adventure-engine

public void stop() {
  if (voice != null) {
    voice.stop();
    dispose();
  }
}
origin: 00-Evan/shattered-pixel-dungeon-gdx

public void stop() {
  if (player != null) {
    player.stop();
    player.dispose();
    player = null;
  }
}

origin: Catacomb-Snatch/Catacomb-Snatch

@Override
public void stopBackgroundMusic() {
  if (backgroundPlaying < 0) return;
  for (Music m : backgroundMusicList) {
    if (m.isPlaying()) m.stop();
  }
  backgroundPlaying = -1;
  backgroundIsPlaying = false;
}
origin: bladecoder/bladecoder-adventure-engine

@Override
public void dispose() {
  for (Texture t : images.values())
    t.dispose();
  images.clear();
  credits.clear();
  if (music != null) {
    music.stop();
    music.dispose();
    music = null;
  }
}
origin: lycying/c2d-engine

public void stopMusic(String res){
  final Music musicFromPool = musics.get(res);
  if(null==musicFromPool){
    final Music musicFromAssets = Engine.resource(res);
    musics.put(res, musicFromAssets);
    musicFromAssets.stop();
  }else{
    musicFromPool.stop();
  }
}
origin: yichen0831/Bomberman_libGdx

public void stopMusic() {
  if (currentMusic.isEmpty()) {
    return;
  }
  Music music = assetManager.get(musicPath + currentMusic, Music.class);
  if (music.isPlaying()) {
    music.stop();
  }
}
origin: Catacomb-Snatch/Catacomb-Snatch

@Override
public void stopEndMusic() {
  Music endMusic = getMusic(Sounds.END_THEME);
  if (endMusic == null) {
    return;
  }
  if (endMusic.isPlaying()) {
    endMusic.stop();
  }
  TheEndIsPlaying = false;
}
origin: langurmonkey/gaiasky

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);
}
origin: Catacomb-Snatch/Catacomb-Snatch

@Override
public void stopTitleMusic() {
  Music titleMusic = getMusic(Sounds.TITLE_THEME);
  if (titleMusic == null) {
    return;
  }
  if (titleMusic.isPlaying()) {
    titleMusic.stop();
  }
  TitleIsPlaying = false;
}
origin: kbz/SIFTrain

private void disposeOf(Music mus) {
  if(mus == null)
    return;;
  if(mus.isPlaying())
    mus.stop();
  mus.dispose();
}
origin: kbz/SIFTrain

  @Override
  public void clicked(InputEvent event, float x, float y) {
    if (theSong != null)
    {
      theSong.stop();
      theSong.dispose();
    }
    ((Game) Gdx.app.getApplicationListener()).setScreen(new SongSelectionScreen());
  }
}));
origin: kbz/SIFTrain

  @Override
  public void clicked(InputEvent event, float x, float y) {
    if (theSong != null)
    {
      theSong.stop();
      theSong.dispose();
    }
    ((Game) Gdx.app.getApplicationListener()).setScreen(new SongScreen());
  }
}));
origin: dsaltares/libgdx-cookbook

void playSong(int songIdx) {
  Music song = songs.get(currentSongIdx);
  song.setOnCompletionListener(null);
  song.stop();
  
  currentSongIdx = songIdx;
  song = songs.get(currentSongIdx);
  song.play();
  song.setVolume(volume);
  song.setOnCompletionListener(listener);
}

origin: BrentAureli/SuperMario

public void die() {
  if (!isDead()) {
    MarioBros.manager.get("audio/music/mario_music.ogg", Music.class).stop();
    MarioBros.manager.get("audio/sounds/mariodie.wav", Sound.class).play();
    marioIsDead = true;
    Filter filter = new Filter();
    filter.maskBits = MarioBros.NOTHING_BIT;
    for (Fixture fixture : b2body.getFixtureList()) {
      fixture.setFilterData(filter);
    }
    b2body.applyLinearImpulse(new Vector2(0, 4f), b2body.getWorldCenter(), true);
  }
}
com.badlogic.gdx.audioMusicstop

Javadoc

Stops a playing or paused Music instance. Next time play() is invoked the Music will start from the beginning.

Popular methods of Music

  • play
    Starts the play back of the music stream. In case the stream was paused this will resume the play ba
  • isPlaying
  • setLooping
    Sets whether the music stream is looping. This can be called at any time, whether the stream is play
  • dispose
    Needs to be called when the Music is no longer needed.
  • setVolume
    Sets the volume of this music stream. The volume must be given in the range [0,1] with 0 being silen
  • pause
    Pauses the play back. If the music stream has not been started yet or has finished playing a call to
  • getPosition
    Returns the playback position in seconds.
  • setPosition
    Set the playback position in seconds.
  • setOnCompletionListener
    Register a callback to be invoked when the end of a music stream has been reached during playback.
  • getVolume

Popular in Java

  • Parsing JSON documents to java classes using gson
  • scheduleAtFixedRate (ScheduledExecutorService)
  • startActivity (Activity)
  • getApplicationContext (Context)
  • FlowLayout (java.awt)
    A flow layout arranges components in a left-to-right flow, much like lines of text in a paragraph. F
  • Graphics2D (java.awt)
    This Graphics2D class extends the Graphics class to provide more sophisticated control overgraphics
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • HttpURLConnection (java.net)
    An URLConnection for HTTP (RFC 2616 [http://tools.ietf.org/html/rfc2616]) used to send and receive d
  • GregorianCalendar (java.util)
    GregorianCalendar is a concrete subclass of Calendarand provides the standard calendar used by most
  • Reflections (org.reflections)
    Reflections one-stop-shop objectReflections scans your classpath, indexes the metadata, allows you t
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now