Package com.ardor3d.audio
Class CommandThread
java.lang.Object
java.lang.Thread
com.ardor3d.audio.SimpleThread
com.ardor3d.audio.CommandThread
- All Implemented Interfaces:
Runnable
The CommandThread class is designed to move all command processing into a
single thread to be run in the background and avoid conflicts between
threads. Commands are processed in the order that they were queued. The
arguements for each command are stored in a
SoundSystem License:
You are free to use this library for any purpose, commercial or otherwise. You may modify this library or source code, and distribute it any way you like, provided the following conditions are met:
1) You may not falsely claim to be the author of this library or any unmodified portion of it.
2) You may not copyright this library or a modified version of it and then sue me for copyright infringement.
3) If you modify the source code, you must clearly document the changes made before redistributing the modified source code, so other users know it is not the original code.
4) You are not required to give me credit for this library in any derived work, but if you do, you must also mention my website: http://www.paulscode.com
5) I the author will not be responsible for any damages (physical, financial, or otherwise) caused by the use if this library or any part of it.
6) I the author do not guarantee, warrant, or make any representations, either expressed or implied, regarding the use of this library or any part of it.
Author: Paul Lamb
http://www.paulscode.com
CommandObject
. The Command Queue is
located in the SoundSystem
class.
Calling kill() stops the thread, and this should be immediatly followed
by a call to interrupt() to wake up the thread so it may end. This class
also checks for temporary sources that are finished playing, and removes
them.
NOTE: The command thread is created automatically by the sound system, so it
is unlikely that the user would ever need to use this class.
SoundSystem License:
You are free to use this library for any purpose, commercial or otherwise. You may modify this library or source code, and distribute it any way you like, provided the following conditions are met:
1) You may not falsely claim to be the author of this library or any unmodified portion of it.
2) You may not copyright this library or a modified version of it and then sue me for copyright infringement.
3) If you modify the source code, you must clearly document the changes made before redistributing the modified source code, so other users know it is not the original code.
4) You are not required to give me credit for this library in any derived work, but if you do, you must also mention my website: http://www.paulscode.com
5) I the author will not be responsible for any damages (physical, financial, or otherwise) caused by the use if this library or any part of it.
6) I the author do not guarantee, warrant, or make any representations, either expressed or implied, regarding the use of this library or any part of it.
Author: Paul Lamb
http://www.paulscode.com
-
Nested Class Summary
Nested classes/interfaces inherited from class java.lang.Thread
Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler
-
Field Summary
Modifier and TypeFieldDescriptionprotected String
Name of this class.protected SoundSystemLogger
Processes status messages, warnings, and error messages.Fields inherited from class java.lang.Thread
MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY
-
Constructor Summary
ConstructorDescriptionConstructor: Takes a handle to the SoundSystem object as a parameter. -
Method Summary
Modifier and TypeMethodDescriptionprotected void
cleanup()
Shuts the thread down and removes references to all instantiated objects.protected boolean
errorCheck
(boolean error, String message) Prints the specified message if error is true.protected void
errorMessage
(String message, int indent) Prints an error message.protected void
importantMessage
(String message, int indent) Prints an important message.protected void
Prints a message.void
run()
The main loop for processing commands.Methods inherited from class java.lang.Thread
activeCount, checkAccess, clone, countStackFrames, currentThread, dumpStack, enumerate, getAllStackTraces, getContextClassLoader, getDefaultUncaughtExceptionHandler, getId, getName, getPriority, getStackTrace, getState, getThreadGroup, getUncaughtExceptionHandler, holdsLock, interrupt, interrupted, isAlive, isDaemon, isInterrupted, isVirtual, join, join, join, join, ofPlatform, ofVirtual, onSpinWait, resume, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, suspend, threadId, toString, yield
-
Field Details
-
logger
Processes status messages, warnings, and error messages. -
className
Name of this class.
-
-
Constructor Details
-
CommandThread
Constructor: Takes a handle to the SoundSystem object as a parameter.- Parameters:
s
- Handle to the SoundSystem.
-
-
Method Details
-
cleanup
protected void cleanup()Shuts the thread down and removes references to all instantiated objects. NOTE: Method alive() will return false when cleanup() has finished.- Overrides:
cleanup
in classSimpleThread
-
run
public void run()The main loop for processing commands. The Command Thread starts out asleep, and it sleeps again after it finishes processing commands, so it must be interrupted when commands are queued for processing.- Specified by:
run
in interfaceRunnable
- Overrides:
run
in classSimpleThread
-
message
Prints a message.- Parameters:
message
- Message to print.
-
importantMessage
Prints an important message.- Parameters:
message
- Message to print.
-
errorCheck
Prints the specified message if error is true.- Parameters:
error
- True or False.message
- Message to print if error is true.- Returns:
- True if error is true.
-
errorMessage
Prints an error message.- Parameters:
message
- Message to print.
-