Spinning Topp Logo BlackTopp Studios
inc
Public Types | Public Member Functions | Protected Member Functions | Protected Attributes | List of all members
Mezzanine::Audio::MusicPlayer Class Reference

This is a convenience class for the playing of music in a game. More...

#include <musicplayer.h>

+ Collaboration diagram for Mezzanine::Audio::MusicPlayer:

Public Types

typedef std::list< Audio::iSound * >::iterator TrackIterator
 Convenience type for track iterators from playlists.
 

Public Member Functions

 MusicPlayer ()
 Class constructor.
 
 ~MusicPlayer ()
 Class destructor.
 
Boole ContainsSong (iSound *Track) const
 Checks the set playlist to see if it contains a track. More...
 
PlaylistGetPlaylist () const
 Gets the playlist in use by this music player. More...
 
Boole GetPlaylistRepeat () const
 Gets wether playlist repeat is enabled. More...
 
Boole GetPlaylistShuffle () const
 Gets wether playlist shuffle is enabled. More...
 
Boole IsPaused () const
 Gets whether or not the current selection is paused. More...
 
Boole IsPlaying () const
 Gets whether or not the current selection is playing. More...
 
Boole IsStopped () const
 Gets whether or not the current selection is stopped. More...
 
void Next ()
 Advances to the next selection on the playlist.
 
void Pause ()
 Pauses the current selection.
 
void Play ()
 Plays the current selection. More...
 
void Previous ()
 Moves back to the previous selection on the playlist.
 
void SetPlaylistRepeat (Boole Repeat)
 Sets whether the playlist should return to the start after it reaches the end of the list. More...
 
void SetPlaylistShuffle (Boole Shuffle)
 Sets whether the playlist should shuffle it's contents after it reaches the end of the list. More...
 
void Stop ()
 Stops the current selection.
 
void SwitchToTrack (iSound *Track)
 Sets the specified track as the current track. More...
 
void Update ()
 Called on by the AudioManager to perform all music player responsibilities.
 

Protected Member Functions

TrackIterator GetIteratorToTrack (iSound *Track)
 Gets an iterator to the iSound instance in the current playlist. More...
 

Protected Attributes

Audio::iSoundCurrTrack
 A pointer to the currently selected track. More...
 
Boole EOPRepeat
 Stores whether or not the player will loop back to the start when it finishes playing all tracks in the playlist. More...
 
Boole EOPShuffle
 Stores whether or not the player will shuffle the playlist when it finishes playing all the tracks in the playlist. More...
 
Boole ManualStop
 Stores whether or not the current track has been manually stopped. More...
 
Audio::PlaylistMusicPlaylist
 A pointer to the active playlist used by this player. More...
 
Boole Playing
 Stores whether or not this player is currently playing. More...
 

Detailed Description

This is a convenience class for the playing of music in a game.

Definition at line 58 of file musicplayer.h.

Member Function Documentation

Boole Mezzanine::Audio::MusicPlayer::ContainsSong ( iSound Track) const

Checks the set playlist to see if it contains a track.

Parameters
TrackThe track to check for.
Returns
Returns true if the current playlist contains the specified song, false otherwise.

Definition at line 144 of file musicplayer.cpp.

MusicPlayer::TrackIterator Mezzanine::Audio::MusicPlayer::GetIteratorToTrack ( iSound Track)
protected

Gets an iterator to the iSound instance in the current playlist.

Parameters
TrackThe iSound instance to get an iterator to.
Returns
Returns a TrackIterator to the specified iSound in the currenlt playlist.

Definition at line 65 of file musicplayer.cpp.

Playlist * Mezzanine::Audio::MusicPlayer::GetPlaylist ( ) const

Gets the playlist in use by this music player.

Returns
Returns a pointer to the current playlist in use.

Definition at line 159 of file musicplayer.cpp.

Boole Mezzanine::Audio::MusicPlayer::GetPlaylistRepeat ( ) const

Gets wether playlist repeat is enabled.

Returns
Returns true if the playlist is set to repeat when it finishes, false otherwise.

Definition at line 150 of file musicplayer.cpp.

Boole Mezzanine::Audio::MusicPlayer::GetPlaylistShuffle ( ) const

Gets wether playlist shuffle is enabled.

Returns
Returns true if the playlist is set to shuffle when it finishes, false otherwise.

Definition at line 156 of file musicplayer.cpp.

Boole Mezzanine::Audio::MusicPlayer::IsPaused ( ) const

Gets whether or not the current selection is paused.

Returns
Returns true if the current track is paused, false otherwise.

Definition at line 141 of file musicplayer.cpp.

Boole Mezzanine::Audio::MusicPlayer::IsPlaying ( ) const

Gets whether or not the current selection is playing.

Returns
Returns true if the current track is playing, false otherwise.

Definition at line 135 of file musicplayer.cpp.

Boole Mezzanine::Audio::MusicPlayer::IsStopped ( ) const

Gets whether or not the current selection is stopped.

Returns
Returns true if the current track is stopped, false otherwise.

Definition at line 138 of file musicplayer.cpp.

void Mezzanine::Audio::MusicPlayer::Play ( )

Plays the current selection.

Exceptions
Ifthe current playlist is empty this throws a InvalidStateException

Definition at line 77 of file musicplayer.cpp.

void Mezzanine::Audio::MusicPlayer::SetPlaylistRepeat ( Boole  Repeat)

Sets whether the playlist should return to the start after it reaches the end of the list.

Parameters
RepeatEnables/Disables repeating the playlist when it reaches the end.

Definition at line 147 of file musicplayer.cpp.

void Mezzanine::Audio::MusicPlayer::SetPlaylistShuffle ( Boole  Shuffle)

Sets whether the playlist should shuffle it's contents after it reaches the end of the list.

Parameters
ShuffleEnables/Disables shuffling the playlist when it reaches the end.

Definition at line 153 of file musicplayer.cpp.

void Mezzanine::Audio::MusicPlayer::SwitchToTrack ( iSound Track)

Sets the specified track as the current track.

Exceptions
Ifthe provided track isn't in the playlist, this will throw an InstanceIdentityNotFoundException . Use the ContainsSong() function to verify before using this.
Parameters
TrackThe track to set.

Definition at line 121 of file musicplayer.cpp.

Member Data Documentation

Audio::iSound* Mezzanine::Audio::MusicPlayer::CurrTrack
protected

A pointer to the currently selected track.

Definition at line 69 of file musicplayer.h.

Boole Mezzanine::Audio::MusicPlayer::EOPRepeat
protected

Stores whether or not the player will loop back to the start when it finishes playing all tracks in the playlist.

Definition at line 78 of file musicplayer.h.

Boole Mezzanine::Audio::MusicPlayer::EOPShuffle
protected

Stores whether or not the player will shuffle the playlist when it finishes playing all the tracks in the playlist.

Definition at line 81 of file musicplayer.h.

Boole Mezzanine::Audio::MusicPlayer::ManualStop
protected

Stores whether or not the current track has been manually stopped.

Definition at line 72 of file musicplayer.h.

Audio::Playlist* Mezzanine::Audio::MusicPlayer::MusicPlaylist
protected

A pointer to the active playlist used by this player.

Definition at line 66 of file musicplayer.h.

Boole Mezzanine::Audio::MusicPlayer::Playing
protected

Stores whether or not this player is currently playing.

Definition at line 75 of file musicplayer.h.


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