Class Audio

java.lang.Object
org.indiumstudios.keylib.Sound.Audio
All Implemented Interfaces:
com.badlogic.gdx.utils.Disposable

public final class Audio extends Object implements com.badlogic.gdx.utils.Disposable
  • Nested Class Summary

    Nested Classes
    Modifier and Type
    Class
    Description
    static enum 
     
  • Constructor Summary

    Constructors
    Constructor
    Description
    Audio(com.badlogic.gdx.files.FileHandle fileHandle, Audio.SoundType type, boolean isLooping, float volume)
    An audio clip whether it is music or a sound effect.
  • Method Summary

    Modifier and Type
    Method
    Description
    void
    Disposes the sound.
    boolean
    Checks if the music is playing or not.
    void
    Pauses the sound.
    void
    Plays the sound.
    void
    Stops the sound.

    Methods inherited from class java.lang.Object

    clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
  • Constructor Details

    • Audio

      public Audio(com.badlogic.gdx.files.FileHandle fileHandle, Audio.SoundType type, boolean isLooping, float volume)
      An audio clip whether it is music or a sound effect.
      Parameters:
      fileHandle - The file handle (ex: Gdx.files.internal).
      type - The type of the sound. Music: SoundType.MUSIC, Sound Effect: SoundType.SOUND_EFFECT.
      isLooping - If the sound is looping or not.
      volume - The volume of the sound. Usually at 0.2 for normal volume
  • Method Details

    • play

      public void play()
      Plays the sound.
    • stop

      public void stop()
      Stops the sound.
    • pause

      public void pause()
      Pauses the sound.
    • isPlaying

      public boolean isPlaying()
      Checks if the music is playing or not.
      Returns:
      Returns if the music is playing or not.
    • dispose

      public void dispose()
      Disposes the sound. Do this when you don't need the sound anymore.
      Specified by:
      dispose in interface com.badlogic.gdx.utils.Disposable