edu.nrao.widar.gui.widget
Class Sound
java.lang.Object
edu.nrao.widar.gui.widget.Sound
- All Implemented Interfaces:
- java.awt.event.ActionListener, java.util.EventListener
public class Sound
- extends java.lang.Object
- implements java.awt.event.ActionListener
A Sound player.
Plays a specified sound URL or file.
This first cut is very simple and can only play non-compressed
files like .wav but not mp3. The constructor creates an audio
clip that can be played or looped. It is for short (under 1MB)
files like that would be used for an alarm sound. The static
'playAudioFile' method can be used to play files of any length
(but still uncompressed files only).
- Since:
- 1.5
- Author:
- KJRyan
- Created:
- 2009.02.02
-
-
Constructor Summary |
Sound(java.lang.String filename)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Sound
public Sound(java.lang.String filename)
throws java.io.IOException
- Throws:
java.io.IOException
play
public void play()
loop
public void loop()
loop
public void loop(int repeatPeriodMillis)
actionPerformed
public void actionPerformed(java.awt.event.ActionEvent e)
- Specified by:
actionPerformed
in interface java.awt.event.ActionListener
stop
public void stop()
quit
public static void quit()
playAudioFile
public static void playAudioFile(java.lang.String filename)
throws java.io.IOException
- Throws:
java.io.IOException
main
public static void main(java.lang.String[] args)
National Radio Astronomy Observatory