Dayz Explorer 1.28.160049
Loading...
Searching...
No Matches
EffectSound Class Reference

Wrapper class for managing sound through SEffectManager. More...

Inheritance diagram for EffectSound:

Protected Member Functions

EffectType

Information about what type of effect the Effect is, without the need for casting

override EffectType GetEffectType ()
 Get what type of effect the Effect is.
 
override bool IsSound ()
 Check whether the Effect is EffectSound without casting.
 
Playback

Methods to Play/Stop sound Generally, SEffectManager.PlaySound methods are used instead of SoundPlay

bool SoundPlayEx (out SoundParams params)
 Plays sound.
 
bool SoundPlay ()
 Plays sound.
 
override void Start ()
 Plays sound.
 
void SoundStop ()
 Stops sound.
 
override void Stop ()
 Stops sound.
 
void SoundReset ()
 Resets EffectSound.
 
bool IsSoundPlaying ()
 Get whether EffectSound is currently playing.
 
override bool IsPlaying ()
 Returns true when the effect is playing, false otherwise.
 
Sound load

Methods regarding the loading of the sound, used in SoundPlay

bool SoundLoadEx (out SoundParams params)
 Loads in the sound when it is requested for playing through 'SoundPlayEx'.
 
bool SoundLoad ()
 Loads in the sound when it is requested for playing.
 
bool IsSoundValid ()
 Helper for checking if params are valid.
 
void ValidateSoundWave ()
 Gets called to fill in the necessary data when the header has finished loading.
 
bool SoundWaveValidation ()
 Validation of fade settings.
 
void UpdateEvents ()
 Enables the frame event on the EffectSound.
 
Events

Various events that can be overriden for custom behaviour

override void Event_OnFrameUpdate (float time_delta)
 Event called on frame when enabled by SetEnableEventFrame(true)
 
override void Event_OnRegistered (int id)
 Event called from SEffectManager when the Effect is registered.
 
override void Event_OnUnregistered ()
 Event called from SEffectManager when the Effect is unregistered.
 
void Event_OnSoundWaveStarted ()
 Event called when sound starts playing.
 
void Event_OnSoundWaveEnded ()
 Event called when sound stops playing.
 
void Event_OnSoundFadeInStopped ()
 Event called when sound fade in stops.
 
void Event_OnSoundFadeOutStarted ()
 Event called when sound fade out starts.
 
AutoDestroy

Methods regarding automatic cleanup on stop

override void SetAutodestroy (bool auto_destroy)
 Sets whether Effect automatically cleans up when it stops.
 
override bool IsAutodestroy ()
 Get whether Effect automatically cleans up when it stops.
 
void SetSoundAutodestroy (bool auto_destroy)
 Sets whether EffectSound automatically cleans up when sound stops.
 
bool IsSoundAutodestroy ()
 Get whether EffectSound automatically cleans up when sound stops.
 
override bool CanDestroy ()
 
Generic API

Setters and getters for generic data and properties

override void SetParent (Object parent_obj, int pivot)
 Set parent for the sound to follow.
 
override Object GetParent ()
 Get parent for the EffectSound.
 
override int GetPivotIndex ()
 Get parent pivot of the Effect, only valid when there is some GetParent.
 
override Object GetCurrentParent ()
 Get parent for the EffectSound.
 
override void SetCurrentPosition (vector pos, bool updateCached=true)
 Set the world position of the managed sound.
 
override vector GetCurrentPosition ()
 Get the current world position of the managed sound.
 
override void SetCurrentLocalPosition (vector pos, bool updateCached=true)
 Set the current local position of the managed sound.
 
override vector GetCurrentLocalPosition ()
 Get the current local position of the managed sound.
 
void SetSoundWaveKind (WaveKind wave_kind)
 Set WaveKind for the sound.
 
void SetSoundSet (string snd)
 Set soundset for the sound.
 
string GetSoundSet ()
 Get soundset for the sound.
 
void SetSoundLoop (bool loop)
 Set if the sound loops.
 
void SetEnviromentVariables (bool setEnvVariables)
 Sets whether AddEnvSoundVariables needs to be called during Loading.
 
float GetSoundWaveLenght ()
 Get the sound wave length.
 
float GetSoundWaveLength ()
 Get the sound wave length.
 
void SetSoundVolume (float volume)
 Set the RELATIVE volume for the sound.
 
float GetSoundVolume ()
 Get the RELATIVE volume set by 'SetSoundVolume'.
 
void SetSoundMaxVolume (float volume)
 Set the sound max volume.
 
float GetSoundWaveTime ()
 Get the time since EffectSound started playing.
 
void SetSoundFadeIn (float fade_in)
 Set the sound fade in duration.
 
void SetSoundFadeOut (float fade_out)
 Set the sound fade out duration.
 
void SetDoppler (bool setDoppler)
 Set if the sound has the doppler effect enabled.
 
void SoundError (string err_msg)
 Helper for throwing sound errors.
 

Protected Attributes

Sound objects and structures

Objects and structures for the sound

ref SoundParams m_SoundParams
 
ref SoundObjectBuilder m_SoundObjectBuilder
 
ref SoundObject m_SoundObject
 
AbstractWave m_SoundWaveObject
 
Generic data

Generic data for the sound

WaveKind m_SoundWaveKind
 
string m_SoundSetName
 
bool m_SoundLoop
 
bool m_SetEnvVariables
 
bool m_SoundAutodestroy
 
bool m_SoundWaveIsPlaying
 
float m_SoundWaveLenght
 
float m_SoundWaveVolume
 
float m_SoundWaveVolumeMax
 
float m_SoundWaveTime
 
int m_SoundDoppler
 

Fading data

Data for fadein/fadeout for the sound

bool m_SoundWaveStarting
 
bool m_SoundWaveStopping
 
bool m_SoundFadedOut
 
float m_SoundFadeInDuration
 
float m_SoundFadeOutStartTime
 
float m_SoundFadeOutDuration
 
float m_SoundFadeOutInitVolume
 
void EffectSound ()
 ctor
 
void ~EffectSound ()
 dtor
 
override void InitEffect ()
 init
 
override string GetDebugName ()
 Override when getting debug information.
 

Detailed Description

Wrapper class for managing sound through SEffectManager.

Definition at line 4 of file effectsound.c.

Constructor & Destructor Documentation

◆ EffectSound()

void EffectSound::EffectSound ( )
protected

ctor

Definition at line 63 of file effectsound.c.

◆ ~EffectSound()

void EffectSound::~EffectSound ( )
protected

dtor

Definition at line 77 of file effectsound.c.

Member Function Documentation

◆ CanDestroy()

override bool EffectSound::CanDestroy ( )
protected

Definition at line 636 of file effectsound.c.

◆ Event_OnFrameUpdate()

override void EffectSound::Event_OnFrameUpdate ( float time_delta)
protected

Event called on frame when enabled by SetEnableEventFrame(true)

Note
Is always enabled on sound
Called from SEffectManager.Event_OnFrameUpdate in MissionGameplay.OnUpdate
Parameters
time_deltafloat Time passed since the previous frame

Definition at line 460 of file effectsound.c.

◆ Event_OnRegistered()

override void EffectSound::Event_OnRegistered ( int id)
protected

Event called from SEffectManager when the Effect is registered.

Note
Should only ever be called by SEffectManager!
Parameters
idint ID registered in SEffectManager

Definition at line 527 of file effectsound.c.

◆ Event_OnSoundFadeInStopped()

void EffectSound::Event_OnSoundFadeInStopped ( )
protected

Event called when sound fade in stops.

Note
Called from Event_OnFrameUpdate

Definition at line 575 of file effectsound.c.

◆ Event_OnSoundFadeOutStarted()

void EffectSound::Event_OnSoundFadeOutStarted ( )
protected

Event called when sound fade out starts.

Note
Called from Event_OnFrameUpdate

Definition at line 584 of file effectsound.c.

◆ Event_OnSoundWaveEnded()

void EffectSound::Event_OnSoundWaveEnded ( )
protected

Event called when sound stops playing.

Note
Inserted into events of m_SoundWaveObject

Definition at line 562 of file effectsound.c.

◆ Event_OnSoundWaveStarted()

void EffectSound::Event_OnSoundWaveStarted ( )
protected

Event called when sound starts playing.

Note
Inserted into events of m_SoundWaveObject

Definition at line 549 of file effectsound.c.

◆ Event_OnUnregistered()

override void EffectSound::Event_OnUnregistered ( )
protected

Event called from SEffectManager when the Effect is unregistered.

Note
Should only ever be called by SEffectManager!

Definition at line 538 of file effectsound.c.

◆ GetCurrentLocalPosition()

override vector EffectSound::GetCurrentLocalPosition ( )
protected

Get the current local position of the managed sound.

Returns
vector The current local position of the managed sound

Definition at line 756 of file effectsound.c.

◆ GetCurrentParent()

override Object EffectSound::GetCurrentParent ( )
protected

Get parent for the EffectSound.

Note
There is no real parenting with sound, so the setters and getters for parents do the exact same
Returns
Object The parent for the EffectSound

Definition at line 694 of file effectsound.c.

◆ GetCurrentPosition()

override vector EffectSound::GetCurrentPosition ( )
protected

Get the current world position of the managed sound.

Returns
vector The current world position of the managed sound

Definition at line 726 of file effectsound.c.

◆ GetDebugName()

override string EffectSound::GetDebugName ( )
protected

Override when getting debug information.

Definition at line 97 of file effectsound.c.

◆ GetEffectType()

override EffectType EffectSound::GetEffectType ( )
protected

Get what type of effect the Effect is.

Returns
EffectType What type of effect the Effect is

Definition at line 123 of file effectsound.c.

◆ GetParent()

override Object EffectSound::GetParent ( )
protected

Get parent for the EffectSound.

Returns
Object The parent for the EffectSound

Definition at line 668 of file effectsound.c.

◆ GetPivotIndex()

override int EffectSound::GetPivotIndex ( )
protected

Get parent pivot of the Effect, only valid when there is some GetParent.

Warning
Only gets the cached variable
Returns
int The parent pivot of the Effect

Definition at line 681 of file effectsound.c.

◆ GetSoundSet()

string EffectSound::GetSoundSet ( )
protected

Get soundset for the sound.

Returns
string Name of the soundset

Definition at line 803 of file effectsound.c.

◆ GetSoundVolume()

float EffectSound::GetSoundVolume ( )
protected

Get the RELATIVE volume set by 'SetSoundVolume'.

Returns
float The relative volume for the sound set by 'SetSoundVolume'

Definition at line 863 of file effectsound.c.

◆ GetSoundWaveLenght()

float EffectSound::GetSoundWaveLenght ( )
protected

Get the sound wave length.

Note
Legacy, exists for backwards compatibility
Returns
float The sound wave length

Definition at line 834 of file effectsound.c.

◆ GetSoundWaveLength()

float EffectSound::GetSoundWaveLength ( )
protected

Get the sound wave length.

Returns
float The sound wave length

Definition at line 843 of file effectsound.c.

◆ GetSoundWaveTime()

float EffectSound::GetSoundWaveTime ( )
protected

Get the time since EffectSound started playing.

Warning
May not reflect the actual time of the sound, as it can start at negative time to simulate speed of sound
Returns
float The time since EffectSound started playing

Definition at line 886 of file effectsound.c.

◆ InitEffect()

override void EffectSound::InitEffect ( )
protected

init

Definition at line 85 of file effectsound.c.

◆ IsAutodestroy()

override bool EffectSound::IsAutodestroy ( )
protected

Get whether Effect automatically cleans up when it stops.

Returns
bool Whether Effect automatically cleans up when it stops

Definition at line 613 of file effectsound.c.

◆ IsPlaying()

override bool EffectSound::IsPlaying ( )
protected

Returns true when the effect is playing, false otherwise.

Definition at line 282 of file effectsound.c.

◆ IsSound()

override bool EffectSound::IsSound ( )
protected

Check whether the Effect is EffectSound without casting.

Returns
bool Whether the Effect is EffectSound

Definition at line 132 of file effectsound.c.

◆ IsSoundAutodestroy()

bool EffectSound::IsSoundAutodestroy ( )
protected

Get whether EffectSound automatically cleans up when sound stops.

Returns
bool Whether EffectSound automatically cleans up when sound stops

Definition at line 631 of file effectsound.c.

◆ IsSoundPlaying()

bool EffectSound::IsSoundPlaying ( )
protected

Get whether EffectSound is currently playing.

Returns
bool Whether EffectSound is currently playing

Definition at line 274 of file effectsound.c.

◆ IsSoundValid()

bool EffectSound::IsSoundValid ( )
protected

Helper for checking if params are valid.

Definition at line 356 of file effectsound.c.

◆ SetAutodestroy()

override void EffectSound::SetAutodestroy ( bool auto_destroy)
protected

Sets whether Effect automatically cleans up when it stops.

Note
This means that it will be unregistered from SEffectManager as well
Parameters
auto_destroybool Whether Effect automatically cleans up when it stops

Definition at line 603 of file effectsound.c.

◆ SetCurrentLocalPosition()

override void EffectSound::SetCurrentLocalPosition ( vector pos,
bool updateCached = true )
protected

Set the current local position of the managed sound.

Parameters
posvector The current local position for the managed sound
updateCachedbool Whether to update the cached variable

Definition at line 742 of file effectsound.c.

◆ SetCurrentPosition()

override void EffectSound::SetCurrentPosition ( vector pos,
bool updateCached = true )
protected

Set the world position of the managed sound.

Parameters
posvector The world position of the managed sound
updateCachedbool Whether to update the cached variable

Definition at line 707 of file effectsound.c.

◆ SetDoppler()

void EffectSound::SetDoppler ( bool setDoppler)
protected

Set if the sound has the doppler effect enabled.

Parameters
setDopplerfloat If the doppler effect is enabled

bool is a fancy int, ensure the bool is 0 or 1 and don't allow -1 here since resetting isn't supported

Definition at line 913 of file effectsound.c.

◆ SetEnviromentVariables()

void EffectSound::SetEnviromentVariables ( bool setEnvVariables)
protected

Sets whether AddEnvSoundVariables needs to be called during Loading.

Parameters
setEnvVariablesbool Whether AddEnvSoundVariables is called

Definition at line 824 of file effectsound.c.

◆ SetParent()

override void EffectSound::SetParent ( Object parent_obj,
int pivot )
protected

Set parent for the sound to follow.

Parameters
parent_objObject The parent for the sound to follow

Definition at line 654 of file effectsound.c.

◆ SetSoundAutodestroy()

void EffectSound::SetSoundAutodestroy ( bool auto_destroy)
protected

Sets whether EffectSound automatically cleans up when sound stops.

Parameters
auto_destroybool Whether EffectSound automatically cleans up when sound stops

Definition at line 622 of file effectsound.c.

◆ SetSoundFadeIn()

void EffectSound::SetSoundFadeIn ( float fade_in)
protected

Set the sound fade in duration.

Parameters
fade_infloat The fade in duration

Definition at line 895 of file effectsound.c.

◆ SetSoundFadeOut()

void EffectSound::SetSoundFadeOut ( float fade_out)
protected

Set the sound fade out duration.

Parameters
fade_outfloat The fade out duration

Definition at line 904 of file effectsound.c.

◆ SetSoundLoop()

void EffectSound::SetSoundLoop ( bool loop)
protected

Set if the sound loops.

Parameters
loopbool Whether the sound should loop

Definition at line 812 of file effectsound.c.

◆ SetSoundMaxVolume()

void EffectSound::SetSoundMaxVolume ( float volume)
protected

Set the sound max volume.

Warning
Seems to purely be used for fade in effect, rather than really setting the max volume...
Adjusts the current volume to this value as well
Parameters
volumefloat The maximum volume for the sound

Definition at line 874 of file effectsound.c.

◆ SetSoundSet()

void EffectSound::SetSoundSet ( string snd)
protected

Set soundset for the sound.

Note
Needs to be set before playing
Parameters
sndstring Name of the soundset to play

Definition at line 794 of file effectsound.c.

◆ SetSoundVolume()

void EffectSound::SetSoundVolume ( float volume)
protected

Set the RELATIVE volume for the sound.

Parameters
volumefloat The relative volume for the sound

Definition at line 852 of file effectsound.c.

◆ SetSoundWaveKind()

void EffectSound::SetSoundWaveKind ( WaveKind wave_kind)
protected

Set WaveKind for the sound.

Note
Needs to be set before playing
Parameters
wave_kindWaveKind The WaveKind for the sound

Definition at line 784 of file effectsound.c.

◆ SoundError()

void EffectSound::SoundError ( string err_msg)
protected

Helper for throwing sound errors.

Definition at line 930 of file effectsound.c.

◆ SoundLoad()

bool EffectSound::SoundLoad ( )
protected

Loads in the sound when it is requested for playing.

Note
Legacy, backwards compatibility

Definition at line 347 of file effectsound.c.

◆ SoundLoadEx()

bool EffectSound::SoundLoadEx ( out SoundParams params)
protected

Loads in the sound when it is requested for playing through 'SoundPlayEx'.

Parameters
paramsSoundParams Possibility of passing in an already existing SoundParams, else one will get created

Definition at line 300 of file effectsound.c.

◆ SoundPlay()

bool EffectSound::SoundPlay ( )
protected

Plays sound.

Returns
bool Whether the sound will start playing

Definition at line 199 of file effectsound.c.

◆ SoundPlayEx()

bool EffectSound::SoundPlayEx ( out SoundParams params)
protected

Plays sound.

Parameters
paramsSoundParams Sound Parameters for the sound
Returns
bool Whether the sound will start playing

Definition at line 152 of file effectsound.c.

◆ SoundReset()

void EffectSound::SoundReset ( )
protected

Resets EffectSound.

Definition at line 252 of file effectsound.c.

◆ SoundStop()

void EffectSound::SoundStop ( )
protected

Stops sound.

Note
Will not be immediately if a SoundFadeOutDuration was set

Definition at line 217 of file effectsound.c.

◆ SoundWaveValidation()

bool EffectSound::SoundWaveValidation ( )
protected

Validation of fade settings.

Note
Called from 'ValidateSoundWave'

Definition at line 403 of file effectsound.c.

◆ Start()

override void EffectSound::Start ( )
protected

Plays sound.

Definition at line 208 of file effectsound.c.

◆ Stop()

override void EffectSound::Stop ( )
protected

Stops sound.

Definition at line 244 of file effectsound.c.

◆ UpdateEvents()

void EffectSound::UpdateEvents ( )
protected

Enables the frame event on the EffectSound.

Note
Called from 'ValidateSoundWave' when all is successful
So this is effectively enabling frame event on all valid EffectSound

Definition at line 433 of file effectsound.c.

◆ ValidateSoundWave()

void EffectSound::ValidateSoundWave ( )
protected

Gets called to fill in the necessary data when the header has finished loading.

Note
Called from 'SoundPlayEx'

Definition at line 365 of file effectsound.c.

Member Data Documentation

◆ m_SetEnvVariables

bool EffectSound::m_SetEnvVariables
protected

Definition at line 33 of file effectsound.c.

◆ m_SoundAutodestroy

bool EffectSound::m_SoundAutodestroy
protected

Definition at line 34 of file effectsound.c.

◆ m_SoundDoppler

int EffectSound::m_SoundDoppler
protected

Definition at line 40 of file effectsound.c.

◆ m_SoundFadedOut

bool EffectSound::m_SoundFadedOut
protected

Definition at line 49 of file effectsound.c.

◆ m_SoundFadeInDuration

float EffectSound::m_SoundFadeInDuration
protected

Definition at line 51 of file effectsound.c.

◆ m_SoundFadeOutDuration

float EffectSound::m_SoundFadeOutDuration
protected

Definition at line 54 of file effectsound.c.

◆ m_SoundFadeOutInitVolume

float EffectSound::m_SoundFadeOutInitVolume
protected

Definition at line 55 of file effectsound.c.

◆ m_SoundFadeOutStartTime

float EffectSound::m_SoundFadeOutStartTime
protected

Definition at line 53 of file effectsound.c.

◆ m_SoundLoop

bool EffectSound::m_SoundLoop
protected

Definition at line 32 of file effectsound.c.

◆ m_SoundObject

ref SoundObject EffectSound::m_SoundObject
protected

Definition at line 22 of file effectsound.c.

◆ m_SoundObjectBuilder

ref SoundObjectBuilder EffectSound::m_SoundObjectBuilder
protected

Definition at line 21 of file effectsound.c.

◆ m_SoundParams

ref SoundParams EffectSound::m_SoundParams
protected

Definition at line 20 of file effectsound.c.

◆ m_SoundSetName

string EffectSound::m_SoundSetName
protected

Definition at line 31 of file effectsound.c.

◆ m_SoundWaveIsPlaying

bool EffectSound::m_SoundWaveIsPlaying
protected

Definition at line 35 of file effectsound.c.

◆ m_SoundWaveKind

WaveKind EffectSound::m_SoundWaveKind
protected

Definition at line 30 of file effectsound.c.

◆ m_SoundWaveLenght

float EffectSound::m_SoundWaveLenght
protected

Definition at line 36 of file effectsound.c.

◆ m_SoundWaveObject

AbstractWave EffectSound::m_SoundWaveObject
protected

Definition at line 23 of file effectsound.c.

◆ m_SoundWaveStarting

bool EffectSound::m_SoundWaveStarting
protected

Definition at line 47 of file effectsound.c.

◆ m_SoundWaveStopping

bool EffectSound::m_SoundWaveStopping
protected

Definition at line 48 of file effectsound.c.

◆ m_SoundWaveTime

float EffectSound::m_SoundWaveTime
protected

Definition at line 39 of file effectsound.c.

◆ m_SoundWaveVolume

float EffectSound::m_SoundWaveVolume
protected

Definition at line 37 of file effectsound.c.

◆ m_SoundWaveVolumeMax

float EffectSound::m_SoundWaveVolumeMax
protected

Definition at line 38 of file effectsound.c.


The documentation for this class was generated from the following file: