Interface AudioClip

  • All Known Implementing Classes:
    ModernAudioClip

    public interface AudioClip
    This class is similar to java.applet.AudioClip only with added methods pause() and resume(). The original AudioClip interface definition in package java.applet is deprecated and is in danger of being removed altogether; for that reason we don't even want to extend from it here.

    The minimal implementation requirement for an instance of this interface is for it to support being called from two different threads; one thread would be responsible for calling play(), loop(), and stop(), while the other thread would be responsible for calling pause() and resume().

    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void loop()
      Plays the audio clip once through, then jumps back to beginning, playing it through again and again, indefinitely.
      void pause()
      Puts the audio clip into paused state, if not already.
      void play()
      Plays the audio clip once through.
      void resume()
      Resumes the clip after paused state, if clip was paused previously.
      void stop()
      Stops a playing or looping audio clip.
    • Method Detail

      • play

        void play()
        Plays the audio clip once through. This always causes the playing to start from beginning of clip, even in cases where clip is already playing or looping.
      • loop

        void loop()
        Plays the audio clip once through, then jumps back to beginning, playing it through again and again, indefinitely. This always causes the playing to start from beginning of clip, even in cases where clip is already playing or looping.
      • stop

        void stop()
        Stops a playing or looping audio clip. The next time the clip is played or looped it will start from beginning of clip.
      • pause

        void pause()
        Puts the audio clip into paused state, if not already. When the clip is resumed it will continue exactly where it left off when it was paused. If play(), loop(), or stop() are called while the clip is paused, then upon resume() the clip will behave as if calling those operations in the same order immediately upon resume.
      • resume

        void resume()
        Resumes the clip after paused state, if clip was paused previously. For clarification on required behavior of pause/resume please see discussion on pause().
        See Also:
        pause()