Package com.sun.j3d.audioengines
Class AudioEngine3D
java.lang.Object
com.sun.j3d.audioengines.AudioEngine
com.sun.j3d.audioengines.AudioEngine3D
- All Implemented Interfaces:
AudioDevice,AudioDevice3D
- Direct Known Subclasses:
AudioEngine3DL2
The AudioEngine3D Class defines an audio output device that generates
sound 'image' from high-level sound parameters passed to it during
scene graph.
The methods in this class are meant to be optionally overridden by an extended class. This extended class would provice device specific code.
Error checking on all parameters passed to these methods is already explicitly being done by the Java 3D core code that calls these methods.
NOTE: AudioEngine developers should not subclass this class directly. Subclass AudioEngine3DL2 instead.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected AuralParametersprotected ViewCurrent View sound is being renderedprotected ArrayListFields inherited from interface javax.media.j3d.AudioDevice
HEADPHONES, MONO_SPEAKER, STEREO_SPEAKERSFields inherited from interface javax.media.j3d.AudioDevice3D
BACKGROUND_SOUND, BUFFERED_AUDIO_DATA, CONE_SOUND, POINT_SOUND, STREAMING_AUDIO_DATA -
Constructor Summary
ConstructorsConstructorDescriptionAudioEngine3D(PhysicalEnvironment physicalEnvironment) Construct a new AudioEngine with the specified PhysicalEnvironment. -
Method Summary
Modifier and TypeMethodDescriptionabstract voidclearSound(int index) Clear Sound.intgetNumberOfChannelsUsed(int index) Get number of channels used by a particular sample on the audio device.intgetNumberOfChannelsUsed(int index, boolean muteFlag) Get number of channels that would be used by a particular sample on the audio device given the mute flag passed in as a parameter.getSample(int index) Get specific sample from indexed sample list Checks for valid index before attempting to get sample from list.longgetSampleDuration(int index) Get length of time a sample would play if allowed to play to completion.protected ArrayListDeprecated.unsafe to get reference to samples list with this method.intlonggetStartTime(int index) Get time this sample begun playing on the audio device.getView()Get reference to the current View object.abstract voidmuteSample(int index) Mute sample.abstract voidpauseSample(int index) Pause sample.intprepareSound(int soundType, MediaContainer soundData) Prepare Sound in device.voidsetAngularAttenuation(int index, int filterType, double[] angle, float[] attenuationScaleFactor, float[] filterCutoff) Set angular attenuation arrays affecting angular amplitude attenuation and angular distance filtering.voidsetDirection(int index, javax.vecmath.Vector3d direction) Set direction vector of sample.voidsetDistanceFilter(int filterType, double[] dist, float[] filterCutoff) Set distance filter for current aural attribute applied to all samples.voidsetDistanceGain(int index, double[] frontDistance, float[] frontAttenuationScaleFactor, double[] backDistance, float[] backAttenuationScaleFactor) Sets this sound's distance gain elliptical attenuation (not including filter cutoff frequency) by defining corresponding arrays containing distances from the sound's origin and gain scale factors applied to all active positional sounds.voidsetFrequencyScaleFactor(float scaleFactor) Set frequency scale factor for current aural attribute applied to all samples.voidsetLoop(int index, int count) Set number of times sample is looped.voidsetPosition(int index, javax.vecmath.Point3d position) Set location of sample.voidsetReflectionCoefficient(float coefficient) Set reverberation surface reflection coefficient value for current aural attribute applied to all samples.voidsetReverbDelay(float reverbDelay) Set reverberation delay time for current aural attribute applied to all samples.voidsetReverbOrder(int reverbOrder) Set reverberation order for current aural attribute applied to all samples.voidsetRolloff(float rolloff) Set rolloff value for current aural attribute applied to all samples.voidsetSampleGain(int index, float scaleFactor) Set gain scale factor applied to sample.voidsetVelocityScaleFactor(float scaleFactor) Set velocity scale factor for current aural attribute applied to all samples when Doppler is calculated.voidSave a reference to the current View object.voidsetVworldXfrm(int index, Transform3D trans) Set the transform for local to virtual world coordinate spaceabstract intstartSample(int index) Start sample playing on audio deviceabstract intstopSample(int index) Stop sample playing on audio deviceabstract voidunmuteSample(int index) Unmute sample.abstract voidunpauseSample(int index) Unpause sample.abstract voidupdateSample(int index) Update sample.Methods inherited from class com.sun.j3d.audioengines.AudioEngine
close, getAngleOffsetToSpeaker, getAudioPlaybackType, getCenterEarToSpeaker, getChannelsAvailable, getChannelsUsedForSound, getTotalChannels, initialize, setAngleOffsetToSpeaker, setAudioPlaybackType, setCenterEarToSpeakerMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface javax.media.j3d.AudioDevice
close, getAngleOffsetToSpeaker, getAudioPlaybackType, getCenterEarToSpeaker, getChannelsAvailable, getChannelsUsedForSound, getTotalChannels, initialize, setAngleOffsetToSpeaker, setAudioPlaybackType, setCenterEarToSpeaker
-
Field Details
-
samples
-
currentView
Current View sound is being rendered -
attribs
-
-
Constructor Details
-
AudioEngine3D
Construct a new AudioEngine with the specified PhysicalEnvironment.- Parameters:
physicalEnvironment- the physical environment object where we want access to this device.
-
-
Method Details
-
setView
Save a reference to the current View object.- Specified by:
setViewin interfaceAudioDevice3D- Parameters:
reference- to current view object
-
getView
Get reference to the current View object.- Returns:
- reference to current view object
-
prepareSound
Prepare Sound in device. Makes sound assessible to device - in this case attempts to load sound Stores sound type and data.- Specified by:
prepareSoundin interfaceAudioDevice3D- Parameters:
soundType- denotes type of sound: Background, Point or ConesoundData- descrition of sound source data- Returns:
- index into sample vector of Sample object for sound
-
clearSound
public abstract void clearSound(int index) Clear Sound. Removes/clears associated sound data with this sound source node- Specified by:
clearSoundin interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sample
-
setVworldXfrm
Set the transform for local to virtual world coordinate space- Specified by:
setVworldXfrmin interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sampletrans- is a reference to virtual world composite transform
-
startSample
public abstract int startSample(int index) Start sample playing on audio device- Specified by:
startSamplein interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sample- Returns:
- status: < 0 denotes an error
-
stopSample
public abstract int stopSample(int index) Stop sample playing on audio device- Specified by:
stopSamplein interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sample- Returns:
- status: < 0 denotes an error
-
updateSample
public abstract void updateSample(int index) Update sample. Implies that some parameters affecting rendering have been modified.- Specified by:
updateSamplein interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sample
-
muteSample
public abstract void muteSample(int index) Mute sample.- Specified by:
muteSamplein interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sample
-
unmuteSample
public abstract void unmuteSample(int index) Unmute sample.- Specified by:
unmuteSamplein interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sample
-
pauseSample
public abstract void pauseSample(int index) Pause sample.- Specified by:
pauseSamplein interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sample
-
unpauseSample
public abstract void unpauseSample(int index) Unpause sample.- Specified by:
unpauseSamplein interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sample
-
setSampleGain
public void setSampleGain(int index, float scaleFactor) Set gain scale factor applied to sample.- Specified by:
setSampleGainin interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver samplescaleFactor- floating point multiplier applied to sample amplitude
-
setLoop
public void setLoop(int index, int count) Set number of times sample is looped.- Specified by:
setLoopin interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver samplecount- number of times sample is repeated- See Also:
-
setPosition
public void setPosition(int index, javax.vecmath.Point3d position) Set location of sample.- Specified by:
setPositionin interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sampleposition- point location in virtual world coordinate of sample- See Also:
-
setDistanceGain
public void setDistanceGain(int index, double[] frontDistance, float[] frontAttenuationScaleFactor, double[] backDistance, float[] backAttenuationScaleFactor) Description copied from interface:AudioDevice3DSets this sound's distance gain elliptical attenuation (not including filter cutoff frequency) by defining corresponding arrays containing distances from the sound's origin and gain scale factors applied to all active positional sounds. Gain scale factor is applied to sound based on the distance the listener is from sound source. These attenuation parameters are ignored for BackgroundSound nodes. The back attenuation parameter is ignored for PointSound nodes.The form of the attenuation parameters match that of the ConeSound method of the same name. A full description of this parameter and how it is used is in the documentation for ConeSound class.
This method should only be called by Java3D Core and NOT by any application.
- Specified by:
setDistanceGainin interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver samplefrontDistance- defines an array of distance along positive axis through which ellipses passfrontAttenuationScaleFactor- gain scale factorsbackDistance- defines an array of distance along the negative axis through which ellipses passbackAttenuationScaleFactor- gain scale factors- See Also:
-
setDirection
public void setDirection(int index, javax.vecmath.Vector3d direction) Set direction vector of sample.- Specified by:
setDirectionin interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sampledirection- vector in virtual world coordinate.- See Also:
-
setAngularAttenuation
public void setAngularAttenuation(int index, int filterType, double[] angle, float[] attenuationScaleFactor, float[] filterCutoff) Set angular attenuation arrays affecting angular amplitude attenuation and angular distance filtering.- Specified by:
setAngularAttenuationin interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver samplefilterType- denotes type of filtering (on no filtering) applied to sample.angle- array containing angular distances from sound axisattenuationScaleFactor- array containing gain scale factorfilterCutoff- array containing filter cutoff frequencies. The filter values for each tuples can be set to Sound.NO_FILTER.- See Also:
-
setRolloff
public void setRolloff(float rolloff) Set rolloff value for current aural attribute applied to all samples.- Specified by:
setRolloffin interfaceAudioDevice3D- Parameters:
rolloff- scale factor applied to standard speed of sound.- See Also:
-
setReflectionCoefficient
public void setReflectionCoefficient(float coefficient) Set reverberation surface reflection coefficient value for current aural attribute applied to all samples.- Specified by:
setReflectionCoefficientin interfaceAudioDevice3D- Parameters:
coefficient- applied to amplitude of reverbation added at each iteration of reverb processing.- See Also:
-
setReverbDelay
public void setReverbDelay(float reverbDelay) Set reverberation delay time for current aural attribute applied to all samples.- Specified by:
setReverbDelayin interfaceAudioDevice3D- Parameters:
reverbDelay- amount of time in millisecond between each iteration of reverb processing.- See Also:
-
setReverbOrder
public void setReverbOrder(int reverbOrder) Set reverberation order for current aural attribute applied to all samples.- Specified by:
setReverbOrderin interfaceAudioDevice3D- Parameters:
reverbOrder- number of times reverb process loop is iterated.- See Also:
-
setDistanceFilter
public void setDistanceFilter(int filterType, double[] dist, float[] filterCutoff) Set distance filter for current aural attribute applied to all samples.- Specified by:
setDistanceFilterin interfaceAudioDevice3D- Parameters:
filterType- denotes type of filtering (on no filtering) applied to all sample based on distance between listener and sound.dist- is an attenuation array of distance and low-pass filter values.filterCutoff- array of frequency cutoff- See Also:
-
setFrequencyScaleFactor
public void setFrequencyScaleFactor(float scaleFactor) Set frequency scale factor for current aural attribute applied to all samples.- Specified by:
setFrequencyScaleFactorin interfaceAudioDevice3D- Parameters:
scaleFactor- frequency scale factor applied to samples normal playback rate.- See Also:
-
setVelocityScaleFactor
public void setVelocityScaleFactor(float scaleFactor) Set velocity scale factor for current aural attribute applied to all samples when Doppler is calculated.- Specified by:
setVelocityScaleFactorin interfaceAudioDevice3D- Parameters:
scaleFactor- scale factor applied to postional samples' listener-to-soundSource velocity. playback rate.- See Also:
-
getNumberOfChannelsUsed
public int getNumberOfChannelsUsed(int index) Get number of channels used by a particular sample on the audio device.- Specified by:
getNumberOfChannelsUsedin interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sample- Returns:
- number of channels currently being used by this sample.
-
getNumberOfChannelsUsed
public int getNumberOfChannelsUsed(int index, boolean muteFlag) Get number of channels that would be used by a particular sample on the audio device given the mute flag passed in as a parameter.- Specified by:
getNumberOfChannelsUsedin interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver samplemuteFlag- denotes the mute state to assume while executing this query. This mute value does not have to match the current mute state of the sample.- Returns:
- number of channels that would be used by this sample if it were playing.
-
getSampleDuration
public long getSampleDuration(int index) Get length of time a sample would play if allowed to play to completion.- Specified by:
getSampleDurationin interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sample- Returns:
- length of sample in milliseconds
-
getStartTime
public long getStartTime(int index) Get time this sample begun playing on the audio device.- Specified by:
getStartTimein interfaceAudioDevice3D- Parameters:
index- device specific reference number to device driver sample- Returns:
- system clock time sample started
-
getSampleList
Deprecated.unsafe to get reference to samples list with this method. It's better to directly reference samples list within a synchronized block which also contains calls to .getSample(index).Get reference to the array list of samples- Returns:
- reference to samples list
-
getSampleListSize
public int getSampleListSize() -
getSample
Get specific sample from indexed sample list Checks for valid index before attempting to get sample from list.- Parameters:
index- device specific reference number to device driver sample- Returns:
- reference to sample; returns null if index out of range.
- Since:
- Java 3D 1.2.1
-
getAuralParameters
-