Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD

## Class Playback

    java.lang.Object
      java.lang.Thread
          Playback

All Implemented Interfaces:
  Runnable

    public class Playback

extends Thread

The class `Playback` extends from `Thread` and allows for playback of a simple 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." Copyright Georgia Institute of Technology 2004

Author:
  unknown undergrad, Barb Ericson ericson@cc.gatech.edu

Nested Class Summary

Nested classes/interfaces inherited from class java.lang.Thread
`Thread.State, Thread.UncaughtExceptionHandler`

Field Summary

Fields inherited from class java.lang.Thread
`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

Constructor Summary
`Playback(SimpleSound sound)` Constructor that takes the simple sound to be played

Method Summary
`boolean` | `getPlaying()` Method to return true if this playback thread is playing and false otherwise
`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, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, join, join, join, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, 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

### Playback

    public Playback(SimpleSound sound)

  Constructor that takes the simple sound to be played

  Parameters:
    `sound` - the simple sound to play

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 SoundExplorer class.

### getPlaying

    public boolean getPlaying()

  Method to return true if this playback thread is playing and false otherwise

  Returns:
    true if playing else false

### run

    public void run()

  Starts this thread. Gets an AudioInputStream, and writes is out to a SourceDataLine. If a SoundExplorer exists, upon creation of the SourceDataLine, the soundExplorer 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 `Runnable`
  Overrides:
    `run` in class `Thread`
  Throws:
    `JavaSoundException` - if there were problems playing the sound.

Package | Class | Tree | Deprecated | Index | Help
PREV CLASS NEXT CLASS | FRAMES NO FRAMES
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD