Example usage for com.badlogic.gdx.audio Sound stop

List of usage examples for com.badlogic.gdx.audio Sound stop

Introduction

In this page you can find the example usage for com.badlogic.gdx.audio Sound stop.

Prototype

public void stop(long soundId);

Source Link

Document

Stops the sound instance with the given id as returned by #play() or #play(float) .

Usage

From source file:com.jumpbuttonstudios.vikingdodge.SoundManager.java

License:Apache License

/**
 * Plays a given send effect/*from w  w w. j  a v a  2s .com*/
 * 
 * @param effect
 * @param volume
 * @return the sound ID
 */
public long playSound(Sound effect, float volume, boolean loop) {
    long id = effect.play(volume);
    if (soundIDs.contains(id, false)) {
        effect.stop(id);
        soundIDs.removeValue(id, false);
    }
    effect.loop(id);
    soundIDs.add(id);
    return id;
}