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...
 
virtual ~SoundFader ()
 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...
 
- 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.
 
virtual ~Animation ()
 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
virtual ~Timeline ()
 The destructor.
 
virtual void ProcessTick (const Logic::IState *state)
 Implementation of IStepable::ProcessTick() method.
 
virtual IStepablePtr GetStepable ()
 Implementation of ITimeline::GetStepable() method.
 
virtual Bool SetAppTimeline (IAppTimelinePtr appTimeline)
 Implementation of ITimeline::SetAppTimeline() method.
 
virtual void Evaluate ()
 Implementation of ITimeline::Evaluate() method.
 
virtual void Reset ()
 Implementation of ITimeline::Reset() and IStepable::Reset() method.
 
virtual void ResetTo (Real startTime)
 Implementation of ITimeline::ResetTo() method.
 
virtual Bool Start ()
 Implementation of ITimeline::Start() method.
 
virtual Bool Start (Real startTime, Real endTime)
 Implementation of ITimeline::Start(Real startTime, Real endTime) method.
 
virtual Bool Start (Real startTime, Real endTime, SInt32 numberOfLoops)
 Implementation of ITimeline::Start(Real startTime, Real endTime, SInt32 numberOfLoops) method.
 
virtual Bool Start (Real startTime, Real endTime, Real loopStartTime, Real loopEndTime, SInt32 numberOfLoops)
 Implementation of ITimeline::Start(Real startTime, Real endTime, Real loopStartTime, Real loopEndTime, SInt32 numberOfLoops) method.
 
virtual Bool Pause ()
 Implementation of ITimeline::Pause() method.
 
virtual Bool Stop ()
 Implementation of ITimeline::Stop() method.
 
virtual Bool Rewind ()
 Implementation of ITimeline::Rewind() method.
 
virtual void SetStartTime (Real startTime)
 Implementation of ITimeline::SetStartTime() method.
 
virtual Real GetStartTime () const
 Implementation of ITimeline::GetStartTime() method.
 
virtual void SetEndTime (Real endTime)
 Implementation of ITimeline::SetEndTime() method.
 
virtual Real GetEndTime () const
 Implementation of ITimeline::GetEndTime() method.
 
virtual void SetLoopStartTime (Real startTime)
 Implementation of ITimeline::SetLoopStartTime() method.
 
virtual Real GetLoopStartTime () const
 Implementation of ITimeline::GetLoopStartTime() method.
 
virtual void SetLoopEndTime (Real endTime)
 Implementation of ITimeline::SetLoopEndTime() method.
 
virtual Real GetLoopEndTime () const
 Implementation of ITimeline::GetLoopEndTime() method.
 
virtual void SetNumberOfLoops (SInt32 numberOfLoops)
 Implementation of ITimeline::SetNumberOfLoops() method.
 
virtual SInt32 GetNumberOfLoops () const
 Implementation of ITimeline::GetNumberOfLoops() method.
 
virtual void SetTimeScale (Real timeScale)
 Implementation of ITimeline::SetTimeScale() method.
 
virtual Real GetTimeScale () const
 Implementation of ITimeline::GetTimeScale() method.
 
virtual void SetAutoRewindEnabled (Bool enable)
 Implementation of ITimeline::SetAutoRewindEnabled() method.
 
virtual Bool IsAutoRewindEnabled () const
 Implementation of ITimeline::IsAutoRewindEnabled() method.
 
virtual Bool IsRunning () const
 Implementation of ITimeline::IsRunning() method.
 
virtual Bool IsPaused () const
 Implementation of ITimeline::IsPaused() method.
 
virtual Bool IsStopped () const
 Implementation of ITimeline::IsStopped() method.
 
virtual Bool WasStarted () const
 Implementation of ITimeline::WasStarted() method.
 
virtual Bool WasRunning () const
 Implementation of ITimeline::WasRunning() method.
 
virtual Bool IsOrWasRunning () const
 Implementation of ITimeline::IsOrWasRunning() method.
 
virtual Bool HasPassedTime (Real time) const
 Implementation of ITimeline::HasPassedTime() method.
 
virtual Bool HasPassedLoop (SInt32 loop) const
 Implementation of ITimeline::HasPassedLoop() method.
 
virtual Double GetCurrentTime () const
 Implementation of ITimeline::GetCurrentTime() method.
 
virtual Double GetRemainingTime () const
 Implementation of ITimeline::GetRemainingTime() method.
 
virtual void SetCurrentTime (Double time)
 Implementation of ITimeline::SetCurrentTime() method.
 
virtual SInt32 GetCurrentLoop () const
 Implementation of ITimeline::GetCurrentLoop() method.
 
virtual SInt32 GetRemainingLoops () const
 Implementation of ITimeline::GetRemainingLoops() method.
 
virtual Bool SetCurrentLoop (SInt32 loop)
 Implementation of ITimeline::SetCurrentLoop() method.
 
virtual IEnums::AnimationState GetCurrentState () const
 Implementation of ITimeline::GetCurrentState() method.
 
- Public Member Functions inherited from Murl::Logic::Stepable
virtual ~Stepable ()
 The destructor.
 
virtual Bool SetAppStepable (IAppStepablePtr appStepable)
 Implementation of IStepable::SetAppStepable() method.
 
virtual void SetEnabled (Bool isEnabled)
 Implementation of IStepable::SetEnabled() method.
 
virtual Bool IsEnabled () const
 Implementation of IStepable::IsEnabled() method.
 
virtual void FinishTick (const Logic::IState *state)
 Implementation of IStepable::FinishTick() method.
 

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. More...
 
- Public Attributes inherited from Murl::Logic::Animation< DataType >
Array< KeymKeys
 The animation keys array. More...
 

Protected Member Functions

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

Protected Attributes

Bool mPause
 The pause on stop state. More...
 

Additional Inherited Members

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

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.

◆ OnReset()

virtual void Murl::Logic::SoundFader::OnReset ( )
inlineprotectedvirtual

Overwrite of the Animation::OnReset() method.

Reset the animation and stop playing.

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

References Murl::Logic::Animation< DataType >::OnReset().

◆ OnEvaluateAnimation()

virtual void Murl::Logic::SoundFader::OnEvaluateAnimation ( const Real currentValue)
inlineprotectedvirtual

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, and Murl::Logic::Timeline::WasRunning().

Member Data Documentation

◆ mSound

GraphSoundObjectPtr Murl::Logic::SoundFader::mSound

The GraphSoundObject shared pointer.

Referenced by DeInit(), FadeIn(), and Init().

◆ mPause

Bool Murl::Logic::SoundFader::mPause
protected

The pause on stop state.

Referenced by FadeOut(), and OnEvaluateAnimation().


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


Copyright © 2011-2018 Spraylight GmbH.