A music manager has for role to drive the playback of musics, based on a playlist. More...
#include <OSDLMusicManager.h>
Public Member Functions | |
MusicManager () | |
Creates the music manager. | |
virtual | ~MusicManager () throw () |
Virtual destructor. | |
virtual void | enqueue (Music &music, PlaybackCount count=1, bool fadeIn=false, bool fadeOut=false) |
Enqueues specified music in the playlist of this music manager. | |
virtual bool | isPlaying () const |
Returns true iff a music is playing. | |
virtual const std::string | toString (Ceylan::VerbosityLevels level=Ceylan::high) const |
Returns an user-friendly description of the state of this object. | |
Protected Member Functions | |
virtual void | startNextMusicPlayback () |
Starts the playblack of the next music in playlist. | |
virtual void | stopCurrentMusicPlayback () |
Stops any current music playback. | |
virtual void | onMusicPlaybackFinished () |
This method will be automatically called as soon as the music playback stops. | |
Protected Attributes | |
std::list< MusicPlaybackSetting * > | _playList |
The list of planned music playbacks. | |
MusicPlaybackSetting * | _currentMusicPlayback |
The current music playback (if any). | |
Static Protected Attributes | |
static MusicManager * | _CurrentMusicManager = 0 |
The current overall (static) music manager. | |
Private Member Functions | |
MusicManager (const MusicManager &source) | |
Copy constructor made private to ensure that it will be never called. | |
MusicManager & | operator= (const MusicManager &source) |
Assignment operator made private to ensure that it will be never called. | |
Static Private Member Functions | |
static void | HandleMusicPlaybackFinishedCallback () |
Callback to catch the end of the music playback. | |
Friends | |
class | AudioModule |
OSDL_DLL friend MusicManager & | OSDL::Audio::getExistingMusicManager () |
A music manager has for role to drive the playback of musics, based on a playlist.
Although multiple managers can be used simultaneously, usely there is only one of them, statically registered by the audio module.
Definition at line 252 of file OSDLMusicManager.h.
MusicManager::MusicManager | ( | ) |
Creates the music manager.
MusicManagerException | if the creation failed, including if there is already a music manager registered. |
Definition at line 289 of file OSDLMusicManager.cc.
References HandleMusicPlaybackFinishedCallback().
MusicManager::~MusicManager | ( | ) | throw () [virtual] |
Virtual destructor.
Definition at line 300 of file OSDLMusicManager.cc.
References _playList, stopCurrentMusicPlayback(), OSDL::Video::Pixels::toString(), and toString().
OSDL::Audio::MusicManager::MusicManager | ( | const MusicManager & | source | ) | [explicit, private] |
Copy constructor made private to ensure that it will be never called.
The compiler should complain whenever this undefined constructor is called, implicitly or not.
void MusicManager::enqueue | ( | Music & | music, | |
PlaybackCount | count = 1 , |
|||
bool | fadeIn = false , |
|||
bool | fadeOut = false | |||
) | [virtual] |
Enqueues specified music in the playlist of this music manager.
music | the music which will be played as soon as all other musics in the playlist (if any) will have been played in turn. |
Definition at line 339 of file OSDLMusicManager.cc.
References _currentMusicPlayback, _playList, OSDL::Audio::MusicPlaybackSetting::setFadeInStatus(), OSDL::Audio::MusicPlaybackSetting::setFadeOutStatus(), and startNextMusicPlayback().
void MusicManager::HandleMusicPlaybackFinishedCallback | ( | ) | [static, private] |
Callback to catch the end of the music playback.
This signature is mandatory.
Definition at line 541 of file OSDLMusicManager.cc.
References OSDL::Audio::getExistingMusicManager(), and onMusicPlaybackFinished().
Referenced by MusicManager().
bool MusicManager::isPlaying | ( | ) | const [virtual] |
Returns true iff a music is playing.
Definition at line 362 of file OSDLMusicManager.cc.
References _currentMusicPlayback.
void MusicManager::onMusicPlaybackFinished | ( | ) | [protected, virtual] |
This method will be automatically called as soon as the music playback stops.
AudioException | if the operation failed. |
Definition at line 498 of file OSDLMusicManager.cc.
References _currentMusicPlayback, _playList, OSDL::Audio::MusicPlaybackSetting::onPlaybackEnded(), and startNextMusicPlayback().
Referenced by HandleMusicPlaybackFinishedCallback().
MusicManager& OSDL::Audio::MusicManager::operator= | ( | const MusicManager & | source | ) | [private] |
Assignment operator made private to ensure that it will be never called.
The compiler should complain whenever this undefined operator is called, implicitly or not.
void MusicManager::startNextMusicPlayback | ( | ) | [protected, virtual] |
Starts the playblack of the next music in playlist.
Definition at line 423 of file OSDLMusicManager.cc.
References _currentMusicPlayback, _playList, and OSDL::Audio::MusicPlaybackSetting::startPlayback().
Referenced by enqueue(), and onMusicPlaybackFinished().
void MusicManager::stopCurrentMusicPlayback | ( | ) | [protected, virtual] |
Stops any current music playback.
Definition at line 448 of file OSDLMusicManager.cc.
References _currentMusicPlayback, and OSDL::Audio::MusicPlaybackSetting::stopPlayback().
Referenced by ~MusicManager().
const string MusicManager::toString | ( | Ceylan::VerbosityLevels | level = Ceylan::high |
) | const [virtual] |
Returns an user-friendly description of the state of this object.
level | the requested verbosity level. |
Definition at line 371 of file OSDLMusicManager.cc.
References _currentMusicPlayback, _playList, and OSDL::Audio::MusicPlaybackSetting::toString().
Referenced by ~MusicManager().
friend class AudioModule [friend] |
Definition at line 257 of file OSDLMusicManager.h.
OSDL_DLL friend MusicManager& OSDL::Audio::getExistingMusicManager | ( | ) | [friend] |
MusicManager * MusicManager::_CurrentMusicManager = 0 [static, protected] |
The current overall (static) music manager.
Definition at line 382 of file OSDLMusicManager.h.
Referenced by OSDL::Audio::AudioModule::AudioModule(), and OSDL::Audio::AudioModule::~AudioModule().
The current music playback (if any).
Definition at line 377 of file OSDLMusicManager.h.
Referenced by enqueue(), isPlaying(), onMusicPlaybackFinished(), startNextMusicPlayback(), stopCurrentMusicPlayback(), and toString().
std::list<MusicPlaybackSetting *> OSDL::Audio::MusicManager::_playList [protected] |
The list of planned music playbacks.
Definition at line 371 of file OSDLMusicManager.h.
Referenced by enqueue(), onMusicPlaybackFinished(), startNextMusicPlayback(), toString(), and ~MusicManager().