public abstract class AudioEngine3D extends AudioEngine implements AudioDevice3D
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.
Modifier and Type | Field and Description |
---|---|
protected AuralParameters |
attribs |
protected View |
currentView
Current View sound is being rendered
|
protected ArrayList |
samples |
BACKGROUND_SOUND, BUFFERED_AUDIO_DATA, CONE_SOUND, POINT_SOUND, STREAMING_AUDIO_DATA
HEADPHONES, MONO_SPEAKER, STEREO_SPEAKERS
Constructor and Description |
---|
AudioEngine3D(PhysicalEnvironment physicalEnvironment)
Construct a new AudioEngine with the specified PhysicalEnvironment.
|
Modifier and Type | Method and Description |
---|---|
abstract void |
clearSound(int index)
Clear Sound.
|
AuralParameters |
getAuralParameters() |
int |
getNumberOfChannelsUsed(int index)
Get number of channels used by a particular sample on the audio device.
|
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.
|
Sample |
getSample(int index)
Get specific sample from indexed sample list
Checks for valid index before attempting to get sample from list.
|
long |
getSampleDuration(int index)
Get length of time a sample would play if allowed to play to completion.
|
protected ArrayList |
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).
|
int |
getSampleListSize() |
long |
getStartTime(int index)
Get time this sample begun playing on the audio device.
|
View |
getView()
Get reference to the current View object.
|
abstract void |
muteSample(int index)
Mute sample.
|
abstract void |
pauseSample(int index)
Pause sample.
|
int |
prepareSound(int soundType,
MediaContainer soundData)
Prepare Sound in device.
|
void |
setAngularAttenuation(int index,
int filterType,
double[] angle,
float[] attenuationScaleFactor,
float[] filterCutoff)
Set angular attenuation arrays affecting angular amplitude attenuation
and angular distance filtering.
|
void |
setDirection(int index,
Vector3d direction)
Set direction vector of sample.
|
void |
setDistanceFilter(int filterType,
double[] dist,
float[] filterCutoff)
Set distance filter for current aural attribute applied to all samples.
|
void |
setDistanceGain(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.
|
void |
setFrequencyScaleFactor(float scaleFactor)
Set frequency scale factor for current aural attribute applied to all
samples.
|
void |
setLoop(int index,
int count)
Set number of times sample is looped.
|
void |
setPosition(int index,
Point3d position)
Set location of sample.
|
void |
setReflectionCoefficient(float coefficient)
Set reverberation surface reflection coefficient value for current aural
attribute applied to all samples.
|
void |
setReverbDelay(float reverbDelay)
Set reverberation delay time for current aural attribute applied to
all samples.
|
void |
setReverbOrder(int reverbOrder)
Set reverberation order for current aural attribute applied to all
samples.
|
void |
setRolloff(float rolloff)
Set rolloff value for current aural attribute applied to all samples.
|
void |
setSampleGain(int index,
float scaleFactor)
Set gain scale factor applied to sample.
|
void |
setVelocityScaleFactor(float scaleFactor)
Set velocity scale factor for current aural attribute applied to all
samples when Doppler is calculated.
|
void |
setView(View reference)
Save a reference to the current View object.
|
void |
setVworldXfrm(int index,
Transform3D trans)
Set the transform for local to virtual world coordinate space
|
abstract int |
startSample(int index)
Start sample playing on audio device
|
abstract int |
stopSample(int index)
Stop sample playing on audio device
|
abstract void |
unmuteSample(int index)
Unmute sample.
|
abstract void |
unpauseSample(int index)
Unpause sample.
|
abstract void |
updateSample(int index)
Update sample.
|
close, getAngleOffsetToSpeaker, getAudioPlaybackType, getCenterEarToSpeaker, getChannelsAvailable, getChannelsUsedForSound, getTotalChannels, initialize, setAngleOffsetToSpeaker, setAudioPlaybackType, setCenterEarToSpeaker
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
close, getAngleOffsetToSpeaker, getAudioPlaybackType, getCenterEarToSpeaker, getChannelsAvailable, getChannelsUsedForSound, getTotalChannels, initialize, setAngleOffsetToSpeaker, setAudioPlaybackType, setCenterEarToSpeaker
protected ArrayList samples
protected View currentView
protected AuralParameters attribs
public AudioEngine3D(PhysicalEnvironment physicalEnvironment)
physicalEnvironment
- the physical environment object where we
want access to this device.public void setView(View reference)
setView
in interface AudioDevice3D
reference
- to current view objectpublic View getView()
public int prepareSound(int soundType, MediaContainer soundData)
prepareSound
in interface AudioDevice3D
soundType
- denotes type of sound: Background, Point or ConesoundData
- descrition of sound source datapublic abstract void clearSound(int index)
clearSound
in interface AudioDevice3D
index
- device specific reference number to device driver samplepublic void setVworldXfrm(int index, Transform3D trans)
setVworldXfrm
in interface AudioDevice3D
index
- device specific reference number to device driver sampletrans
- is a reference to virtual world composite transformpublic abstract int startSample(int index)
startSample
in interface AudioDevice3D
index
- device specific reference number to device driver samplepublic abstract int stopSample(int index)
stopSample
in interface AudioDevice3D
index
- device specific reference number to device driver samplepublic abstract void updateSample(int index)
updateSample
in interface AudioDevice3D
index
- device specific reference number to device driver samplepublic abstract void muteSample(int index)
muteSample
in interface AudioDevice3D
index
- device specific reference number to device driver samplepublic abstract void unmuteSample(int index)
unmuteSample
in interface AudioDevice3D
index
- device specific reference number to device driver samplepublic abstract void pauseSample(int index)
pauseSample
in interface AudioDevice3D
index
- device specific reference number to device driver samplepublic abstract void unpauseSample(int index)
unpauseSample
in interface AudioDevice3D
index
- device specific reference number to device driver samplepublic void setSampleGain(int index, float scaleFactor)
setSampleGain
in interface AudioDevice3D
index
- device specific reference number to device driver samplescaleFactor
- floating point multiplier applied to sample amplitudepublic void setLoop(int index, int count)
setLoop
in interface AudioDevice3D
index
- device specific reference number to device driver samplecount
- number of times sample is repeatedSound.setLoop(int)
public void setPosition(int index, Point3d position)
setPosition
in interface AudioDevice3D
index
- device specific reference number to device driver sampleposition
- point location in virtual world coordinate of samplePointSound.setPosition(float x, float y, float z)
,
PointSound.setPosition(Point3f position)
public void setDistanceGain(int index, double[] frontDistance, float[] frontAttenuationScaleFactor, double[] backDistance, float[] backAttenuationScaleFactor)
AudioDevice3D
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.
setDistanceGain
in interface AudioDevice3D
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 factorsConeSound.setDistanceGain(float[] frontDistance, float[] frontGain,
float[] backDistance, float[] backGain)
,
ConeSound.setDistanceGain(Point2f[] frontAttenuation,
Point2f[] backAttenuation)
public void setDirection(int index, Vector3d direction)
setDirection
in interface AudioDevice3D
index
- device specific reference number to device driver sampledirection
- vector in virtual world coordinate.ConeSound.setDirection(float x, float y, float z)
,
ConeSound.setDirection(Vector3f direction)
public void setAngularAttenuation(int index, int filterType, double[] angle, float[] attenuationScaleFactor, float[] filterCutoff)
setAngularAttenuation
in interface AudioDevice3D
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.ConeSound.setAngularAttenuation(float[] distance, float[] gain,
float[] filter)
,
ConeSound.setAngularAttenuation(Point3f[] attenuation)
,
ConeSound.setAngularAttenuation(Point2f[] attenuation)
public void setRolloff(float rolloff)
setRolloff
in interface AudioDevice3D
rolloff
- scale factor applied to standard speed of sound.AuralAttributes.setRolloff(float)
public void setReflectionCoefficient(float coefficient)
setReflectionCoefficient
in interface AudioDevice3D
coefficient
- applied to amplitude of reverbation added at each
iteration of reverb processing.AuralAttributes.setReflectionCoefficient(float)
public void setReverbDelay(float reverbDelay)
setReverbDelay
in interface AudioDevice3D
reverbDelay
- amount of time in millisecond between each
iteration of reverb processing.AuralAttributes.setReverbDelay(float reverbDelay)
public void setReverbOrder(int reverbOrder)
setReverbOrder
in interface AudioDevice3D
reverbOrder
- number of times reverb process loop is iterated.AuralAttributes.setReverbOrder(int)
public void setDistanceFilter(int filterType, double[] dist, float[] filterCutoff)
setDistanceFilter
in interface AudioDevice3D
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 cutoffAuralAttributes.setDistanceFilter(float[] distance,
float[] frequencyCutoff)
,
AuralAttributes.setDistanceFilter(Point2f[] attenuation)
public void setFrequencyScaleFactor(float scaleFactor)
setFrequencyScaleFactor
in interface AudioDevice3D
scaleFactor
- frequency scale factor applied to samples normal
playback rate.AuralAttributes.setFrequencyScaleFactor(float)
public void setVelocityScaleFactor(float scaleFactor)
setVelocityScaleFactor
in interface AudioDevice3D
scaleFactor
- scale factor applied to postional samples'
listener-to-soundSource velocity.
playback rate.AuralAttributes.setVelocityScaleFactor(float)
public int getNumberOfChannelsUsed(int index)
getNumberOfChannelsUsed
in interface AudioDevice3D
index
- device specific reference number to device driver samplepublic int getNumberOfChannelsUsed(int index, boolean muteFlag)
getNumberOfChannelsUsed
in interface AudioDevice3D
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.public long getSampleDuration(int index)
getSampleDuration
in interface AudioDevice3D
index
- device specific reference number to device driver samplepublic long getStartTime(int index)
getStartTime
in interface AudioDevice3D
index
- device specific reference number to device driver sampleprotected ArrayList getSampleList()
public int getSampleListSize()
public Sample getSample(int index)
index
- device specific reference number to device driver samplepublic AuralParameters getAuralParameters()
Copyright © 2016–2022 SciJava. All rights reserved.