public class AudioClip extends Object implements AudioClip
AudioClip
s may be read from streams, from files, or loaded as
system resources using a ResourceManager
or
ResourceLoader
.
ResourceManager.getSound(java.lang.String)
,
ResourceLoader.getResourceAsURL(java.lang.String)
Modifier and Type | Field and Description |
---|---|
private sun.audio.AudioData |
audioData |
private sun.audio.AudioDataStream |
audioStream |
private sun.audio.ContinuousAudioDataStream |
cAudioStream |
(package private) static int |
length |
private String |
name |
Constructor and Description |
---|
AudioClip(InputStream stream)
Construct a new
AudioClip . |
AudioClip(String file)
Construct a new
AudioClip . |
AudioClip(URL url)
Construct a new
AudioClip . |
Modifier and Type | Method and Description |
---|---|
String |
getName()
Get the audio clip's name.
|
void |
loop()
Play the audio clip continuously.
|
void |
play()
Play the audio clip.
|
void |
setName(String name)
Set the audio clip's name.
|
void |
stop()
Stop playing the audio clip.
|
String |
toString()
Get a string representation of this object.
|
static int length
private sun.audio.AudioData audioData
private sun.audio.AudioDataStream audioStream
private sun.audio.ContinuousAudioDataStream cAudioStream
public AudioClip(URL url) throws IOException
AudioClip
.url
- The location of the audio data.IOException
- If there is a problem reading from the
specified URL.public AudioClip(String file) throws IOException
AudioClip
.file
- The name of the file that contains the audio data.IOException
- If there is a problem reading from the
specified file.public AudioClip(InputStream stream) throws IOException
AudioClip
.stream
- The stream to read the audio data from.IOException
- If there is a problem reading from the
specified stream.WebARTS Library Licensed Under the GNU - General Public License. Other Libraries licensed under their respective Open Source Licenses