|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.openal.Sound
public class Sound
Represents an instance of a sound clip which can be positioned in 3D space, gain and pitch adjusted and played or looped.
| Nested Class Summary | |
|---|---|
static interface |
Sound.StartObserver
Used to await notification of the starting of a sound which may be delayed in loading. |
| Field Summary | |
|---|---|
protected ClipBuffer |
_buffer
The OpenAL buffer from which we get our sound data. |
protected float |
_coneInnerAngle
The inside angle of the sound cone. |
protected float |
_coneOuterAngle
The outside angle of the sound cone. |
protected float |
_coneOuterGain
The gain outside the sound cone. |
protected float |
_dx
The direction of the sound. |
protected float |
_dy
The direction of the sound. |
protected float |
_dz
The direction of the sound. |
protected float |
_gain
The gain of the sound. |
protected SoundGroup |
_group
The sound group with which we are associated. |
protected boolean |
_loopDesired
Whether or not looping is desired after resolution. |
protected float |
_maxDistance
The maximum distance for attenuation. |
protected float |
_maxGain
The maximum gain. |
protected float |
_minGain
The minimum gain. |
protected float |
_pitch
The pitch multiplier. |
protected float |
_px
The position of the sound. |
protected float |
_py
The position of the sound. |
protected float |
_pz
The position of the sound. |
protected float |
_referenceDistance
The reference distance for attenuation. |
protected float |
_rolloffFactor
The attenuation rolloff factor. |
protected Source |
_source
The source via which we are playing our sound currently. |
protected boolean |
_sourceRelative
Whether or not the sound's position, velocity, etc. are relative to the listener. |
protected int |
_stateDesired
The desired state of the sound (stopped, playing, paused) after resolution. |
protected float |
_vx
The velocity of the sound. |
protected float |
_vy
The velocity of the sound. |
protected float |
_vz
The velocity of the sound. |
| Constructor Summary | |
|---|---|
protected |
Sound(SoundGroup group,
ClipBuffer buffer)
|
| Method Summary | |
|---|---|
ClipBuffer |
getBuffer()
Returns the buffer of audio data associated with this sound. |
SoundGroup |
getGroup()
Returns a reference to the group to which the sound belongs. |
boolean |
isPending()
Called to check if this sound wants to start playing. |
boolean |
isPlaying()
Called to check if this sound is currently playing. |
boolean |
loop(boolean allowDefer)
Loops this sound, starting from the beginning of the audio data. |
void |
pause()
Pauses this sound. |
boolean |
play(boolean allowDefer)
Plays this sound from the beginning. |
protected boolean |
play(boolean allowDefer,
boolean loop,
Sound.StartObserver obs)
|
boolean |
play(Sound.StartObserver obs,
boolean loop)
Plays this sound from the beginning, notifying the supplied observer when the audio starts. |
protected boolean |
reclaim()
Called by the SoundGroup when it wants to reclaim our source. |
void |
setConeInnerAngle(float angle)
Sets the inside angle of the sound cone. |
void |
setConeOuterAngle(float angle)
Sets the outside angle of the sound cone. |
void |
setConeOuterGain(float gain)
Sets the gain outside of the sound cone. |
void |
setDirection(float x,
float y,
float z)
Sets the direction of the sound. |
void |
setGain(float gain)
Sets the gain of the sound (which will be multiplied by the base gain). |
void |
setMaxDistance(float distance)
Sets the maximum distance for attenuation. |
void |
setMaxGain(float gain)
Sets the maximum gain. |
void |
setMinGain(float gain)
Sets the minimum gain. |
void |
setPitch(float pitch)
Sets the pitch multiplier. |
void |
setPosition(float x,
float y,
float z)
Sets the position of the sound. |
void |
setReferenceDistance(float distance)
Sets the reference distance for attenuation. |
void |
setRolloffFactor(float rolloff)
Sets the rolloff factor for attenuation. |
void |
setSourceRelative(boolean relative)
Sets whether or not the position, velocity, etc., of the sound are relative to the listener. |
void |
setVelocity(float x,
float y,
float z)
Sets the velocity of the sound. |
void |
stop()
Stops this sound and rewinds to its beginning. |
protected void |
updateSourceGain()
Updates the source gain according to our configured gain and the base gain. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected SoundGroup _group
protected ClipBuffer _buffer
protected Source _source
protected int _stateDesired
protected boolean _loopDesired
protected float _px
protected float _py
protected float _pz
protected float _vx
protected float _vy
protected float _vz
protected float _gain
protected boolean _sourceRelative
protected float _minGain
protected float _maxGain
protected float _referenceDistance
protected float _rolloffFactor
protected float _maxDistance
protected float _pitch
protected float _dx
protected float _dy
protected float _dz
protected float _coneInnerAngle
protected float _coneOuterAngle
protected float _coneOuterGain
| Constructor Detail |
|---|
protected Sound(SoundGroup group,
ClipBuffer buffer)
| Method Detail |
|---|
public SoundGroup getGroup()
public ClipBuffer getBuffer()
public void setPosition(float x,
float y,
float z)
public void setVelocity(float x,
float y,
float z)
public void setGain(float gain)
public void setSourceRelative(boolean relative)
public void setMinGain(float gain)
public void setMaxGain(float gain)
public void setReferenceDistance(float distance)
public void setRolloffFactor(float rolloff)
public void setMaxDistance(float distance)
public void setPitch(float pitch)
public void setDirection(float x,
float y,
float z)
public void setConeInnerAngle(float angle)
public void setConeOuterAngle(float angle)
public void setConeOuterGain(float gain)
public boolean play(boolean allowDefer)
allowDefer - if false, the sound will be played immediately or not at all. If true,
the sound will be queued up for loading if it is currently flushed from the cache and
played once loaded.
public boolean loop(boolean allowDefer)
pause()d or stop()ped. While the sound is playing an audio channel will
be locked.
public boolean play(Sound.StartObserver obs,
boolean loop)
loop - whether or not to loop the sampe until stop()ped.public void pause()
play(boolean) will resume the sound from the
precise position that it left off. While the sound is paused, its audio channel will remain
locked.
public void stop()
public boolean isPlaying()
public boolean isPending()
protected boolean play(boolean allowDefer,
boolean loop,
Sound.StartObserver obs)
protected void updateSourceGain()
protected boolean reclaim()
SoundGroup when it wants to reclaim our source.
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||