|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
The AudioDevice3D class defines a 3D audio device that is used to set sound and aural attributes.
After the application chooses the AudioDevice3D that Java3D sound is to be rendered on, the Java 3D Sound Scheduler will call these methods for all active sounds to render them on the audio device.
The intent is for this interface to be implemented by AudioDevice Driver developers using a software or hardware sound engine of their choice.
Methods in this interface provide the Java3D Core a generic way to set and query the audio device the application has chosen audio rendering to be performed on. Methods in this interface include:
Start, stop, pause, unpause, mute, and unmute of sample on the device.
Set parameters for each sample corresponding to the fields in the Sound node.
Set the current active aural parameters that affect all positional samples.
Sound Types
Sound types match the Sound node classes defined for Java 3D core for BackgroundSound, PointSound, and ConeSound. The type of sound a sample is loaded as determines which methods affect it.
Sound Data Types
Samples can be processed as streaming or buffered data. Fully spatializing sound sources may require data to be buffered.
Field Summary | |
static int |
BACKGROUND_SOUND
Specifies the sound type as background sound. |
static int |
BUFFERED_AUDIO_DATA
Sound data specified as Buffered is copied by the AudioDevice driver implementation. |
static int |
CONE_SOUND
Specifies the sound type as cone sound. |
static int |
POINT_SOUND
Specifies the sound type as point sound. |
static int |
STREAMING_AUDIO_DATA
Sound data specified as Streaming is not copied by the AudioDevice driver implementation. |
Fields inherited from interface javax.media.j3d.AudioDevice |
HEADPHONES, MONO_SPEAKER, STEREO_SPEAKERS |
Method Summary | |
void |
clearSound(int index)
Requests that the AudioDevice free all resources associated with sample with index id. |
int |
getNumberOfChannelsUsed(int index)
Retrieves the number of channels (on executing audio device) that this sound is using, if it is playing, or is expected to use if it were begun to be played. |
int |
getNumberOfChannelsUsed(int index,
boolean muted)
Retrieves the number of channels (on executing audio device) that this sound is using, if it is playing, or is projected to use if it were to be started playing. |
long |
getSampleDuration(int index)
Returns the duration in milliseconds of the sound sample, if this information can be determined. |
long |
getStartTime(int index)
Returns the system time of when the sound was last "started". |
void |
muteSample(int index)
Makes the sample 'play silently'. |
void |
pauseSample(int index)
Temporarily stops a cached sample from playing without resetting the sample's current pointer back to the beginning of the sound data so that it can be unpaused at a later time from the same location in the sample when the pause was initiated. |
int |
prepareSound(int soundType,
MediaContainer soundData)
Accepts a reference to the MediaContainer which contains a reference to sound data and information about the type of data it is. |
void |
setAngularAttenuation(int index,
int filterType,
double[] angle,
float[] attenuationScaleFactor,
float[] filterCutoff)
Sets this sound's angular gain attenuation (including filter) by defining corresponding arrays containing angular offsets from the sound's axis, gain scale factors, and frequency cutoff applied to all active directional sounds. |
void |
setDirection(int index,
Vector3d direction)
Sets this sound's direction from the local coordinate vector provided. |
void |
setDistanceFilter(int filterType,
double[] distance,
float[] filterCutoff)
Sets Distance Filter corresponding arrays containing distances and frequency cutoff applied to all active positional sounds. |
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 frequencyScaleFactor)
Specifies a scale factor applied to the frequency (or wavelength). |
void |
setLoop(int index,
int count)
Sets a sound's loop count. |
void |
setPosition(int index,
Point3d position)
Sets this sound's location (in Local coordinates) from specified Point. |
void |
setReflectionCoefficient(float coefficient)
Sets the Reflective Coefficient scale factor applied to distinct low-order early reflections of sound off the surfaces in the region defined by the current listening region. |
void |
setReverbDelay(float reverbDelay)
Sets the reverberation delay time. |
void |
setReverbOrder(int reverbOrder)
Sets the reverberation order of reflections. |
void |
setRolloff(float rolloff)
Changes the speed of sound factor. |
void |
setSampleGain(int index,
float scaleFactor)
Sets the overall gain scale factor applied to data associated with this source to increase or decrease its overall amplitude. |
void |
setVelocityScaleFactor(float velocityScaleFactor)
Sets the Velocity scale factor applied during Doppler Effect calculation. |
void |
setView(View reference)
Accepts a reference to the current View. |
void |
setVworldXfrm(int index,
Transform3D trans)
Passes a reference to the concatenated transformation to be applied to local sound position and direction parameters. |
int |
startSample(int index)
Begins a sound playing on the AudioDevice. |
int |
stopSample(int index)
Stops the sound on the AudioDevice. |
void |
unmuteSample(int index)
Makes a silently playing sample audible. |
void |
unpauseSample(int index)
Restarts the paused sample from the location in the sample where paused. |
void |
updateSample(int index)
Explicitly updates a Sample. |
Methods inherited from interface javax.media.j3d.AudioDevice |
close, getAngleOffsetToSpeaker, getAudioPlaybackType, getCenterEarToSpeaker, getChannelsAvailable, getChannelsUsedForSound, getTotalChannels, initialize, setAngleOffsetToSpeaker, setAudioPlaybackType, setCenterEarToSpeaker |
Field Detail |
public static final int BACKGROUND_SOUND
public static final int POINT_SOUND
public static final int CONE_SOUND
public static final int STREAMING_AUDIO_DATA
public static final int BUFFERED_AUDIO_DATA
Method Detail |
public void setView(View reference)
This method should only be called by Java3D Core and NOT by any application.
reference
- the current Viewpublic int prepareSound(int soundType, MediaContainer soundData)
Once this preparation is complete for the sound sample, an AudioDevice specific index, used to reference the sample in future method calls, is returned. All the rest of the methods described below require this index as a parameter.
This method should only be called by Java3D Core and NOT by any application.
soundType
- defines the type of Sound Node: Background, Point, and
ConesoundData
- reference to MediaContainer sound data and cached flag
public void clearSound(int index)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver samplepublic long getSampleDuration(int index)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver sample
public int getNumberOfChannelsUsed(int index)
For some AudioDevice3D implementations:
A single sound could be rendered using multiple samples, each taking up mixer channels.
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver sample
public int getNumberOfChannelsUsed(int index, boolean muted)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver samplemuted
- flag to use as the current muted state ignoring current
mute state
public int startSample(int index)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver sample
public long getStartTime(int index)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver sample
public int stopSample(int index)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver sample
associated with sound data to be played
public void setSampleGain(int index, float scaleFactor)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver samplepublic void setLoop(int index, int count)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver sampleSound.setLoop(int)
public void setVworldXfrm(int index, Transform3D trans)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver sampletrans
- transformation matrix applied to local coordinate parameterspublic void setPosition(int index, Point3d position)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver sampleposition
- location of Point or Cone Sound in Virtual World
coordinatesPointSound.setPosition(float x, float y, float z)
,
PointSound.setPosition(Point3f position)
public void setDistanceGain(int index, double[] frontDistance, float[] frontAttenuationScaleFactor, double[] backDistance, float[] backAttenuationScaleFactor)
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.
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)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver sampledirection
- the new direction vector in local coordinatesConeSound.setDirection(float x, float y, float z)
,
ConeSound.setDirection(Vector3f direction)
public void setAngularAttenuation(int index, int filterType, double[] angle, float[] attenuationScaleFactor, float[] filterCutoff)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver samplefilterType
- describes type (if any) of filtering defined by attenuationangle
- 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)
This method should only be called by Java3D Core and NOT by any application.
rolloff
- atmospheric gain scale factor (changing speed of sound)AuralAttributes.setRolloff(float)
public void setReflectionCoefficient(float coefficient)
A full description of this parameter and how it is used is in the documentation for the AuralAttributes class.
This method should only be called by Java3D Core and NOT by any application.
coefficient
- reflection/absorption factor applied to reverbAuralAttributes.setReflectionCoefficient(float)
public void setReverbDelay(float reverbDelay)
A full description of this parameter and how it is used is in the documentation for the AuralAttributes class.
This method should only be called by Java3D Core and NOT by any application.
reverbDelay
- time between each order of late reflectionAuralAttributes.setReverbDelay(float reverbDelay)
public void setReverbOrder(int reverbOrder)
This method should only be called by Java3D Core and NOT by any application.
reverbOrder
- number of times reflections added to reverb signalAuralAttributes.setReverbOrder(int)
public void setDistanceFilter(int filterType, double[] distance, float[] filterCutoff)
This method should only be called by Java3D Core and NOT by any application.
filterType
- denotes the type of filtering to be applieddistance
- array of offset distances from sound originfilterCutoff
- array of frequency cutoffAuralAttributes.setDistanceFilter(float[] distance,
float[] frequencyCutoff)
,
AuralAttributes.setDistanceFilter(Point2f[] attenuation)
public void setFrequencyScaleFactor(float frequencyScaleFactor)
This method should only be called by Java3D Core and NOT by any application.
frequencyScaleFactor
- factor applied to change of frequencyAuralAttributes.setFrequencyScaleFactor(float)
public void setVelocityScaleFactor(float velocityScaleFactor)
This method should only be called by Java3D Core and NOT by any application.
velocityScaleFactor
- applied to velocity of sound in relation
to listenerAuralAttributes.setVelocityScaleFactor(float)
public void muteSample(int index)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver samplepublic void unmuteSample(int index)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver samplepublic void pauseSample(int index)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver samplepublic void unpauseSample(int index)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver samplepublic void updateSample(int index)
This method should only be called by Java3D Core and NOT by any application.
index
- device specific reference number to device driver sample
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |