#include <sdlmusiclist.h>
Inheritance diagram for SdlMusicList:
Public Types | |
enum | PlayTypes { ptForward, ptBackward, ptShuffled, ptRandom } |
typedef void(*) | CallBack (SdlMusicList *, void *) |
Public Member Functions | |
DECLSPEC | SdlMusicList (const char *name) |
const char * | getName () const |
| |
DECLSPEC SdlMusic * | getSong (unsigned int i) |
DECLSPEC SdlMusicInfo * | getSongInfo (unsigned int i) |
unsigned int | numSongs () |
| |
DECLSPEC bool | play (PlayTypes t=ptForward) |
DECLSPEC void | stop () |
halts playing the list | |
DECLSPEC void | setVolume (int v) |
void | setCallBack (CallBack c, void *data) |
bool | isFailed () |
Protected Member Functions | |
virtual DECLSPEC void | failed () |
sets the fail-state | |
Protected Attributes | |
vector< SdlMusic * > | lSongs |
list of all songs | |
vector< SdlMusicInfo * > | lInfos |
list of all additional song information |
Required header file:
#include <sdlmusiclist.h>
This is a base class to manage music resources. (Actually you can use it as base to manage any list of strings, but it was designed for music lists)
typedef void( *) SdlMusicList::CallBack(SdlMusicList *, void *) |
Function prototype of the methods to call after playing some songs. Details see setCallBack()
SdlMusicList* | the sender of the callback-event | |
void* | pointer to any data, value equals the second param of setCallBack() |
Some ways of playing a list ptForward play songs in strict rotation ptBackward play songs strict against rotation ptShuffled take any song to play, until all have been played once ptRandom take any song to play without regard for how often a song was played
SdlMusicList::SdlMusicList | ( | const char * | name | ) |
Constructor. Registers itself in SdlManager with the given name.
name | the name of the resource |
SdlMusic * SdlMusicList::getSong | ( | unsigned int | i | ) |
Get a pointer to a selected song of the list
i | the number of the song in the list |
SdlMusicInfo * SdlMusicList::getSongInfo | ( | unsigned int | i | ) |
Get a pointer to a selected song of the list
i | the number of the song in the list |
bool SdlMusicList::play | ( | PlayTypes | t = ptForward |
) |
Starts playing the list (infinite).
t | the type, how to play the list |
void SdlMusicList::setVolume | ( | int | v | ) |
Changes the volume, which to use, playing the songs (relative to the global volume)
v | the new volume (possible range: 0 to 128) |
void SdlMusicList::setCallBack | ( | CallBack | c, | |
void * | data | |||
) | [inline] |
Sets the function to call after every song of the list hasbeen played (will not be called, if the type is ptRandom!)
c | pointer to the function to call | |
data | pointer to anywhere, it will be sent to the called function as second param |
bool SdlMusicList::isFailed | ( | ) | [inline] |