framework
Class Sound

java.lang.Object
  extended by framework.Sound

public class Sound
extends Object

A Sound object is created for each audio file used. You can play the sound multiple times by calling start() more than once. If you require greater control over playback, you can obtain a Clip object from getClip().

Clip objects returned from this class may be closed at any time they are inactive, but they will be automatically reopened at the original position when start or loop is called. You can also reopen them by calling open(), which will reset the position to the start of the clip.

To read MP3 or Ogg Vorbis audio files, get the appropriate plugins from this page.


Constructor Summary
Sound(AudioInputStream stream)
           
Sound(File file)
           
Sound(InputStream stream)
           
Sound(URL url)
           
 
Method Summary
 Collection getActiveClips()
           
 byte[] getBytes()
           
 Clip getClip()
           
 AudioFormat getFormat()
           
 Collection getPausedClips()
           
 float getVolume()
           
 boolean isMuted()
           
 void pauseAll()
           
 void prepare()
          Calling this method will attempt to load a Clip object for this Sound.
 void resumeAll()
           
 void setMuted(boolean mute)
           
 void setVolume(float volume)
           
 void start()
           
 void stopAll()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Sound

public Sound(File file)
      throws IOException
Throws:
IOException

Sound

public Sound(InputStream stream)
      throws IOException
Throws:
IOException

Sound

public Sound(URL url)
      throws IOException
Throws:
IOException

Sound

public Sound(AudioInputStream stream)
      throws IOException
Throws:
IOException
Method Detail

getBytes

public byte[] getBytes()

getFormat

public AudioFormat getFormat()

prepare

public void prepare()
Calling this method will attempt to load a Clip object for this Sound. You could use this to preload your background music or any other long sound clip.


start

public void start()

getClip

public Clip getClip()

pauseAll

public void pauseAll()

resumeAll

public void resumeAll()

stopAll

public void stopAll()

getPausedClips

public Collection getPausedClips()

getActiveClips

public Collection getActiveClips()

isMuted

public boolean isMuted()

setMuted

public void setMuted(boolean mute)

getVolume

public float getVolume()

setVolume

public void setVolume(float volume)