Tekkotsu Homepage
Demos
Overview
Downloads
Dev. Resources
Reference
Credits

SoundNode Class Reference

A simple StateNode that plays a sound upon startup and posts a status event on completion. More...

#include <SoundNode.h>

Inheritance diagram for SoundNode:

Detailed Description

A simple StateNode that plays a sound upon startup and posts a status event on completion.

Doesn't automatically preload the sound buffer - if you want the sound file to be preloaded, you'll have to make the SoundManager::loadFile() / SoundManager::releaseFile() calls yourself.

By default, sound playback will continue even after this node has been deactivated. If this is not the behavior you desire, set the autostop flag (through setAutoStop())

Definition at line 17 of file SoundNode.h.

List of all members.

Public Member Functions

 SoundNode (const std::string &soundfilename="")
 constructor, specify a sound file to play
 SoundNode (const std::string &nodename, const std::string &soundfilename)
 constructor, specify instance name and sound file to play
virtual void preStart ()
 activate the node, starts playing the sound
virtual void postStart ()
 Called by start() after the doStart(), allows superclasses to complete initialization.
virtual void stop ()
 deactivate the node, doesn't stop the sound playback unless the autostop flag has been set
virtual void doEvent ()
 receive audioEGID status event and post stateMachineEGID status event
void stopPlay ()
 interrupts playing of the current sound
std::string getFileName ()
 returns the name of the sound file associated with this node
void setFileName (std::string &soundfilename)
 sets the name of the sound file associated with this node
bool getAutoStop ()
 returns the current status of the autostop flag
void setAutoStop (bool astop)
 sets the autostop flag

Protected Member Functions

virtual void startPlaying ()

Protected Attributes

std::string filename
 filename of sound to play, accessed through setFileName() and getFileName()
SoundManager::Play_ID curplay_id
 holds the playback identification so it can be halted any time
bool autostop
 if set to true by setAutoStop(), when this node is deactivated, playback will be halted. Otherwise, playback will continue even after the node is deactivated

Constructor & Destructor Documentation

SoundNode::SoundNode ( const std::string &  soundfilename = ""  ) 

constructor, specify a sound file to play

Definition at line 20 of file SoundNode.h.

SoundNode::SoundNode ( const std::string &  nodename,
const std::string &  soundfilename 
)

constructor, specify instance name and sound file to play

Definition at line 24 of file SoundNode.h.


Member Function Documentation

virtual void SoundNode::doEvent (  )  [virtual]

receive audioEGID status event and post stateMachineEGID status event

Reimplemented from BehaviorBase.

Definition at line 50 of file SoundNode.h.

bool SoundNode::getAutoStop (  ) 

returns the current status of the autostop flag

Definition at line 68 of file SoundNode.h.

std::string SoundNode::getFileName (  ) 

returns the name of the sound file associated with this node

Definition at line 62 of file SoundNode.h.

virtual void SoundNode::postStart (  )  [virtual]

Called by start() after the doStart(), allows superclasses to complete initialization.

For robustness to future change, subclasses should be sure to call the superclass implementation.

Reimplemented from BehaviorBase.

Definition at line 37 of file SoundNode.h.

virtual void SoundNode::preStart (  )  [virtual]

activate the node, starts playing the sound

Reimplemented from BehaviorBase.

Definition at line 28 of file SoundNode.h.

void SoundNode::setAutoStop ( bool  astop  ) 

sets the autostop flag

Definition at line 71 of file SoundNode.h.

void SoundNode::setFileName ( std::string &  soundfilename  ) 

sets the name of the sound file associated with this node

Definition at line 65 of file SoundNode.h.

virtual void SoundNode::startPlaying (  )  [protected, virtual]

Definition at line 74 of file SoundNode.h.

Referenced by postStart().

virtual void SoundNode::stop (  )  [virtual]

deactivate the node, doesn't stop the sound playback unless the autostop flag has been set

Reimplemented from StateNode.

Definition at line 43 of file SoundNode.h.

void SoundNode::stopPlay (  ) 

interrupts playing of the current sound

Definition at line 56 of file SoundNode.h.

Referenced by stop().


Member Data Documentation

bool SoundNode::autostop [protected]

if set to true by setAutoStop(), when this node is deactivated, playback will be halted. Otherwise, playback will continue even after the node is deactivated

Definition at line 83 of file SoundNode.h.

Referenced by getAutoStop(), setAutoStop(), and stop().

holds the playback identification so it can be halted any time

Definition at line 82 of file SoundNode.h.

Referenced by doEvent(), startPlaying(), and stopPlay().

std::string SoundNode::filename [protected]

filename of sound to play, accessed through setFileName() and getFileName()

Definition at line 81 of file SoundNode.h.

Referenced by getFileName(), preStart(), setFileName(), and startPlaying().


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

Tekkotsu v5.1CVS
Generated Mon May 9 04:59:17 2016 by Doxygen 1.6.3