MusicManager Class Reference

Handle music file lists. More...

#include <musicmanager.h>

Inherits Task.

Inheritance diagram for MusicManager:

Inheritance graph
[legend]
Collaboration diagram for MusicManager:

Collaboration graph
[legend]
List of all members.

Public Member Functions

 MusicManager ()
 ~MusicManager ()
void init (ISoundMusic *ism)
 Init system for music playing.
void loadList (std::string file)
 Load music file list.
void stop ()
 Stop playing currently played music (if any).
void play ()
 Start playing music.
virtual void update (int atime)
 Check if music is still playing.

Private Attributes

std::vector< std::string > mFiles
ISoundMusicmISMusic
 files to play
bool mPlay

Detailed Description

Handle music file lists.

Music manager is usefull if you have list if music files and want randomly play from the list. The music manager is also task - it should be registered as main application task. It needs to be task since it check if the music stop playing and in such case select a new music to play.

Definition at line 21 of file musicmanager.h.


Constructor & Destructor Documentation

MusicManager::MusicManager  ) 
 

Definition at line 12 of file musicmanager.cpp.

References mISMusic, and mPlay.

MusicManager::~MusicManager  ) 
 

Definition at line 18 of file musicmanager.cpp.


Member Function Documentation

void MusicManager::init ISoundMusic ism  ) 
 

Init system for music playing.

Parameters:
ism Isn't deleted

Definition at line 23 of file musicmanager.cpp.

References mISMusic.

void MusicManager::loadList std::string  file  ) 
 

Load music file list.

Load XML file containing list of music files. The currently playing music (if any) is stopped and new music is started (if music should be playing).

Parameters:
file file with music file. The file must be located.

Definition at line 28 of file musicmanager.cpp.

References TiXmlElement::Attribute(), TiXmlHandle::Element(), TiXmlHandle::FirstChild(), TiXmlDocument::LoadFile(), LOGD, LOGE, mFiles, and TiXmlNode::NextSiblingElement().

Here is the call graph for this function:

void MusicManager::play  ) 
 

Start playing music.

Definition at line 74 of file musicmanager.cpp.

References mPlay, and update().

Here is the call graph for this function:

void MusicManager::stop  ) 
 

Stop playing currently played music (if any).

Definition at line 68 of file musicmanager.cpp.

References mISMusic, mPlay, and ISoundMusic::stop().

Here is the call graph for this function:

void MusicManager::update int  atime  )  [virtual]
 

Check if music is still playing.

If the music stoped playing and should be playing, new file from music file list is loaded and is played.

Reimplemented from Task.

Definition at line 81 of file musicmanager.cpp.

References ISoundMusic::isPlaying(), locateFile(), mFiles, mISMusic, mPlay, and ISoundMusic::play().

Referenced by play().

Here is the call graph for this function:


Member Data Documentation

std::vector<std::string> MusicManager::mFiles [private]
 

Definition at line 67 of file musicmanager.h.

Referenced by loadList(), and update().

ISoundMusic* MusicManager::mISMusic [private]
 

files to play

Definition at line 69 of file musicmanager.h.

Referenced by init(), MusicManager(), stop(), and update().

bool MusicManager::mPlay [private]
 

Definition at line 71 of file musicmanager.h.

Referenced by MusicManager(), play(), stop(), and update().


The documentation for this class was generated from the following files:
Generated on Wed Apr 12 14:20:08 2006 for bjs by  doxygen 1.4.5