|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.isti.util.IstiSound
public class IstiSound
Class IstiSound is a sound utility class that manages a sound 'Clip' object. The ActionListener interface is implemented to support the use of a javax.swing.Timer to play the sound.
Field Summary | |
---|---|
protected javax.sound.sampled.Clip |
clipObj
|
protected long |
stopPlayTimeVal
|
Constructor Summary | |
---|---|
IstiSound(javax.sound.sampled.AudioInputStream audiosource)
Creates a sound from the specified audio input stream. |
|
IstiSound(java.io.File file)
Creates a sound from the specified sound file. |
|
IstiSound(java.io.InputStream stmObj)
Creates a sound from the specified input stream. |
|
IstiSound(java.net.URL url)
Creates a sound from the specified sound file. |
Method Summary | |
---|---|
void |
actionPerformed(java.awt.event.ActionEvent e)
Supports the ActionListener interface. |
void |
close()
Release resources associated with this sound object. |
boolean |
isActive()
Checks if a sound is active |
boolean |
isOpen()
Queries whether or not this sound object is open. |
static boolean |
isSoundFile(java.io.File file)
Checks if the specified file is a supported sound file. |
static boolean |
isSoundFile(java.net.URL url)
Checks if the specified file is a supported sound file. |
void |
loop()
Plays a sound continuously. |
void |
loop(int count)
Plays a sound the specified number of times. |
void |
play()
Plays a sound from start to finish. |
void |
play(boolean waitFlag)
Plays a sound from start to finish. |
void |
play(int secondsVal)
Plays a sound for the specified duration. |
void |
reopen(javax.sound.sampled.AudioInputStream audiosource)
Reopens to use the sound from the specified audio input stream. |
void |
reopen(java.io.File file)
Reopens to use the sound from the specified sound file. |
void |
reopen(java.io.InputStream stmObj)
Reopens to use the sound from the specified input stream. |
void |
reopen(java.net.URL url)
Reopens to use the sound from the specified sound file. |
void |
reset()
Resets a sound to the beginning. |
void |
start()
Starts or resumes playing a sound from the current position. |
void |
stop()
Stops playing a sound. |
void |
update(javax.sound.sampled.LineEvent lineEvent)
Supports the LineListener interface. |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
protected final javax.sound.sampled.Clip clipObj
protected long stopPlayTimeVal
Constructor Detail |
---|
public IstiSound(javax.sound.sampled.AudioInputStream audiosource) throws java.io.IOException, javax.sound.sampled.LineUnavailableException
audiosource
- audio input stream
java.io.IOException
- if an I/O exception occurs
javax.sound.sampled.LineUnavailableException
- if a matching line is not available due
to resource restrictionspublic IstiSound(java.io.File file) throws javax.sound.sampled.UnsupportedAudioFileException, java.io.IOException, javax.sound.sampled.LineUnavailableException
file
- the sound file
javax.sound.sampled.UnsupportedAudioFileException
- if the File does not point to a
valid sound file data recognized by the system
java.io.IOException
- if an I/O exception occurs
javax.sound.sampled.LineUnavailableException
- if a matching line is not available due
to resource restrictionsplay
public IstiSound(java.net.URL url) throws javax.sound.sampled.UnsupportedAudioFileException, java.io.IOException, javax.sound.sampled.LineUnavailableException
url
- URL for the sound file
javax.sound.sampled.UnsupportedAudioFileException
- if the File does not point to a
valid sound file data recognized by the system
java.io.IOException
- if an I/O exception occurs
javax.sound.sampled.LineUnavailableException
- if a matching line is not available due
to resource restrictionsplay
public IstiSound(java.io.InputStream stmObj) throws javax.sound.sampled.UnsupportedAudioFileException, java.io.IOException, javax.sound.sampled.LineUnavailableException
stmObj
- the input stream to use.
javax.sound.sampled.UnsupportedAudioFileException
- if the File does not point to a
valid sound file data recognized by the system
java.io.IOException
- if an I/O exception occurs
javax.sound.sampled.LineUnavailableException
- if a matching line is not available due
to resource restrictionsplay
Method Detail |
---|
public void reopen(javax.sound.sampled.AudioInputStream audiosource) throws java.io.IOException, javax.sound.sampled.LineUnavailableException
audiosource
- audio input stream
java.io.IOException
- if an I/O exception occurs
javax.sound.sampled.LineUnavailableException
- if a matching line is not available
due to resource restrictionspublic void reopen(java.io.File file) throws javax.sound.sampled.UnsupportedAudioFileException, java.io.IOException, javax.sound.sampled.LineUnavailableException
file
- the sound file
javax.sound.sampled.UnsupportedAudioFileException
- if the File does not point to a
valid sound file data recognized by the system
java.io.IOException
- if an I/O exception occurs
javax.sound.sampled.LineUnavailableException
- if a matching line is not available due
to resource restrictionsplay
public void reopen(java.net.URL url) throws javax.sound.sampled.UnsupportedAudioFileException, java.io.IOException, javax.sound.sampled.LineUnavailableException
url
- URL for the sound file
javax.sound.sampled.UnsupportedAudioFileException
- if the File does not point to a
valid sound file data recognized by the system
java.io.IOException
- if an I/O exception occurs
javax.sound.sampled.LineUnavailableException
- if a matching line is not available due
to resource restrictionsplay
public void reopen(java.io.InputStream stmObj) throws javax.sound.sampled.UnsupportedAudioFileException, java.io.IOException, javax.sound.sampled.LineUnavailableException
stmObj
- the input stream to use.
javax.sound.sampled.UnsupportedAudioFileException
- if the File does not point to a
valid sound file data recognized by the system
java.io.IOException
- if an I/O exception occurs
javax.sound.sampled.LineUnavailableException
- if a matching line is not available due
to resource restrictionsplay
public static boolean isSoundFile(java.io.File file)
file
- the sound file
public static boolean isSoundFile(java.net.URL url)
url
- URL for the sound file
public boolean isActive()
public void loop()
public void loop(int count)
count
- number of times to play the soundpublic void play(boolean waitFlag)
waitFlag
- if true then this method blocks until the playing
of the sound is complete.reset, start
public void play()
reset, start
public void play(int secondsVal)
secondsVal
- play duration in seconds.public void update(javax.sound.sampled.LineEvent lineEvent)
update
in interface javax.sound.sampled.LineListener
lineEvent
- line eventpublic void actionPerformed(java.awt.event.ActionEvent e)
actionPerformed
in interface java.awt.event.ActionListener
e
- action event.public void reset()
public void start()
public void stop()
public void close()
public boolean isOpen()
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |