kiwi.ui
Class AudioClip

java.lang.Object
  |
  +--kiwi.ui.AudioClip

public class AudioClip
extends Object
implements AudioClip

This class represents an audio clip. The audio data is restricted to the 8000Hz, single-channel u-law format. The class relies on the undocumented sun.audio package and thus may not be portable.

AudioClips may be read from streams, from files, or loaded as system resources using a ResourceManager or ResourceLoader.

Version:
1.1 (09/98)
Author:
Mark Lindner, PING Software Group
See Also:
ResourceManager.getSound(java.lang.String), ResourceLoader.getResourceAsURL(java.lang.String)

Constructor Summary
AudioClip(InputStream stream)
          Construct a new AudioClip.
AudioClip(String file)
          Construct a new AudioClip.
AudioClip(URL url)
          Construct a new AudioClip.
 
Method Summary
 void loop()
          Play the audio clip continuously.
 void play()
          Play the audio clip.
 void stop()
          Stop playing the audio clip.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

AudioClip

public AudioClip(URL url)
          throws IOException
Construct a new AudioClip.
Parameters:
url - The location of the audio data.
Throws:
IOException - If there is a problem reading from the specified URL.

AudioClip

public AudioClip(String file)
          throws IOException
Construct a new AudioClip.
Parameters:
filename - The name of the file that contains the audio data.
Throws:
IOException - If there is a problem reading from the specified file.

AudioClip

public AudioClip(InputStream stream)
          throws IOException
Construct a new AudioClip.
Parameters:
stream - The stream to read the audio data from.
Throws:
IOException - If there is a problem reading from the specified stream.
Method Detail

play

public void play()
Play the audio clip.
Specified by:
play in interface AudioClip

loop

public void loop()
Play the audio clip continuously.
Specified by:
loop in interface AudioClip

stop

public void stop()
Stop playing the audio clip.
Specified by:
stop in interface AudioClip