SdlMusicList Class Reference
[SDL based classes]

Base class for managing a list of music resources. More...

#include <sdlmusiclist.h>

Inheritance diagram for SdlMusicList:

Inheritance graph
[legend]
Collaboration diagram for SdlMusicList:

Collaboration graph
[legend]
List of all members.

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
 
Returns:
the name of the resource

DECLSPEC SdlMusicgetSong (unsigned int i)
DECLSPEC SdlMusicInfogetSongInfo (unsigned int i)
unsigned int numSongs ()
 
Returns:
the number of songs that are in the list

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

Detailed Description

Base class for managing a list of music resources.

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)

See also:
SdlMusicInfo, SdlFileMusic


Member Typedef Documentation

typedef void( *) SdlMusicList::CallBack(SdlMusicList *, void *)

Function prototype of the methods to call after playing some songs. Details see setCallBack()

Parameters:
SdlMusicList* the sender of the callback-event
void* pointer to any data, value equals the second param of setCallBack()


Member Enumeration Documentation

enum SdlMusicList::PlayTypes

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


Constructor & Destructor Documentation

SdlMusicList::SdlMusicList ( const char *  name  ) 

Constructor. Registers itself in SdlManager with the given name.

Parameters:
name the name of the resource


Member Function Documentation

SdlMusic * SdlMusicList::getSong ( unsigned int  i  ) 

Get a pointer to a selected song of the list

Parameters:
i the number of the song in the list
Returns:
a pointer to the song

SdlMusicInfo * SdlMusicList::getSongInfo ( unsigned int  i  ) 

Get a pointer to a selected song of the list

Parameters:
i the number of the song in the list
Returns:
a pointer to the song's additional information

bool SdlMusicList::play ( PlayTypes  t = ptForward  ) 

Starts playing the list (infinite).

Parameters:
t the type, how to play the list
Returns:
true, if playing could be started; false on error, of if the list is empty.

void SdlMusicList::setVolume ( int  v  ) 

Changes the volume, which to use, playing the songs (relative to the global volume)

Parameters:
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!)

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

Returns:
the fail-state, which is false, if the list is so far successfully initialized, that using it is possible


The documentation for this class was generated from the following files:
Generated on Wed May 9 17:36:33 2007 for netrinjo by  doxygen 1.5.1