# Class AudioEngineThread

java.lang.Object
java.lang.Thread
com.sun.j3d.audioengines.AudioEngineThread

All Implemented Interfaces:
  `Runnable`

public class AudioEngineThread extends Thread
The Thread Class extended for Audio Device engines that must process calls dynamically, in 'real-time" to asynchronously change engine parameters.

NOTE: this class is probably not needed for those Audio Device implementations that handle all dynamic parameters in the low-level audio library.

## Nested Class Summary

### Nested classes/interfaces inherited from class Thread

`Thread.Builder, Thread.State, Thread.UncaughtExceptionHandler`

## Field Summary

Fields
Modifier and Type
Field
Description
`protected boolean`
`active`
This indicates that this thread has been activated by MC
`protected Object[]`
`args`
The arguments passed in for this thread
`protected int`
`classification`
The classification of this thread.
`protected static final boolean`
`debugFlag`
`protected int`
`instanceNum`
`protected long`
`lastWaitTimestamp`
Use to assign threadOpts WAIT_ALL_THREADS
`protected static final int`
`NOTIFY_AND_WAIT`
This runMonitor action notifies MasterControl that this thread has completed and wait.
`protected static int`
`numInstances`
Some variables used to name threads correctly
`protected long`
`referenceTime`
The time values passed into this thread
`protected static final int`
`RUN`
This runMonitor action tells the thread to run N number of iterations.
`protected boolean`
`running`
This indicates that this thread is alive and running
`protected boolean`
`started`
This indicates that this thread is ready
`protected static final int`
`STOP`
This runMonitor action tells the thread to stop running
`protected int`
`type`
The type of this thread.
`protected static final int`
`UPDATE_THREAD`
`protected boolean`
`userStop`
Flag to indicate that user initiate a thread stop
`protected static final int`
`WAIT`
This runMonitor action puts the thread into an initial wait state
`protected boolean`
`waiting`
Flag to indicate that this thread is waiting to be notify
`protected static final int`
`WORK_THREAD`
The classification types.

### Fields inherited from class Thread

`MAX_PRIORITY, MIN_PRIORITY, NORM_PRIORITY`

## Constructor Summary

Constructors
Constructor
Description
`AudioEngineThread(ThreadGroup t, String threadName)`
This constructor simply assigns the given id.

## Method Summary

Modifier and Type
Method
Description
`void`
`cleanup()`
`protected void`
`debugPrint(String message)`
`void`
`doWork()`
This method is defined by all slave threads to implement one iteration of work.
`void`
`finish()`
This causes the threads run method to exit.
`void`
`initialize()`
This initializes this thread.
`void`
`run()`
`void`
`runMonitor(int action, long referenceTime, Object[] args)`
`void`
`shutdown()`

### Methods inherited from class Thread

`activeCount, checkAccess, clone, 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, setContextClassLoader, setDaemon, setDefaultUncaughtExceptionHandler, setName, setPriority, setUncaughtExceptionHandler, sleep, sleep, sleep, start, startVirtualThread, stop, threadId, toString, yield`

### Methods inherited from class Object

`equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

## Field Details

### debugFlag

protected static final boolean debugFlag

See Also:
  - Constant Field Values

### WORK_THREAD

protected static final int WORK_THREAD
The classification types.

See Also:
  - Constant Field Values

### UPDATE_THREAD

protected static final int UPDATE_THREAD

See Also:
  - Constant Field Values

### WAIT

protected static final int WAIT
This runMonitor action puts the thread into an initial wait state

See Also:
  - Constant Field Values

### NOTIFY_AND_WAIT

protected static final int NOTIFY_AND_WAIT
This runMonitor action notifies MasterControl that this thread has completed and wait.

See Also:
  - Constant Field Values

### RUN

protected static final int RUN
This runMonitor action tells the thread to run N number of iterations.

See Also:
  - Constant Field Values

### STOP

protected static final int STOP
This runMonitor action tells the thread to stop running

See Also:
  - Constant Field Values

### active

protected boolean active
This indicates that this thread has been activated by MC

### running

protected boolean running
This indicates that this thread is alive and running

### started

protected boolean started
This indicates that this thread is ready

### referenceTime

protected long referenceTime
The time values passed into this thread

### lastWaitTimestamp

protected long lastWaitTimestamp
Use to assign threadOpts WAIT_ALL_THREADS

### type

protected int type
The type of this thread. It is one of the above constants.

### classification

protected int classification
The classification of this thread. It is one of the above constants.

### args

protected Object[] args
The arguments passed in for this thread

### userStop

protected boolean userStop
Flag to indicate that user initiate a thread stop

### waiting

protected boolean waiting
Flag to indicate that this thread is waiting to be notify

### numInstances

protected static int numInstances
Some variables used to name threads correctly

### instanceNum

protected int instanceNum

## Constructor Details

### AudioEngineThread

public AudioEngineThread(ThreadGroup t, String threadName)
This constructor simply assigns the given id.

## Method Details

### debugPrint

protected void debugPrint(String message)

### doWork

public void doWork()
This method is defined by all slave threads to implement one iteration of work.

### initialize

public void initialize()
This initializes this thread. Once this method returns, the thread is ready to do work.

### finish

public void finish()
This causes the threads run method to exit.

### run

public void run()

Specified by:
  `run` in interface `Runnable`
Overrides:
  `run` in class `Thread`

### runMonitor

public void runMonitor(int action, long referenceTime, Object[] args)

### shutdown

public void shutdown()

### cleanup

public void cleanup()