Class JavaSound.Playback

java.lang.Object
  |
  +--java.lang.Thread
        |
        +--JavaSound.Playback
All Implemented Interfaces:
java.lang.Runnable
Enclosing class:
JavaSound

public class JavaSound.Playback
extends java.lang.Thread

The nested class Playback extends from Thread and allows for playback of this sound. The thread doesn't die until the sound is finished playing, however it is not blocking either. It will simply play the sound in the "background."


Field Summary
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
JavaSound.Playback()
           
 
Method Summary
 boolean getPlaying()
           
 void run()
          Starts this thread.
 void stopPlaying()
          Stops this thread by breaking the while loop in the run method.
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, countStackFrames, currentThread, destroy, dumpStack, enumerate, getContextClassLoader, getName, getPriority, getThreadGroup, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setName, setPriority, sleep, sleep, start, stop, stop, suspend, toString, yield
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

JavaSound.Playback

public JavaSound.Playback()
Method Detail

stopPlaying

public void stopPlaying()
Stops this thread by breaking the while loop in the run method. Used, for example, by the "stop" button in the SoundView class.


getPlaying

public boolean getPlaying()

run

public void run()
Starts this thread. Gets an AudioInputStream, and writes is out to a SourceDataLine. If a SoundView exists, upon creation of the SourceDataLine, the soundView is added as the LineListener. When the thread finishes the run method, it removes itself from the list of threads currently playing this sound.

Specified by:
run in interface java.lang.Runnable
Overrides:
run in class java.lang.Thread
Throws:
JavaSoundException - if there were problems playing the sound.