Class controlling a sound sub tree for GraphInstanceObjects usage. More...

#include "murl_logic_graph_sound_instance.h"

Inheritance diagram for Murl::Logic::GraphSoundInstance:

Public Member Functions

 GraphSoundInstance (Real masterVolume=Real(1.0))
 The default constructor. More...
 
virtual ~GraphSoundInstance ()
 The destructor.
 
virtual Bool Init (INodeObserver *nodeObserver, const Graph::IRoot *root, const String &replicationIdPath, SInt32 index)
 Initialize the object. More...
 
virtual Bool Init (INodeObserver *nodeObserver, Graph::INode *replicationNode, SInt32 index)
 Initialize the object. More...
 
virtual Bool DeInit ()
 Deinitialize the object. More...
 
virtual void SetObtained (Bool isObtained)
 Set the obtained state. More...
 
- Public Member Functions inherited from Murl::Logic::BaseStepable
 BaseStepable ()
 The default constructor. More...
 
virtual ~BaseStepable ()
 The destructor. More...
 
 operator IStepablePtr ()
 Conversion operator. More...
 
- 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 Reset ()
 Implementation of IStepable::Reset() method.
 
virtual void ProcessTick (const Logic::IState *state)
 Implementation of IStepable::ProcessTick() method.
 
virtual void FinishTick (const Logic::IState *state)
 Implementation of IStepable::FinishTick() method.
 
- Public Member Functions inherited from Murl::Logic::GraphSoundObject
 GraphSoundObject ()
 The default constructor. More...
 
 GraphSoundObject (Real masterVolume)
 Constructor taking a master volume. More...
 
virtual ~GraphSoundObject ()
 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 StartPlaying (Real startTime=0)
 Start playing the sound. More...
 
virtual Bool StartPlaying (Real startTime, Real endTime)
 Start playing the sound. More...
 
virtual Bool IsPlaying () const
 Check if the sound is playing. More...
 
virtual Bool PausePlaying ()
 Pause playing the sound. More...
 
virtual Bool ContinuePlaying ()
 Continue playing the sound. More...
 
virtual Bool StopPlaying ()
 Stop playing the sound. More...
 
virtual void SetVolume (Real volume)
 Set the sound volume. More...
 
virtual void SetMasterVolume (Real volume)
 Set the master volume. More...
 
virtual Real GetMasterVolume () const
 Get the master volume. More...
 

Protected Member Functions

virtual void OnReset ()
 Overwrite of the BaseStepable::OnReset() method. More...
 
- Protected Member Functions inherited from Murl::Logic::BaseStepable
virtual void OnSetEnabled (Bool isEnabled)
 Default implementation of IAppStepable::OnSetEnabled() method, this method is empty and can be overwritten.
 
virtual void OnProcessTick (const Logic::IState *state)
 Default implementation of IAppStepable::OnProcessTick() method, this method is empty and can be overwritten.
 
virtual void OnFinishTick (const Logic::IState *state)
 Default implementation of IAppStepable::OnFinishTick() method, this method is empty and can be overwritten.
 

Additional Inherited Members

- Static Public Member Functions inherited from Murl::Logic::Stepable
static IStepablePtr Create ()
 Create a stepable object. More...
 
- Static Public Member Functions inherited from Murl::Logic::GraphSoundObject
static GraphSoundObjectPtr Create ()
 Create a GraphSoundObject object. More...
 
static GraphSoundObjectPtr Create (Real masterVolume)
 Create a GraphSoundObject object with a given master volume. More...
 
- Public Attributes inherited from Murl::Logic::GraphSoundObject
TimelineNode mTimelineNode
 The timeline node reference. More...
 
AudioSequenceNode mAudioSequenceNode
 The audio sequence node reference. More...
 

Detailed Description

Class controlling a sound sub tree for GraphInstanceObjects usage.

MyLogic.h

#include "murl_logic_graph_instance_objects.h"
#include "murl_logic_graph_sound_instance.h"
...
Logic::GraphInstanceObjects<Logic::GraphSoundInstance> mMyInstances;

MyLogic.cpp

Bool App::MyLogic::OnInit(const Logic::IState* state)
{
const Graph::IRoot* root = state->GetGraphRoot();
if (!mMyInstances.Init(root, "/MY_LOCATION", "/MY_INSTANCE_NODE", "/MY_INSTANCE"))
{
return false;
}
// other stuff
return true;
}
Bool App::MyLogic::OnDeInit(const Logic::IState* state)
{
Bool ret = true;
// other stuff
if (!mMyInstances.DeInit())
{
ret = false;
}
return ret;
}

MyGraph.xml

<Namespace id="MY_LOCATION">
<Instance id="MY_INSTANCE_NODE" graphResourceId="MyInstanceXml" replications="10"
</Namespace>

MyInstance.xml

<Graph>
<Namespace id="MY_INSTANCE{replication}" activeAndVisible="no">
<Timeline id="timeline">
<AudioSequence id="sequence"/>
</Timeline>
</Namespace>
</Graph>


Alternatively a replication with anonymous namespace can be accessed as follows.

Bool App::MyLogic::OnInit(const Logic::IState* state)
{
if (!mMyInstances.Init(root->GetRootNamespace(), "/MY_LOCATION/MY_INSTANCE_NODE"))
{
return false;
}
// other stuff
return true;
}

MyInstance.xml

<Graph>
<Namespace activeAndVisible="no">
<Timeline id="timeline">
<AudioSequence id="sequence"/>
</Timeline>
</Namespace>
</Graph>

Constructor & Destructor Documentation

◆ GraphSoundInstance()

Murl::Logic::GraphSoundInstance::GraphSoundInstance ( Real  masterVolume = Real(1.0))
inline

The default constructor.

Parameters
masterVolumeThe master volume in range [0.0 .. 1.0].

Member Function Documentation

◆ Init() [1/2]

virtual Bool Murl::Logic::GraphSoundInstance::Init ( INodeObserver nodeObserver,
const Graph::IRoot root,
const String replicationIdPath,
SInt32  index 
)
inlinevirtual

Initialize the object.

Parameters
nodeObserverThe INodeObserver object.
rootThe graph root node.
replicationIdPathThe full path to the replication's graph namespace node.
indexThe index of the instance.
Returns
true if successful.

Reimplemented from Murl::Logic::GraphReplication.

References Murl::Graph::IRoot::FindNode().

◆ Init() [2/2]

virtual Bool Murl::Logic::GraphSoundInstance::Init ( INodeObserver nodeObserver,
Graph::INode replicationNode,
SInt32  index 
)
inlinevirtual

Initialize the object.

Parameters
nodeObserverThe INodeObserver object.
replicationNodeThe replication's graph namespace node.
indexThe index of the instance.
Returns
true if successful.

Implements Murl::Logic::GraphReplication.

References Murl::Logic::INodeObserver::Add(), Murl::Logic::GraphNodeT< NodeType >::GetNode(), Murl::Logic::GraphNodeT< NodeType >::GetReference(), and Murl::Logic::GraphSoundObject::Init().

◆ DeInit()

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

Deinitialize the object.

Returns
true if successful.

Implements Murl::Logic::GraphReplication.

References Murl::Logic::GraphSoundObject::DeInit().

◆ SetObtained()

virtual void Murl::Logic::GraphSoundInstance::SetObtained ( Bool  isObtained)
inlinevirtual

Set the obtained state.

Parameters
isObtainedThe obtained state.

Implements Murl::Logic::GraphReplication.

References Murl::Logic::GraphNodeT< NodeType >::SetActiveAndVisible(), and Murl::Logic::GraphSoundObject::StopPlaying().

◆ OnReset()

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

Overwrite of the BaseStepable::OnReset() method.

Reset the master volume to 1.0 and stop playing.

Reimplemented from Murl::Logic::BaseStepable.

References Murl::Logic::GraphSoundObject::SetMasterVolume(), and Murl::Logic::GraphSoundObject::StopPlaying().


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


Copyright © 2011-2018 Spraylight GmbH.