Package snap.gfx

Class SoundClip

java.lang.Object
snap.gfx.SoundClip

public abstract class SoundClip extends Object
A class to manage the loading and playing of a sound.
  • Constructor Summary

    Constructors
    Constructor
    Description
     
  • Method Summary

    Modifier and Type
    Method
    Description
    static SoundClip
    Creates a new empty clip.
    static SoundClip
    get(Class aClass, String aName)
    Creates a new SnapSound for file name.
    static SoundClip
    get(Object aSource)
    Returns a sound for a given source.
    abstract int
    Returns the sound length in milliseconds.
    protected static WebURL
    getSoundURL(Class aClass, String aName)
    Creates a new SnapSound for file name.
    abstract int
    Returns the sound time in milliseconds.
    abstract boolean
    Returns whether sound is playing.
    abstract boolean
    Returns whether sound is recording.
    abstract void
    Pauses a sound.
    abstract void
    Plays the sound.
    abstract void
    play(int aCount)
    Plays the sound repeatedly for given count.
    abstract void
    Starts a recording.
    abstract void
    Stops a recording.
    abstract void
    Saves this sound.
    abstract void
    setTime(int aTime)
    Sets the sound time in milliseconds.
    abstract void
    Tells sound to stop playing.

    Methods inherited from class java.lang.Object

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

    • SoundClip

      public SoundClip()
  • Method Details

    • isPlaying

      public abstract boolean isPlaying()
      Returns whether sound is playing.
    • play

      public abstract void play()
      Plays the sound.
    • play

      public abstract void play(int aCount)
      Plays the sound repeatedly for given count.
    • stop

      public abstract void stop()
      Tells sound to stop playing.
    • pause

      public abstract void pause()
      Pauses a sound.
    • getLength

      public abstract int getLength()
      Returns the sound length in milliseconds.
    • getTime

      public abstract int getTime()
      Returns the sound time in milliseconds.
    • setTime

      public abstract void setTime(int aTime)
      Sets the sound time in milliseconds.
    • isRecording

      public abstract boolean isRecording()
      Returns whether sound is recording.
    • recordStart

      public abstract void recordStart()
      Starts a recording.
    • recordStop

      public abstract void recordStop()
      Stops a recording.
    • save

      public abstract void save() throws IOException
      Saves this sound.
      Throws:
      IOException
    • get

      public static SoundClip get(Object aSource)
      Returns a sound for a given source.
    • get

      public static SoundClip get(Class aClass, String aName)
      Creates a new SnapSound for file name.
    • create

      public static SoundClip create()
      Creates a new empty clip.
    • getSoundURL

      protected static WebURL getSoundURL(Class aClass, String aName)
      Creates a new SnapSound for file name.