Package snap.swing

Class SwingSoundClip

java.lang.Object
snap.gfx.SoundClip
snap.swing.SwingSoundClip

public class SwingSoundClip extends SoundClip
Manages sound data from sound file bytes.
  • Field Details

  • Constructor Details

    • SwingSoundClip

      public SwingSoundClip(Object aSource)
      Creates a new sound data for given source.
  • Method Details

    • getBytes

      public byte[] getBytes()
      Returns the sound bytes.
    • setBytes

      public void setBytes(byte[] theBytes)
      Sets the sound bytes.
    • getBitsPerSample

      public int getBitsPerSample()
      Returns the bits per sample.
    • getSamplesPerSecond

      public int getSamplesPerSecond()
      Returns the samples per second.
    • getChannelCount

      public int getChannelCount()
      Returns the channel count.
    • getSampleCount

      public int getSampleCount()
      Returns the sample count.
    • getSampleBytes

      public byte[] getSampleBytes()
      Returns the sample bytes.
    • bitRate

      public int bitRate()
      Returns the bit rate.
    • isPlaying

      public boolean isPlaying()
      Returns whether sound is playing.
      Specified by:
      isPlaying in class SoundClip
    • play

      public void play()
      Plays the sound.
      Specified by:
      play in class SoundClip
    • play

      public void play(int aCount)
      Plays the sound repeatedly for given count.
      Specified by:
      play in class SoundClip
    • stop

      public void stop()
      Tells sound to stop playing.
      Specified by:
      stop in class SoundClip
    • pause

      public void pause()
      Pauses a sound.
      Specified by:
      pause in class SoundClip
    • getLength

      public int getLength()
      Returns the sound length in milliseconds.
      Specified by:
      getLength in class SoundClip
    • getTime

      public int getTime()
      Returns the sound time in milliseconds.
      Specified by:
      getTime in class SoundClip
    • setTime

      public void setTime(int aTime)
      Sets the sound time in milliseconds.
      Specified by:
      setTime in class SoundClip
    • getClip

      public Clip getClip()
      Returns the clip, creating it if requested.
    • isRecording

      public boolean isRecording()
      Whether file is recording.
      Specified by:
      isRecording in class SoundClip
    • recordStart

      public void recordStart()
      Record start.
      Specified by:
      recordStart in class SoundClip
    • recordStop

      public void recordStop()
      Record stop.
      Specified by:
      recordStop in class SoundClip
    • save

      public void save() throws IOException
      Override to clear modified.
      Specified by:
      save in class SoundClip
      Throws:
      IOException
    • equals

      public boolean equals(Object anObj)
      Standard equals implementation.
      Overrides:
      equals in class Object
    • canRead

      public static boolean canRead(String anExt)
      Returns whether sound data can read given extension.