SFXEmitter
Engine/source/T3D/sfx/sfxEmitter.h
The SFXEmitter is used to place 2D or 3D sounds into a mission.
Protected Types
Dirty { Track = BIT( 0 ) Filename = BIT( 2 ) Volume = BIT( 4 ) IsLooping = BIT( 5 ) Is3D = BIT( 6 ) MinDistance = BIT( 7 ) MaxDistance = BIT( 8 ) ConeInsideAngle = BIT( 9 ) ConeOutsideAngle = BIT( 10 ) ConeOutsideVolume = BIT( 11 ) Transform = BIT( 12 ) SourceGroup = BIT( 13 ) OutsideAmbient = BIT( 14 ) IsStreaming = BIT( 15 ) FadeInTime = BIT( 16 ) FadeOutTime = BIT( 17 ) Pitch = BIT( 18 ) ScatterDistance = BIT( 19 ) TrackOnly = BIT( 20 ) AllDirtyMask = 0xFFFFFFFF }
Dirty flags used to handle sound property updates locally and across the network.
UpdateMasks { InitialUpdateMask = BIT(0) TransformUpdateMask = BIT(1) DirtyUpdateMask = BIT(2) SourcePlayMask = BIT(3) SourceStopMask = BIT(4) AllSourceMasks = SourcePlayMask | SourceStopMask }
Network update masks.
Public Types
Parent
Protected Attributes
The description used by the local profile.
A local profile object used to coax the sound system to play a custom sound.
bool
If true playback starts when the emitter is added to the scene.
State block for cone rendering in editor.
bool
Whether to leave sound setup exclusively to the assigned mTrack and not override part of the track's description with emitter properties.
Protected Static Attributes
Point color when emitter is playing and in range of listener.
Point color when emitter is playing but out of range of listern.
Point color when emitter is not playing but in range of listener.
Point color when emitter is not playing and not in range of listener.
bool
If true, render all emitters when in editor (not only selected one).
Point size for rendering point clouds of emitter cones in editor.
Protected Functions
Return the playback status of the emitter's associated sound.
bool
_readDirtyFlag(BitStream * stream, U32 flag)
Helper which reads a flag from the stream and updates the mDirty bits.
Render visual feedback for 3D sounds in editor.
_renderObject(ObjectRenderInst * ri, SceneRenderState * state, BaseMatInstance * overrideMat)
Render emitter object in editor.
Public Functions
bool
containsPoint(const Point3F & point)
Return true if the given point is contained by the object's (collision) shape.
DECLARE_CATEGORY("3D Sound" )
DECLARE_DESCRIPTION("A 3D <a href="/coding/class/classsimobject/#classsimobject_1a1dfd4ae4b628f69df932347c4b1b078c">object</a> emitting sound." )
Called after any property of the object is changed in the world editor.
bool
is3D()
Return true if this object emits a 3D sound.
bool
Return true if the SFX system's listener is in range of this emitter.
bool
onAdd()
Called when the object is added to the sim.
onStaticModified(const char * slotName, const char * newValue)
Specifically, these are called by setDataField when a static or dynamic field is modified, see the console details.
packUpdate(NetConnection * conn, U32 mask, BitStream * stream)
Instructs this object to pack its state for transfer over the network.
prepRenderImage(SceneRenderState * state)
Called when the SceneManager is ready for the registration of render instances.
setTransform(const MatrixF & mat)
Sets the Object -> World transform.
unpackUpdate(NetConnection * conn, BitStream * stream)
Instructs this object to read state data previously packed with packUpdate.
Public Static Functions
Detailed Description
The SFXEmitter is used to place 2D or 3D sounds into a mission.
If the profile is set then the emitter plays that. If the profile is null and the filename is set then the local emitter options are used.
Note that you can call SFXEmitter.play() and SFXEmitter.stop() to control playback from script.
Protected Types
Dirty
Enumerator
- Track = BIT( 0 )
- Filename = BIT( 2 )
- Volume = BIT( 4 )
- IsLooping = BIT( 5 )
- Is3D = BIT( 6 )
- MinDistance = BIT( 7 )
- MaxDistance = BIT( 8 )
- ConeInsideAngle = BIT( 9 )
- ConeOutsideAngle = BIT( 10 )
- ConeOutsideVolume = BIT( 11 )
- Transform = BIT( 12 )
- SourceGroup = BIT( 13 )
- OutsideAmbient = BIT( 14 )
- IsStreaming = BIT( 15 )
- FadeInTime = BIT( 16 )
- FadeOutTime = BIT( 17 )
- Pitch = BIT( 18 )
- ScatterDistance = BIT( 19 )
- TrackOnly = BIT( 20 )
- AllDirtyMask = 0xFFFFFFFF
Dirty flags used to handle sound property updates locally and across the network.
UpdateMasks
Enumerator
- InitialUpdateMask = BIT(0)
- TransformUpdateMask = BIT(1)
- DirtyUpdateMask = BIT(2)
- SourcePlayMask = BIT(3)
- SourceStopMask = BIT(4)
- AllSourceMasks = SourcePlayMask | SourceStopMask
Network update masks.
Public Types
typedef SceneObject Parent
Protected Attributes
SFXDescription mDescription
The description used by the local profile.
BitSet32 mDirty
The current dirty flags.
SFXProfile mLocalProfile
A local profile object used to coax the sound system to play a custom sound.
bool mPlayOnAdd
If true playback starts when the emitter is added to the scene.
GFXStateBlockRef mRenderSB
State block for cone rendering in editor.
SFXSource * mSource
The sound source for the emitter.
SFXTrack * mTrack
The selected track or null if the local profile should be used.
bool mUseTrackDescriptionOnly
Whether to leave sound setup exclusively to the assigned mTrack and not override part of the track's description with emitter properties.
Protected Static Attributes
ColorI smRenderColorInnerCone
ColorI smRenderColorOuterCone
ColorI smRenderColorOutsideVolume
ColorI smRenderColorPlayingInRange
Point color when emitter is playing and in range of listener.
ColorI smRenderColorPlayingOutOfRange
Point color when emitter is playing but out of range of listern.
ColorI smRenderColorRangeSphere
ColorI smRenderColorStoppedInRange
Point color when emitter is not playing but in range of listener.
ColorI smRenderColorStoppedOutOfRange
Point color when emitter is not playing and not in range of listener.
bool smRenderEmitters
If true, render all emitters when in editor (not only selected one).
F32 smRenderPointDistance
F32 smRenderPointSize
Point size for rendering point clouds of emitter cones in editor.
Todo: Currently not implemented.
F32 smRenderRadialIncrements
F32 smRenderSweepIncrements
Protected Functions
_getPlaybackStatus()
Return the playback status of the emitter's associated sound.
This should only be called on either the ghost or the server object if the server is running in-process. Otherwise, the method will not return a meaningful value.
_readDirtyFlag(BitStream * stream, U32 flag)
Helper which reads a flag from the stream and updates the mDirty bits.
_render3DVisualFeedback()
Render visual feedback for 3D sounds in editor.
_renderCone(F32 radialIncrements, F32 sweepIncrements, F32 pointDistance, F32 startAngle, F32 stopAngle, F32 startVolume, F32 stopVolume, const ColorI & color)
_renderObject(ObjectRenderInst * ri, SceneRenderState * state, BaseMatInstance * overrideMat)
Render emitter object in editor.
_update()
Called when the emitter state has been marked dirty and the source needs to be updated.
Public Functions
SFXEmitter()
~SFXEmitter()
containsPoint(const Point3F & point)
Reimplemented from: SceneObject
DECLARE_CATEGORY("3D Sound" )
DECLARE_CONOBJECT(SFXEmitter )
DECLARE_DESCRIPTION("A 3D <a href="/coding/class/classsimobject/#classsimobject_1a1dfd4ae4b628f69df932347c4b1b078c">object</a> emitting sound." )
getSource()
Return the sound source object associated with the emitter.
note:This will only return a meaningful result when called on ghost objects.
inspectPostApply()
Reimplemented from: SceneObject
is3D()
Return true if this object emits a 3D sound.
isInRange()
Return true if the SFX system's listener is in range of this emitter.
onAdd()
Reimplemented from: SceneObject
onRemove()
Reimplemented from: SceneObject
onStaticModified(const char * slotName, const char * newValue)
Reimplemented from: SimObject
packUpdate(NetConnection * conn, U32 mask, BitStream * stream)
Reimplemented from: SceneObject
play()
Sends network event to start playback if the emitter source is not already playing.
prepRenderImage(SceneRenderState * state)
Reimplemented from: SceneObject
setScale(const VectorF & scale)
Reimplemented from: SceneObject
setTransform(const MatrixF & mat)
Reimplemented from: SceneObject
stop()
Sends network event to stop emitter playback on all ghosted clients.
unpackUpdate(NetConnection * conn, BitStream * stream)
Reimplemented from: SceneObject