OSDL::Audio::MusicManager Class Reference

A music manager has for role to drive the playback of musics, based on a playlist. More...

#include <OSDLMusicManager.h>

Collaboration diagram for OSDL::Audio::MusicManager:
Collaboration graph
[legend]

List of all members.

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.
MusicManageroperator= (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 MusicManagerOSDL::Audio::getExistingMusicManager ()

Detailed Description

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.

See also:
Music

Definition at line 252 of file OSDLMusicManager.h.


Constructor & Destructor Documentation

MusicManager::MusicManager (  ) 

Creates the music manager.

Exceptions:
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.


Member Function Documentation

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.

Parameters:
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.

Note:
Replaces the default callback set by the audio module.

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.

Note:
Never call back-end functions (ex: SDL or SDL_mixer) from the callback.
Exceptions:
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.

Note:
At least one music playback must be listed in the 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.

Parameters:
level the requested verbosity level.
Note:
Text output format is determined from overall settings.
See also:
Ceylan::TextDisplayable

Definition at line 371 of file OSDLMusicManager.cc.

References _currentMusicPlayback, _playList, and OSDL::Audio::MusicPlaybackSetting::toString().

Referenced by ~MusicManager().


Friends And Related Function Documentation

friend class AudioModule [friend]

Definition at line 257 of file OSDLMusicManager.h.

OSDL_DLL friend MusicManager& OSDL::Audio::getExistingMusicManager (  )  [friend]

Member Data Documentation

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().

The list of planned music playbacks.

Definition at line 371 of file OSDLMusicManager.h.

Referenced by enqueue(), onMusicPlaybackFinished(), startNextMusicPlayback(), toString(), and ~MusicManager().


The documentation for this class was generated from the following files:
Generated on Mon Nov 29 14:05:30 2010 for OSDL by  doxygen 1.6.3