public class PointSound extends Sound
A sound's amplitude is attenuated based on the distance between the listener and the sound source position. A piecewise linear curve (defined in terms of pairs of distance and gain scale factor) specifies the gain scale factor slope. The PointSound's location and attenuation distances are defined in the local coordinate system of the node.
Distance Gain Attenuation
Distance elements in this array of Point2f is a monotonically-increasing set of floating point numbers measured from the location of the sound source. Gain scale factors elements in this list of pairs can be any positive floating point numbers. While for most applications this list of gain scale factors will usually be monotonically-decreasing, they do not have to be. If this is not set, no distance gain attenuation is performed (equivalent to using a distance gain of 1.0 for all distances).
getDistanceGainLength method returns the length of the distance gain attenuation arrays. Arrays passed into getDistanceGain methods should all be at least this size.
There are two methods for getDistanceGain, one returning an array of points, the other returning separate arrays for each attenuation component.
Modifier and Type | Field and Description |
---|---|
static int |
ALLOW_DISTANCE_GAIN_READ
Specifies that this node allows access to its object's distance
gain attenuation information.
|
static int |
ALLOW_DISTANCE_GAIN_WRITE
Specifies that this node allows writing to its object's distance
gain attenuation information.
|
static int |
ALLOW_POSITION_READ
Specifies that this node allows access to its object's position
information.
|
static int |
ALLOW_POSITION_WRITE
Specifies that this node allows writing to its object's position
information.
|
ALLOW_CHANNELS_USED_READ, ALLOW_CONT_PLAY_READ, ALLOW_CONT_PLAY_WRITE, ALLOW_DURATION_READ, ALLOW_ENABLE_READ, ALLOW_ENABLE_WRITE, ALLOW_INITIAL_GAIN_READ, ALLOW_INITIAL_GAIN_WRITE, ALLOW_IS_PLAYING_READ, ALLOW_IS_READY_READ, ALLOW_LOOP_READ, ALLOW_LOOP_WRITE, ALLOW_MUTE_READ, ALLOW_MUTE_WRITE, ALLOW_PAUSE_READ, ALLOW_PAUSE_WRITE, ALLOW_PRIORITY_READ, ALLOW_PRIORITY_WRITE, ALLOW_RATE_SCALE_FACTOR_READ, ALLOW_RATE_SCALE_FACTOR_WRITE, ALLOW_RELEASE_READ, ALLOW_RELEASE_WRITE, ALLOW_SCHEDULING_BOUNDS_READ, ALLOW_SCHEDULING_BOUNDS_WRITE, ALLOW_SOUND_DATA_READ, ALLOW_SOUND_DATA_WRITE, DURATION_UNKNOWN, INFINITE_LOOPS, NO_FILTER
ALLOW_AUTO_COMPUTE_BOUNDS_READ, ALLOW_AUTO_COMPUTE_BOUNDS_WRITE, ALLOW_BOUNDS_READ, ALLOW_BOUNDS_WRITE, ALLOW_COLLIDABLE_READ, ALLOW_COLLIDABLE_WRITE, ALLOW_LOCAL_TO_VWORLD_READ, ALLOW_LOCALE_READ, ALLOW_PARENT_READ, ALLOW_PICKABLE_READ, ALLOW_PICKABLE_WRITE, ENABLE_COLLISION_REPORTING, ENABLE_PICK_REPORTING
Constructor and Description |
---|
PointSound()
Constructs and initializes a new PointSound node using default
parameters.
|
PointSound(MediaContainer soundData,
float initialGain,
float posX,
float posY,
float posZ)
Constructs a PointSound node object using only the provided parameter
values for sound data, sample gain, and position.
|
PointSound(MediaContainer soundData,
float initialGain,
int loopCount,
boolean release,
boolean continuous,
boolean enable,
Bounds region,
float priority,
float posX,
float posY,
float posZ,
float[] attenuationDistance,
float[] attenuationGain)
Construct a PointSound object accepting individual float parameters for
the elements of the position points, and accepting separate arrays for
the distance and gain scale factors components of distance attenuation.
|
PointSound(MediaContainer soundData,
float initialGain,
int loopCount,
boolean release,
boolean continuous,
boolean enable,
Bounds region,
float priority,
float posX,
float posY,
float posZ,
Point2f[] distanceGain)
Construct a PointSound object accepting individual float parameters for
the elements of the position point, and accepting an array of Point2f for
the distance attenuation values where each pair in the array contains a
distance and a gain scale factor.
|
PointSound(MediaContainer soundData,
float initialGain,
int loopCount,
boolean release,
boolean continuous,
boolean enable,
Bounds region,
float priority,
Point3f position,
float[] attenuationDistance,
float[] attenuationGain)
Construct a PointSound object accepting points as input for the position.
|
PointSound(MediaContainer soundData,
float initialGain,
int loopCount,
boolean release,
boolean continuous,
boolean enable,
Bounds region,
float priority,
Point3f position,
Point2f[] distanceGain)
Construct a PointSound object accepting Point3f as input for the position
and accepting an array of Point2f for the distance attenuation values
where each pair in the array contains a distance and a gain scale factor.
|
PointSound(MediaContainer soundData,
float initialGain,
Point3f position)
Constructs a PointSound node object using only the provided parameter
values for sound data, sample gain, and position.
|
Modifier and Type | Method and Description |
---|---|
Node |
cloneNode(boolean forceDuplicate)
Creates a new instance of the node.
|
void |
duplicateNode(Node originalNode,
boolean forceDuplicate)
Copies all node information from
originalNode into
the current node. |
void |
getDistanceGain(float[] distance,
float[] gain)
Gets this sound's distance gain attenuation values in separate arrays.
|
void |
getDistanceGain(Point2f[] attenuation)
Gets this sound's distance attenuation.
|
int |
getDistanceGainLength()
Get the length of this node's distance gain attenuation arrays.
|
void |
getPosition(Point3f position)
Retrieves this sound's direction and places it in the
vector provided.
|
void |
setDistanceGain(float[] distance,
float[] gain)
Sets this sound's distance gain attenuation as an array of Point2fs.
|
void |
setDistanceGain(Point2f[] attenuation)
Sets this sound's distance gain attenuation - where gain scale factor
is applied to sound based on distance listener is from sound source.
|
void |
setPosition(float x,
float y,
float z)
Sets this sound's position from the three values provided.
|
void |
setPosition(Point3f position)
Sets this sound's location from the vector provided.
|
getContinuousEnable, getDuration, getEnable, getInitialGain, getLoop, getMute, getNumberOfChannelsUsed, getNumberOfChannelsUsed, getPause, getPriority, getRateScaleFactor, getReleaseEnable, getSchedulingBoundingLeaf, getSchedulingBounds, getSoundData, isPlaying, isPlaying, isPlayingSilently, isPlayingSilently, isReady, isReady, setContinuousEnable, setEnable, setInitialGain, setLoop, setMute, setPause, setPriority, setRateScaleFactor, setReleaseEnable, setSchedulingBoundingLeaf, setSchedulingBounds, setSoundData, updateNodeReferences
cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, cloneTree, getBounds, getBoundsAutoCompute, getCollidable, getLocale, getLocalToVworld, getLocalToVworld, getParent, getPickable, setBounds, setBoundsAutoCompute, setCollidable, setPickable
clearCapability, clearCapabilityIsFrequent, duplicateSceneGraphObject, getCapability, getCapabilityIsFrequent, getName, getUserData, isCompiled, isLive, setCapability, setCapabilityIsFrequent, setName, setUserData, toString
public static final int ALLOW_POSITION_READ
public static final int ALLOW_POSITION_WRITE
public static final int ALLOW_DISTANCE_GAIN_READ
public static final int ALLOW_DISTANCE_GAIN_WRITE
public PointSound()
public PointSound(MediaContainer soundData, float initialGain, Point3f position)
soundData
- sound data associated with this sound source nodeinitialGain
- amplitude scale factor applied to sound sourceposition
- 3D location of sourcepublic PointSound(MediaContainer soundData, float initialGain, float posX, float posY, float posZ)
soundData
- sound data associated with this sound source nodeinitialGain
- amplitude scale factor applied to sound source dataposX
- x coordinate of location of sourceposY
- y coordinate of location of sourceposZ
- z coordinate of location of sourcepublic PointSound(MediaContainer soundData, float initialGain, int loopCount, boolean release, boolean continuous, boolean enable, Bounds region, float priority, Point3f position, Point2f[] distanceGain)
soundData
- sound data associated with this sound source nodeinitialGain
- amplitude scale factor applied to sound sourceloopCount
- number of times loop is loopedrelease
- flag denoting playing sound data to endcontinuous
- denotes that sound silently plays when disabledenable
- sound switched on/offregion
- scheduling boundspriority
- playback ranking valueposition
- 3D location of sourcedistanceGain
- array of (distance,gain) pairs controling attenuationpublic PointSound(MediaContainer soundData, float initialGain, int loopCount, boolean release, boolean continuous, boolean enable, Bounds region, float priority, float posX, float posY, float posZ, Point2f[] distanceGain)
soundData
- sound data associated with this sound source nodeinitialGain
- amplitude scale factor applied to sound sourceloopCount
- number of times loop is loopedrelease
- flag denoting playing sound to endcontinuous
- denotes that sound silently plays when disabledenable
- sound switched on/offregion
- scheduling boundspriority
- playback ranking valueposX
- x coordinate of location of sourceposY
- y coordinate of location of sourceposZ
- z coordinate of location of sourcedistanceGain
- array of (distance,gain) pairs controling attenuationpublic PointSound(MediaContainer soundData, float initialGain, int loopCount, boolean release, boolean continuous, boolean enable, Bounds region, float priority, Point3f position, float[] attenuationDistance, float[] attenuationGain)
soundData
- sound data associated with this sound source nodeinitialGain
- amplitude scale factor applied to sound sourceloopCount
- number of times loop is loopedrelease
- flag denoting playing sound data to endcontinuous
- denotes that sound silently plays when disabledenable
- sound switched on/offregion
- scheduling boundspriority
- playback ranking valueposition
- 3D location of sourceattenuationDistance
- array of distance values used for attenuationattenuationGain
- array of gain scale factors used for attenuationpublic PointSound(MediaContainer soundData, float initialGain, int loopCount, boolean release, boolean continuous, boolean enable, Bounds region, float priority, float posX, float posY, float posZ, float[] attenuationDistance, float[] attenuationGain)
soundData
- sound data associated with this sound source nodeinitialGain
- amplitude scale factor applied to sound sourceloopCount
- number of times loop is loopedrelease
- flag denoting playing sound to endcontinuous
- denotes that sound silently plays when disabledenable
- sound switched on/offregion
- scheduling boundspriority
- playback ranking valueposX
- x coordinate of location of sourceposY
- y coordinate of location of sourceposZ
- z coordinate of location of sourceattenuationDistance
- array of distance values used for attenuationattenuationGain
- array of gain scale factors used for attenuationpublic void setPosition(Point3f position)
position
- the new locationCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setPosition(float x, float y, float z)
x
- the new x positiony
- the new y positionz
- the new z positionCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void getPosition(Point3f position)
position
- the variable to receive the direction vectorCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setDistanceGain(Point2f[] attenuation)
attenuation
- defined by pairs of (distance,gain-scale-factor)CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void setDistanceGain(float[] distance, float[] gain)
distance
- array of monotonically-increasing floatsgain
- array of non-negative scale factorsCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic int getDistanceGainLength()
CapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void getDistanceGain(Point2f[] attenuation)
attenuation
- arrays containing distance attenuation pairsCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic void getDistanceGain(float[] distance, float[] gain)
distance
- array of float distance from sound sourcegain
- array of non-negative scale factors associated withCapabilityNotSetException
- if appropriate capability is
not set and this object is part of live or compiled scene graphpublic Node cloneNode(boolean forceDuplicate)
cloneTree
to duplicate the current node.cloneNode
in class Node
forceDuplicate
- when set to true
, causes the
duplicateOnCloneTree
flag to be ignored. When
false
, the value of each node's
duplicateOnCloneTree
variable determines whether
NodeComponent data is duplicated or copied.Node.cloneTree()
,
Node.cloneNode(boolean)
,
Node.duplicateNode(org.scijava.java3d.Node, boolean)
,
NodeComponent.setDuplicateOnCloneTree(boolean)
public void duplicateNode(Node originalNode, boolean forceDuplicate)
originalNode
into
the current node. This method is called from the
cloneNode
method which is, in turn, called by the
cloneTree
method.
For any NodeComponent
objects
contained by the object being duplicated, each NodeComponent
object's duplicateOnCloneTree
value is used to determine
whether the NodeComponent
should be duplicated in the new node
or if just a reference to the current node should be placed in the
new node. This flag can be overridden by setting the
forceDuplicate
parameter in the cloneTree
method to true
.
NOTE: Applications should not call this method directly.
It should only be called by the cloneNode method.
duplicateNode
in class Node
originalNode
- the original node to duplicate.forceDuplicate
- when set to true
, causes the
duplicateOnCloneTree
flag to be ignored. When
false
, the value of each node's
duplicateOnCloneTree
variable determines whether
NodeComponent data is duplicated or copied.ClassCastException
- if originalNode is not an instance of
PointSound
Node.cloneTree()
,
Node.cloneNode(boolean)
,
NodeComponent.setDuplicateOnCloneTree(boolean)
Copyright © 2016–2022 SciJava. All rights reserved.