Animation class for fading the volume of a GraphSoundObject. More...

#include "murl_logic_sound_fader.h"

Inheritance diagram for Murl::Logic::SoundFader:

Public Member Functions

 SoundFader ()
 The default constructor. More...
 
 SoundFader (GraphSoundObjectPtr soundObject)
 The constructor taking a GraphSoundObject shared pointer. More...
 
 ~SoundFader () override
 The destructor.
 
virtual Bool Init (INodeObserver *nodeObserver, const Graph::IRoot *root, const String &timelinePath, const String &sequencePath, SInt32 index)
 Initialize the object. More...
 
virtual Bool Init (INodeObserver *nodeObserver, Graph::INamespace *namespaceNode, const String &timelinePath, const String &sequencePath, SInt32 index)
 Initialize the object. More...
 
virtual Bool DeInit ()
 Deinitialize the object. More...
 
virtual void FadeIn (Bool resume=false)
 Start and fade in the sound. More...
 
virtual void FadeOut (Bool pause=false)
 Fade out the sound. More...
 
virtual Bool SetDuration (Real duration)
 Set the fading duration. More...
 
virtual Real GetDuration () const
 Get the fading duration. More...
 
virtual Bool SetStartVolume (Real volume)
 Set the start volume. More...
 
virtual Bool SetEndVolume (Real volume)
 Set the end volume. More...
 
virtual Bool SetVolume (Real startVolume, Real endVolume)
 Set the start and end volume. More...
 
virtual Real GetStartVolume () const
 Get the start volume. More...
 
virtual Real GetEndVolume () const
 Get the end volume. More...
 
void Reset () override
 Overwrite of the Animation::Reset() method. More...
 
- Public Member Functions inherited from Murl::Logic::Animation< DataType >
KeyAddKey (const Key &key)
 Add a key to the animation key array. More...
 
KeyAddKey (Real time, const DataType &value)
 Add a key to the animation key array with linear interpolation. More...
 
KeyAddKey (Real time, const DataType &value, IEnums::Interpolation interpolation)
 Add a key to the animation key array. More...
 
KeySetKey (SInt32 index, const Key &key)
 Set a key in the animation key array. More...
 
KeySetKey (SInt32 index, Real time, const DataType &value)
 Set a key in the animation key array with linear interpolation. More...
 
KeySetKey (SInt32 index, Real time, const DataType &value, IEnums::Interpolation interpolation)
 Set a key in the animation key array. More...
 
KeyInsertKey (SInt32 index, const Key &key)
 Insert a key to the animation key array. More...
 
KeyInsertKey (SInt32 index, Real time, const DataType &value)
 Insert a key to the animation key array with linear interpolation. More...
 
KeyInsertKey (SInt32 index, Real time, const DataType &value, IEnums::Interpolation interpolation)
 Insert a key to the animation key array. More...
 
SInt32 GetNumberOfKeys () const
 Get the number of keys. More...
 
const KeyGetKey (SInt32 index) const
 Get a key from the animation key array. More...
 
KeyGetKey (SInt32 index)
 Get a key from the animation key array. More...
 
Bool ModifyKeyTime (SInt32 index, Real time)
 Modify the time of a key in the animation key array. More...
 
Bool ModifyKeyValue (SInt32 index, const DataType &value)
 Modify the value of a key in the animation key array. More...
 
Bool ModifyKeyInterpoation (SInt32 index, IEnums::Interpolation interpolation)
 Modify the interpolation of a key in the animation key array. More...
 
Bool SetNumberOfKeys (SInt32 n)
 Set the number of keys. More...
 
Bool RemoveKey (SInt32 index, SInt32 count=1)
 Remove keys at a given position. More...
 
void EmptyKeys ()
 Empty the keys, but keep the underlying storage.
 
void ClearKeys ()
 Clear the keys and remove the underlying storage.
 
void SetIntermediateKeys (Real midTime, const DataType &midValue, Real endTime, const DataType &endValue, IEnums::Interpolation interpolation)
 Set keys for an intermediate time and value. More...
 
 Animation ()
 The default constructor.
 
 ~Animation () override
 The destructor.
 
 operator IStepablePtr ()
 Conversion operator. More...
 
virtual void OnEvaluateAnimation (const DataType &currentValue)
 Called if the current value is set. More...
 
virtual const DataType & GetCurrentValue () const
 Get the current value. More...
 
virtual Bool StartForward ()
 Start the timeline forward. More...
 
virtual Bool StartBackward ()
 Start the timeline backward. More...
 
virtual Bool SetStartTimeFromKey (SInt32 index)
 Set the timeline start time from a specified key index. More...
 
virtual Bool SetEndTimeFromKey (SInt32 index)
 Set the timeline end time from a specified key index. More...
 
virtual Bool SetLoopStartTimeFromKey (SInt32 index)
 Set the timeline loop start time from a specified key index. More...
 
virtual Bool SetLoopEndTimeFromKey (SInt32 index)
 Set the timeline loop end time from a specified key index. More...
 
virtual Bool HasPassedTimeFromKey (SInt32 index) const
 Check if the current time has passed the time from a specified key index. More...
 
virtual Bool IsOnTimeFromKey (SInt32 index) const
 Check if the current time is the time from a specified key index. More...
 
- Public Member Functions inherited from Murl::Logic::Timeline
 ~Timeline () override
 The destructor.
 
void ProcessTick (const Logic::IState *state) override
 Implementation of IStepable::ProcessTick() method. More...
 
IStepablePtr GetStepable () override
 Implementation of ITimeline::GetStepable() method. More...
 
Bool SetAppTimeline (IAppTimelinePtr appTimeline) override
 Implementation of ITimeline::SetAppTimeline() method. More...
 
void Evaluate () override
 Implementation of ITimeline::Evaluate() method.
 
void Reset () override
 Implementation of ITimeline::Reset() and IStepable::Reset() method.
 
void ResetTo (Real startTime) override
 Implementation of ITimeline::ResetTo() method. More...
 
Bool Start () override
 Implementation of ITimeline::Start() method. More...
 
Bool Start (Real startTime, Real endTime) override
 Implementation of ITimeline::Start(Real startTime, Real endTime) method. More...
 
Bool Start (Real startTime, Real endTime, SInt32 numberOfLoops) override
 Implementation of ITimeline::Start(Real startTime, Real endTime, SInt32 numberOfLoops) method. More...
 
Bool Start (Real startTime, Real endTime, Real loopStartTime, Real loopEndTime, SInt32 numberOfLoops) override
 Implementation of ITimeline::Start(Real startTime, Real endTime, Real loopStartTime, Real loopEndTime, SInt32 numberOfLoops) method. More...
 
Bool Pause () override
 Implementation of ITimeline::Pause() method. More...
 
Bool Stop () override
 Implementation of ITimeline::Stop() method. More...
 
Bool Rewind () override
 Implementation of ITimeline::Rewind() method. More...
 
void SetStartTime (Real startTime) override
 Implementation of ITimeline::SetStartTime() method. More...
 
Real GetStartTime () const override
 Implementation of ITimeline::GetStartTime() method. More...
 
void SetEndTime (Real endTime) override
 Implementation of ITimeline::SetEndTime() method. More...
 
Real GetEndTime () const override
 Implementation of ITimeline::GetEndTime() method. More...
 
void SetLoopStartTime (Real startTime) override
 Implementation of ITimeline::SetLoopStartTime() method. More...
 
Real GetLoopStartTime () const override
 Implementation of ITimeline::GetLoopStartTime() method. More...
 
void SetLoopEndTime (Real endTime) override
 Implementation of ITimeline::SetLoopEndTime() method. More...
 
Real GetLoopEndTime () const override
 Implementation of ITimeline::GetLoopEndTime() method. More...
 
void SetNumberOfLoops (SInt32 numberOfLoops) override
 Implementation of ITimeline::SetNumberOfLoops() method. More...
 
SInt32 GetNumberOfLoops () const override
 Implementation of ITimeline::GetNumberOfLoops() method. More...
 
void SetTimeScale (Real timeScale) override
 Implementation of ITimeline::SetTimeScale() method. More...
 
Real GetTimeScale () const override
 Implementation of ITimeline::GetTimeScale() method. More...
 
void SetAutoRewindEnabled (Bool enabled) override
 Implementation of ITimeline::SetAutoRewindEnabled() method. More...
 
Bool IsAutoRewindEnabled () const override
 Implementation of ITimeline::IsAutoRewindEnabled() method. More...
 
Bool IsRunning () const override
 Implementation of ITimeline::IsRunning() method. More...
 
Bool IsPaused () const override
 Implementation of ITimeline::IsPaused() method. More...
 
Bool IsStopped () const override
 Implementation of ITimeline::IsStopped() method. More...
 
Bool WasStarted () const override
 Implementation of ITimeline::WasStarted() method. More...
 
Bool WasRunning () const override
 Implementation of ITimeline::WasRunning() method. More...
 
Bool IsOrWasRunning () const override
 Implementation of ITimeline::IsOrWasRunning() method. More...
 
Bool HasPassedTime (Real time) const override
 Implementation of ITimeline::HasPassedTime() method. More...
 
Bool HasPassedLoop (SInt32 loop) const override
 Implementation of ITimeline::HasPassedLoop() method. More...
 
Double GetCurrentTime () const override
 Implementation of ITimeline::GetCurrentTime() method. More...
 
Double GetRemainingTime () const override
 Implementation of ITimeline::GetRemainingTime() method. More...
 
void SetCurrentTime (Double time) override
 Implementation of ITimeline::SetCurrentTime() method. More...
 
SInt32 GetCurrentLoop () const override
 Implementation of ITimeline::GetCurrentLoop() method. More...
 
SInt32 GetRemainingLoops () const override
 Implementation of ITimeline::GetRemainingLoops() method. More...
 
Bool SetCurrentLoop (SInt32 loop) override
 Implementation of ITimeline::SetCurrentLoop() method. More...
 
IEnums::AnimationState GetCurrentState () const override
 Implementation of ITimeline::GetCurrentState() method. More...
 
- Public Member Functions inherited from Murl::Logic::Stepable
 ~Stepable () override
 The destructor.
 
Bool SetAppStepable (IAppStepablePtr appStepable) override
 Implementation of IStepable::SetAppStepable() method. More...
 
void SetEnabled (Bool isEnabled) override
 Implementation of IStepable::SetEnabled() method. More...
 
Bool IsEnabled () const override
 Implementation of IStepable::IsEnabled() method. More...
 
void FinishTick (const Logic::IState *state) override
 Implementation of IStepable::FinishTick() method. More...
 

Static Public Member Functions

static SoundFaderPtr Create ()
 Create a SoundFader object. More...
 
static SoundFaderPtr Create (GraphSoundObjectPtr soundObject)
 Create a SoundFader object taking a GraphSoundObject. More...
 
- Static Public Member Functions inherited from Murl::Logic::Animation< DataType >
static Ptr Create ()
 Create an Animation object. More...
 
- Static Public Member Functions inherited from Murl::Logic::Timeline
static ITimelinePtr Create ()
 Create a timeline object. More...
 
- Static Public Member Functions inherited from Murl::Logic::Stepable
static IStepablePtr Create ()
 Create a stepable object. More...
 

Public Attributes

GraphSoundObjectPtr mSound
 The GraphSoundObject shared pointer.
 
- Public Attributes inherited from Murl::Logic::Animation< DataType >
Array< KeymKeys
 The animation keys array.
 

Protected Member Functions

void OnEvaluateAnimation (const Real &currentValue) override
 Overwrite of the Animation::OnEvaluateAnimation() method. More...
 
- Protected Member Functions inherited from Murl::Logic::Animation< DataType >
void OnEvaluate (Double currentTime) override
 Overwrite of the IAppTimeline::OnEvaluate() method. More...
 

Protected Attributes

Bool mPause
 The pause on stop state.
 

Additional Inherited Members

- Public Types inherited from Murl::Logic::Animation< DataType >
using ValueType = DataType
 The template parameter value type.
 
using Key = AnimationKey< DataType >
 Type definition of the animation key data type.
 
using Ptr = SharedPointer< Animation >
 The Animation shared pointer type.
 

Detailed Description

Animation class for fading the volume of a GraphSoundObject.

Constructor & Destructor Documentation

◆ SoundFader() [1/2]

Murl::Logic::SoundFader::SoundFader ( )
inline

The default constructor.

Allocates a new GraphSoundObject.

References Murl::Logic::Animation< DataType >::AddKey(), and Murl::IEnums::INTERPOLATION_EASE_IN_OUT.

Referenced by Create().

◆ SoundFader() [2/2]

Murl::Logic::SoundFader::SoundFader ( GraphSoundObjectPtr  soundObject)
inline

The constructor taking a GraphSoundObject shared pointer.

Use Logic::GraphSoundObject::Create() to create the shared pointer.

Parameters
soundObjectThe GraphSoundObject shared pointer.

References Murl::Logic::Animation< DataType >::AddKey(), and Murl::IEnums::INTERPOLATION_EASE_IN_OUT.

Member Function Documentation

◆ Create() [1/2]

static SoundFaderPtr Murl::Logic::SoundFader::Create ( )
inlinestatic

Create a SoundFader object.

Returns
The SoundFader shared pointer.

References SoundFader().

◆ Create() [2/2]

static SoundFaderPtr Murl::Logic::SoundFader::Create ( GraphSoundObjectPtr  soundObject)
inlinestatic

Create a SoundFader object taking a GraphSoundObject.

Use Logic::GraphSoundObject::Create() to create the shared pointer.

Parameters
soundObjectThe GraphSoundObject shared pointer.
Returns
The SoundFader shared pointer.

References SoundFader().

◆ Init() [1/2]

virtual Bool Murl::Logic::SoundFader::Init ( INodeObserver nodeObserver,
const Graph::IRoot root,
const String timelinePath,
const String sequencePath,
SInt32  index 
)
inlinevirtual

Initialize the object.

Parameters
nodeObserverThe INodeObserver object.
rootThe graph root node.
timelinePathThe full path to the graph timeline node instance.
sequencePathThe full path to the graph audio sequence node instance.
indexThe index of the instance.
Returns
true if successful.

References mSound.

◆ Init() [2/2]

virtual Bool Murl::Logic::SoundFader::Init ( INodeObserver nodeObserver,
Graph::INamespace namespaceNode,
const String timelinePath,
const String sequencePath,
SInt32  index 
)
inlinevirtual

Initialize the object.

Parameters
nodeObserverThe INodeObserver object.
namespaceNodeThe logic namespace node.
timelinePathThe full path to the graph timeline node instance.
sequencePathThe full path to the graph audio sequence node instance.
indexThe index of the instance.
Returns
true if successful.

References mSound.

◆ DeInit()

virtual Bool Murl::Logic::SoundFader::DeInit ( )
inlinevirtual

Deinitialize the object.

Returns
true if successful.

References mSound.

◆ FadeIn()

virtual void Murl::Logic::SoundFader::FadeIn ( Bool  resume = false)
inlinevirtual

Start and fade in the sound.

Parameters
resumeIf true resume playing the sound, otherwise restart the sound.

References mSound, and Murl::Logic::Animation< DataType >::StartForward().

◆ FadeOut()

virtual void Murl::Logic::SoundFader::FadeOut ( Bool  pause = false)
inlinevirtual

Fade out the sound.

Parameters
pauseIf true pause the sound after fade out, otherwise stop the sound.

References mPause, and Murl::Logic::Animation< DataType >::StartBackward().

◆ SetDuration()

virtual Bool Murl::Logic::SoundFader::SetDuration ( Real  duration)
inlinevirtual

Set the fading duration.

Parameters
durationThe fading duration in seconds.
Returns
true if successful.

References Murl::Logic::Animation< DataType >::mKeys.

◆ GetDuration()

virtual Real Murl::Logic::SoundFader::GetDuration ( ) const
inlinevirtual

Get the fading duration.

Returns
The fading duration in seconds.

References Murl::Logic::Animation< DataType >::mKeys.

◆ SetStartVolume()

virtual Bool Murl::Logic::SoundFader::SetStartVolume ( Real  volume)
inlinevirtual

Set the start volume.

Parameters
volumeThe volume in range [0.0 .. 1.0].
Returns
true if successful.

References Murl::Logic::Animation< DataType >::mKeys.

◆ SetEndVolume()

virtual Bool Murl::Logic::SoundFader::SetEndVolume ( Real  volume)
inlinevirtual

Set the end volume.

Parameters
volumeThe volume in range [0.0 .. 1.0].
Returns
true if successful.

References Murl::Logic::Animation< DataType >::mKeys.

◆ SetVolume()

virtual Bool Murl::Logic::SoundFader::SetVolume ( Real  startVolume,
Real  endVolume 
)
inlinevirtual

Set the start and end volume.

Parameters
startVolumeThe start volume in range [0.0 .. 1.0].
endVolumeThe end volume in range [0.0 .. 1.0].
Returns
true if successful.

References Murl::Logic::Animation< DataType >::mKeys.

◆ GetStartVolume()

virtual Real Murl::Logic::SoundFader::GetStartVolume ( ) const
inlinevirtual

Get the start volume.

Returns
The start volume.

References Murl::Logic::Animation< DataType >::mKeys.

◆ GetEndVolume()

virtual Real Murl::Logic::SoundFader::GetEndVolume ( ) const
inlinevirtual

Get the end volume.

Returns
The end volume.

References Murl::Logic::Animation< DataType >::mKeys.

◆ Reset()

void Murl::Logic::SoundFader::Reset ( )
inlineoverridevirtual

Overwrite of the Animation::Reset() method.

Reset the animation and stop playing.

Reimplemented from Murl::Logic::Animation< DataType >.

References mSound, and Murl::Logic::Animation< DataType >::Reset().

◆ OnEvaluateAnimation()

void Murl::Logic::SoundFader::OnEvaluateAnimation ( const Real currentValue)
inlineoverrideprotected

Overwrite of the Animation::OnEvaluateAnimation() method.

Set the volume to the current value and stop playing if fade out was finished.

Parameters
currentValueThe current value.

References Murl::Logic::Timeline::GetCurrentTime(), Murl::Logic::Animation< DataType >::mKeys, mPause, mSound, and Murl::Logic::Timeline::WasRunning().


The documentation for this class was generated from the following file:
  • murl_logic_sound_fader.h


Copyright © 2011-2024 Spraylight GmbH.