Interface Audio

All Known Implementing Classes:
GDXAudio, HeadlessAudio, JavaSoundPlayer, JFXAudioPlayer, TeaAudio

public interface Audio
Describes an audio clip that has been loaded by the renderer. There is no difference between the audio data and audio playback, an instance of this class represents both. This is done because some renderers do not allow audio data to be reused.
  • Method Summary

    Modifier and Type
    Method
    Description
    default void
    Plays this audio clip once, at its normal volume.
    void
    play(int volume, boolean loop)
    Starts playing this audio clip.
    void
    Stops playback of this audio clip and resets the playhead to the start of the audio clip.
  • Method Details

    • play

      void play(int volume, boolean loop)
      Starts playing this audio clip. volume is in the range 0-100, where 100 indicates the audio clip's normal volume and 0 indicates the audio clip is muted. Calling this method does nothing if playback of this audio clip is already in progress.
    • play

      default void play()
      Plays this audio clip once, at its normal volume. This method is a shorthand version of play(100, false).
    • stop

      void stop()
      Stops playback of this audio clip and resets the playhead to the start of the audio clip. Calling this method does nothing if this audio clip is not currently playing.