org.jrabbit.base.data.thread
Class SoundLoadingThread

java.lang.Object
  extended by java.lang.Thread
      extended by org.jrabbit.base.data.thread.WatchableThread
          extended by org.jrabbit.base.data.thread.WatchableGLThread
              extended by org.jrabbit.base.data.thread.SoundLoadingThread
All Implemented Interfaces:
java.lang.Runnable

public final class SoundLoadingThread
extends WatchableGLThread

A class that provides an easy way to load Sounds in a separate Thread. This is bound by the same problems as with a WatchableGLThread. NOTE: See ImageLoadingThread's caveats for a brief discussion on the use of this class.

Author:
Chris Molini

Nested Class Summary
 
Nested classes/interfaces inherited from class java.lang.Thread
java.lang.Thread.State, java.lang.Thread.UncaughtExceptionHandler
 
Field Summary
private  java.lang.String[] filepaths
          The supplied list of filepaths that are used to load sounds.
private  SoundData[] sounds
          The list of constructed Sounds.
 
Fields inherited from class org.jrabbit.base.data.thread.WatchableGLThread
CONTEXT_SHARING_FAILURE, CONTEXT_SHARING_SUCCESS, CONTEXT_SHARING_UNDECIDED, sharedDrawable
 
Fields inherited from class org.jrabbit.base.data.thread.WatchableThread
progress, total
 
Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
 
Constructor Summary
SoundLoadingThread(java.lang.String[] filepaths)
          Instantiates a Thread that will load sounds from the list of filepaths.
 
Method Summary
protected  void act()
          Creates the desired sounds, incrementing progress as it goes.
 SoundData[] sounds()
          Accesses a reference to the array of sounds in the loading Thread.
 
Methods inherited from class org.jrabbit.base.data.thread.WatchableGLThread
contextSharingFailed, contextSharingResult, contextSharingSuccess, releaseContext, run, shareContext
 
Methods inherited from class org.jrabbit.base.data.thread.WatchableThread
complete, percentComplete
 
Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, 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
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

filepaths

private java.lang.String[] filepaths
The supplied list of filepaths that are used to load sounds.


sounds

private SoundData[] sounds
The list of constructed Sounds.

Constructor Detail

SoundLoadingThread

public SoundLoadingThread(java.lang.String[] filepaths)
Instantiates a Thread that will load sounds from the list of filepaths. NOTE: Each of these sounds will have its appropriate filepath as a reference.

Parameters:
filepaths - The locations in the file system of the sounds to load.
Method Detail

act

protected void act()
Creates the desired sounds, incrementing progress as it goes.

Specified by:
act in class WatchableThread

sounds

public SoundData[] sounds()
Accesses a reference to the array of sounds in the loading Thread. This shouldn't be used until loading is complete.

Returns:
The list of created sound data.