Homepage Demos Overview Downloads Tutorials Reference
Credits

SoundTestBehavior Class Reference

#include <SoundTestBehavior.h>

Inheritance diagram for SoundTestBehavior:

Inheritance graph
[legend]
List of all members.

Detailed Description

allows you to experiment with playing sounds different ways.

A different sound will be played for each of the buttons, except the head buttons. When the chin button is held down, any sounds (from this behavior) will be queued up and then played successively once the chin button is released.

Notice that this doesn't preload all needed sounds:

  • barkmed.wav is listed in /ms/config/tekkotsu.cfg as a preloaded system sound
  • growl.wav will be loaded before being played automatically - notice the hiccup this can cause.

Definition at line 21 of file SoundTestBehavior.h.

Public Member Functions

 SoundTestBehavior ()
 Constructor.
virtual void DoStart ()
 Load some sounds, listen for button events.
virtual void DoStop ()
 Release sounds we loaded in DoStart().
virtual void processEvent (const EventBase &event)
 Play the sound corresponding to the button.
virtual std::string getDescription () const
 Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis).

Static Public Member Functions

static std::string getClassDescription ()
 returns name to system

Protected Member Functions

void play (const char *name)
 called when a button is pressed - checks if it should enqueue or just play

Protected Attributes

SoundManager::Play_ID curplay
 current chain (may not be valid if chin button not down or time is past endtime)
unsigned int endtime
 the expected end of play time for the current chain
Event Templates
Used to match against the different buttons that have sounds mapped to them

EventBase LFr
EventBase RFr
EventBase LBk
EventBase RBk
EventBase Back

Static Protected Attributes

static const bool pauseWhileChin = true
 if this is true, won't start playing chain until you release the chin button


Constructor & Destructor Documentation

SoundTestBehavior::SoundTestBehavior  )  [inline]
 

Constructor.

Definition at line 24 of file SoundTestBehavior.h.


Member Function Documentation

virtual void SoundTestBehavior::DoStart  )  [inline, virtual]
 

Load some sounds, listen for button events.

Reimplemented from BehaviorBase.

Definition at line 43 of file SoundTestBehavior.h.

virtual void SoundTestBehavior::DoStop  )  [inline, virtual]
 

Release sounds we loaded in DoStart().

Reimplemented from BehaviorBase.

Definition at line 52 of file SoundTestBehavior.h.

static std::string SoundTestBehavior::getClassDescription  )  [inline, static]
 

returns name to system

Reimplemented from BehaviorBase.

Definition at line 82 of file SoundTestBehavior.h.

Referenced by getDescription().

virtual std::string SoundTestBehavior::getDescription  )  const [inline, virtual]
 

Gives a short description of what this particular instantiation does (in case a more specific description is needed on an individual basis).

By default simply returns getName(), because any calls from a BehaviorBase function to getClassDescription() are going to call BehaviorBase::getClassDescription(), not ~YourSubClass~::getClassDescription(), because static functions can't be virtual in C++ (doh!)

This means that getDescription called on a pointer to a BehaviorBase of unknown subtype would always return an empty string, which is pretty useless. So instead we return the name in this situation. If you want getDescription to return getClassDescription, you'll have to override it in your subclass to do so.

Reimplemented from BehaviorBase.

Definition at line 83 of file SoundTestBehavior.h.

void SoundTestBehavior::play const char *  name  )  [inline, protected]
 

called when a button is pressed - checks if it should enqueue or just play

Definition at line 87 of file SoundTestBehavior.h.

Referenced by processEvent().

virtual void SoundTestBehavior::processEvent const EventBase event  )  [inline, virtual]
 

Play the sound corresponding to the button.

Reimplemented from BehaviorBase.

Definition at line 61 of file SoundTestBehavior.h.


Member Data Documentation

EventBase SoundTestBehavior::Back [protected]
 

Definition at line 115 of file SoundTestBehavior.h.

Referenced by processEvent(), and SoundTestBehavior().

SoundManager::Play_ID SoundTestBehavior::curplay [protected]
 

current chain (may not be valid if chin button not down or time is past endtime)

Definition at line 110 of file SoundTestBehavior.h.

Referenced by play(), processEvent(), and SoundTestBehavior().

unsigned int SoundTestBehavior::endtime [protected]
 

the expected end of play time for the current chain

Definition at line 111 of file SoundTestBehavior.h.

Referenced by play(), processEvent(), and SoundTestBehavior().

EventBase SoundTestBehavior::LBk [protected]
 

Definition at line 115 of file SoundTestBehavior.h.

Referenced by processEvent(), and SoundTestBehavior().

EventBase SoundTestBehavior::LFr [protected]
 

Definition at line 115 of file SoundTestBehavior.h.

Referenced by processEvent(), and SoundTestBehavior().

const bool SoundTestBehavior::pauseWhileChin = true [static, protected]
 

if this is true, won't start playing chain until you release the chin button

Definition at line 109 of file SoundTestBehavior.h.

Referenced by play(), and processEvent().

EventBase SoundTestBehavior::RBk [protected]
 

Definition at line 115 of file SoundTestBehavior.h.

Referenced by processEvent(), and SoundTestBehavior().

EventBase SoundTestBehavior::RFr [protected]
 

Definition at line 115 of file SoundTestBehavior.h.

Referenced by processEvent(), and SoundTestBehavior().


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

Tekkotsu v2.2.2
Generated Tue Jan 4 15:45:33 2005 by Doxygen 1.4.0