| java.lang.Object javax.media.j3d.J3dStructure javax.media.j3d.SoundScheduler
SoundScheduler | class SoundScheduler extends J3dStructure (Code) | | This structure parallels the RenderBin structure and
is used for sounds
|
Method Summary | |
void | activate() | void | addPrioritizedSound(SoundRetained mirSound) | void | addSound(SoundRetained sound) Add sound to sounds list. | void | attachSoundData(SoundSchedulerAtom soundAtom, MediaContainer soundData, boolean forceReload) Attempts to load sound data for a particular sound source onto
the chosen/initialized audio device
If this called, it is assumed that SoundRetained.audioDevice is
NOT null. | int | calcSchedulingAction() | void | changeNodeAttrib(J3dMessage m) | void | changeNodeState(J3dMessage m) | boolean | checkAudioDevice3D() | boolean | checkState() | void | cleanup() | void | clearListenerFlag() | void | clearSoundData(SoundSchedulerAtom soundAtom) Clears the fields associated with sample data for this sound. | void | deactivate() | synchronized void | deactivateAllSounds() | void | debugPrint(String message) | void | deleteSound(SoundRetained sound) | void | enableSound(SoundRetained sound) | int | findActiveSoundscapes() Process active Soundscapes (if there are any) and intersect these
soundscapes with the viewPlatform. | AuralAttributesRetained | findClosestAAttribs(int nSelectedSScapes) | SoundSchedulerAtom | findSoundAtom(SoundRetained node, int nthInstance) | void | insertNodes(J3dMessage m) | void | loadSound(SoundRetained sound, boolean forceReload) | void | muteSilentSound(SoundSchedulerAtom soundAtom) | void | muteSilentSounds() Mute sounds that are to be played silently.
Not all the sound in the prioritized enabled sound list
may be able to be played. | void | muteSound(SoundRetained sound) | void | pause(SoundSchedulerAtom soundAtom) | synchronized void | pauseAllSounds() | void | pauseSound(SoundRetained sound) | int | performActions() Perform the scheduling action for each prioritized sound. | void | printAtomState(SoundSchedulerAtom atom) | int | prioritizeSounds() | void | processBoundingLeafChanged(J3dMessage m) | void | processImmediateNodes(Object[] args, long referenceTime) | void | processMessages(long referenceTime) | void | processSoundAtom(SoundSchedulerAtom soundAtom) | void | processViewSpecificGroupChanged(J3dMessage m) | void | receiveAWTEvent(AWTEvent evt) | void | removeNodes(J3dMessage m) | void | render(boolean startFlag, SoundSchedulerAtom soundAtom, AuralAttributesRetained attribs) | void | renderChanges() The main loop for the Sound Scheduler. | synchronized void | reset() | synchronized void | resumeAllSounds() | void | setAttribsDirtyFlag(SoundRetained node, int dirtyFlag) | void | setListenerFlag(int flag) 'Dirty' flag == listenerUpdated flag
The ambiguous name 'dirtyFlag' is a legacy from when there was only a
single dirty flag set by Core yet tested and cleared in this scheduler. | void | setStateDirtyFlag(SoundRetained node, int dirtyFlag) | long | shortestTimeToFinish() Determine amount of time before next playing sound will be
is complete.
find the atom that has the least amount of time before is
finished playing and return this time
length of time in millisecond until the next active soundwill be complete. | void | shuffleSound(SoundRetained sound) | void | start(SoundSchedulerAtom soundAtom) | synchronized void | stopAllSounds() | synchronized void | stopAllSounds(boolean setPlayingSoundsPending) | void | stopSound(SoundSchedulerAtom soundAtom, boolean setPending) stop playing one specific sound node
If setPending flag true, sound is stopped but enable state
is set to pending-on so that it is restarted. | boolean | testListenerFlag() | void | turnOff(SoundSchedulerAtom soundAtom) | void | unpause(SoundSchedulerAtom soundAtom) | void | update(SoundSchedulerAtom soundAtom) | void | updateAuralAttribs(AuralAttributesRetained attribs) Send current aural attributes to audio device
Note that a AA's dirtyFlag is clear only after parameters are sent to
audio device. | void | updateSoundParams(boolean updateAll, SoundSchedulerAtom soundAtom, AuralAttributesRetained attribs) | void | updateTransformChange(UpdateTargets targets, long referenceTime) | void | updateTransformedFields(SoundRetained mirSound) | void | updateXformedParams(boolean updateAll, SoundSchedulerAtom soundAtom) Update VirtualWorld local transform, sound position and direction. |
EAR_POSITIONS_CHANGED | final static int EAR_POSITIONS_CHANGED(Code) | | |
EYE_POSITIONS_CHANGED | final static int EYE_POSITIONS_CHANGED(Code) | | |
HEAD_TO_VWORLD_CHANGED | final static int HEAD_TO_VWORLD_CHANGED(Code) | | |
IMAGE_PLATE_TO_VWORLD_CHANGED | final static int IMAGE_PLATE_TO_VWORLD_CHANGED(Code) | | |
LISTENER_CHANGED | final static int LISTENER_CHANGED(Code) | | |
debugFlag | final static boolean debugFlag(Code) | | |
internalErrors | final static boolean internalErrors(Code) | | |
intersectedRegions | Bounds[] intersectedRegions(Code) | | Array of Bounds nodes for the corresponding intersectedSoundscapes
array. This array is used when selecting the closest Soundscape.
This list is used when selecting the closest Soundscape.
Maintained as an expandable array.
|
intersectedSoundscapes | SoundscapeRetained[] intersectedSoundscapes(Code) | | Array of SoundScapeRetained nodes that intersect the viewPlatform
This list is a subset of the soundscapes array, and is used when
selecting the closest Soundscape.
Maintained as an expandable array.
|
lastAA | AuralAttributesRetained lastAA(Code) | | Maintain what reference to the last AuralAttributes found active
was so that only if there was a change do we need to reset these
parameters in the AudioDevice3D.
|
lastEventReceived | int lastEventReceived(Code) | | |
nImmedSounds | int nImmedSounds(Code) | | Current number of immediate mode sound nodes in the universe
|
nRetainedSounds | int nRetainedSounds(Code) | | Current number of scene graph sound nodes in the universe
|
prioritizedSounds | ArrayList prioritizedSounds(Code) | | An array of prioritized sounds currently playing "live" sounds.
This prioritized sound list is NO longer re-create instead sounds
are insert, shuffled or removed as messages are processed.
|
ready | boolean ready(Code) | | This boolean tells the thread to suspend itself.
This is true ONLY when everythings ready to render using run loop
|
region | Bounds region(Code) | | Reference to last processed region within run().
Maintained to avoid re-transforming this bounds.
|
resetAA | boolean resetAA(Code) | | Since AuralAttribute gain scale factor is multipled with sound's
initialGain scale factor, any change in AuralAttrib gain scale
factor should force an update of all active sounds' gains
Also, change in AuralAttributes should force a sound update
even if no other sound field changes occurred.
|
totalChannels | int totalChannels(Code) | | |
transformMsg | boolean transformMsg(Code) | | |
view | View view(Code) | | The View that owns this SoundScheduler
|
activate | void activate()(Code) | | |
attachSoundData | void attachSoundData(SoundSchedulerAtom soundAtom, MediaContainer soundData, boolean forceReload)(Code) | | Attempts to load sound data for a particular sound source onto
the chosen/initialized audio device
If this called, it is assumed that SoundRetained.audioDevice is
NOT null.
If an error in loading occurs (an exception is caught,...)
an error is printed out to stderr - an exception is not thrown.
Parameters: soundData - descrition of sound source data |
calcSchedulingAction | int calcSchedulingAction()(Code) | | Determine scheduling action for each live sound
|
checkAudioDevice3D | boolean checkAudioDevice3D()(Code) | | Check (and set if necessary) AudioDevice3D field
|
checkState | boolean checkState()(Code) | | |
clearListenerFlag | void clearListenerFlag()(Code) | | |
clearSoundData | void clearSoundData(SoundSchedulerAtom soundAtom)(Code) | | Clears the fields associated with sample data for this sound.
Assumes soundAtom is non-null, and that non-null atom
would have non-null sound field.
|
deactivate | void deactivate()(Code) | | |
deactivateAllSounds | synchronized void deactivateAllSounds()(Code) | | Deactive all playing sounds
If the sound is continuous thendSilence it but leave it playing
otherwise stop sound
|
findActiveSoundscapes | int findActiveSoundscapes()(Code) | | Process active Soundscapes (if there are any) and intersect these
soundscapes with the viewPlatform.
Returns the number of soundscapes that intesect with
view volume.
|
muteSilentSounds | void muteSilentSounds()(Code) | | Mute sounds that are to be played silently.
Not all the sound in the prioritized enabled sound list
may be able to be played. Due to low priority, some sounds
must be muted/silenced (if such an action frees up channel
resources) to make way for sounds with higher priority.
For each sound in priority list:
For sounds whose actions are X_SILENT:
Mute sounds to be silenced
Add the number of channels used by this muted sound to
current total number of channels used
For all remaining sounds (with actions other than above)
The number of channels that 'would be used' to play
potentially audible sounds is compared with
the number left on the device:
If this sound would use more channels than available
Change it's X_AUDIBLE action to X_SILENT
Mute sounds to be silenced
Add the number of channels used by this sound, muted
or not, to current total number of channels used
NOTE: requests for sounds to play beyond channel capability of
the audio device do NOT throw an exception when more sounds are
started than can be played. Rather the unplayable sounds are
muted. It is up to the AudioDevice3D implementation to determine
how muted/silent sounds are implememted (playing with gain zero
and thus using up channel resources, or stop and restarted with
correct offset when inactivated then re-actived.
|
pauseAllSounds | synchronized void pauseAllSounds()(Code) | | Pause all activity playing sounds
|
performActions | int performActions()(Code) | | Perform the scheduling action for each prioritized sound.
Now, finally, the scheduling action value reflects what is
requested and what is physically posible to perform.
So, for each sound in list of prioritized enabled sounds,
start/update sounds that are REALLY supposed to be either
playing audibly or playing silently.
number of active (audible and silent) sounds |
prioritizeSounds | int prioritizeSounds()(Code) | | Prioritize all sounds associated with SoundScheduler (view)
This only need be done once when scheduler is initialized since
the priority list is updated when:
a) PRIORITY_DIRTY_BIT in soundDirty field set; or
b) sound added or removed from live array list
|
processImmediateNodes | void processImmediateNodes(Object[] args, long referenceTime)(Code) | | |
processMessages | void processMessages(long referenceTime)(Code) | | |
processViewSpecificGroupChanged | void processViewSpecificGroupChanged(J3dMessage m)(Code) | | |
renderChanges | void renderChanges()(Code) | | The main loop for the Sound Scheduler.
|
reset | synchronized void reset()(Code) | | |
resumeAllSounds | synchronized void resumeAllSounds()(Code) | | Resume playing all paused active sounds
|
setAttribsDirtyFlag | void setAttribsDirtyFlag(SoundRetained node, int dirtyFlag)(Code) | | set dirty flags associated with SoundSchedulerAtom
|
setListenerFlag | void setListenerFlag(int flag)(Code) | | 'Dirty' flag == listenerUpdated flag
The ambiguous name 'dirtyFlag' is a legacy from when there was only a
single dirty flag set by Core yet tested and cleared in this scheduler.
These methods specifically set/test/clear the local listenerUpdated flag.
|
shortestTimeToFinish | long shortestTimeToFinish()(Code) | | Determine amount of time before next playing sound will be
is complete.
find the atom that has the least amount of time before is
finished playing and return this time
length of time in millisecond until the next active soundwill be complete. Returns -1 if no sounds are playing (or all arecomplete). |
start | void start(SoundSchedulerAtom soundAtom)(Code) | | Start the sample associated with this sound
Do everything necessary to start the sound:
set start time
the oscillator associated with this sound
|
stopAllSounds | synchronized void stopAllSounds()(Code) | | Stop all activity playing sounds
|
stopAllSounds | synchronized void stopAllSounds(boolean setPlayingSoundsPending)(Code) | | |
stopSound | void stopSound(SoundSchedulerAtom soundAtom, boolean setPending)(Code) | | stop playing one specific sound node
If setPending flag true, sound is stopped but enable state
is set to pending-on so that it is restarted.
|
testListenerFlag | boolean testListenerFlag()(Code) | | |
updateAuralAttribs | void updateAuralAttribs(AuralAttributesRetained attribs)(Code) | | Send current aural attributes to audio device
Note that a AA's dirtyFlag is clear only after parameters are sent to
audio device.
|
updateTransformChange | void updateTransformChange(UpdateTargets targets, long referenceTime)(Code) | | |
updateXformedParams | void updateXformedParams(boolean updateAll, SoundSchedulerAtom soundAtom)(Code) | | Update VirtualWorld local transform, sound position and direction.
This is done dynamically from PointSoundRetained as these fields
are updated (when soundAtom.status is AUDIBLE or SILENT), or by this.
render() method when sound is started (sound.enabled is true).
This method should only be called if mirror sound is a Point or
ConeSound.
Important: pre-transformed position and direction sent to AudioDevice.
|
|
|