#include <sdlfilemusic.h>
Inheritance diagram for SdlMusic:
Public Member Functions | |
DECLSPEC | SdlMusic (const char *name) |
virtual DECLSPEC int | play (int loops=0) |
virtual DECLSPEC int | fadeIn (int ms, int loops=0) |
virtual DECLSPEC bool | isPlaying () |
| |
virtual DECLSPEC void | pause () |
virtual DECLSPEC bool | isPaused () |
| |
virtual DECLSPEC void | resume () |
virtual DECLSPEC void | stop () |
virtual DECLSPEC int | fadeOut (int ms) |
virtual DECLSPEC Mix_Fading | fadeStatus () |
virtual DECLSPEC void | setVolume (int v) |
virtual DECLSPEC int | getVolume () |
| |
virtual int | getChannel () |
virtual bool | isMusic () |
Static Public Member Functions | |
static SdlMusic * | getPlayingStream () |
static DECLSPEC void | setGlbVolume (int v) |
Protected Member Functions | |
DECLSPEC void | destroy () |
Static Protected Member Functions | |
static void | onMusicFinished () |
Protected Attributes | |
Mix_Music * | mixMusic |
the source data of the music | |
int | nVolume |
the volume of this resource, relative to the global | |
bool | bPlaying |
playing status of the resource (true if playing) | |
Static Protected Attributes | |
static int | g_nVolume |
the global volume (range: 0..128) | |
static SdlMusic * | musPlaying |
pointer to the currently playing music or 0, if none is being played |
This class is the base class for all music resources. They are used to play audio data, that takes much memory.
SdlMusic::SdlMusic | ( | const char * | name | ) |
Constructor. Registers itself in the SdlManager.
name | the resource's name |
int SdlMusic::play | ( | int | loops = 0 |
) | [virtual] |
Plays the resource.
loops | the amount, how often to repeat the sound; to repeat it infinitely it has to be -1 |
Implements SdlAudio.
int SdlMusic::fadeIn | ( | int | ms, | |
int | loops = 0 | |||
) | [virtual] |
Starts playing the resource silently and turns louder
ms | the time in msecs of the fade, after that, it has the final volume | |
loops | the amount, how often to repeat the sound; to repeat it infinitely it has to be -1 |
Implements SdlAudio.
void SdlMusic::pause | ( | ) | [virtual] |
Breaks playing the resource to be continued later.
Implements SdlAudio.
void SdlMusic::resume | ( | ) | [virtual] |
Resumes playing the resource, if paused
Implements SdlAudio.
void SdlMusic::stop | ( | ) | [virtual] |
Stopps the resource being played.
Implements SdlAudio.
int SdlMusic::fadeOut | ( | int | ms | ) | [virtual] |
Turns the volume silentlier and then stopps playing.
ms | the time in msecs of the fade |
Implements SdlAudio.
Mix_Fading SdlMusic::fadeStatus | ( | ) | [virtual] |
Implements SdlAudio.
void SdlMusic::setVolume | ( | int | v | ) | [virtual] |
Sets the volume of the resource, when being played. The value is relative to the global volume.
v | the volume, the range is from 0 to 128; if negative, the volume is just recalculated (you usually do not need recalculation, because it makes only sense internally, when changing the global volume) |
Implements SdlAudio.
virtual int SdlMusic::getChannel | ( | ) | [inline, virtual] |
Implements SdlAudio.
virtual bool SdlMusic::isMusic | ( | ) | [inline, virtual] |
static SdlMusic* SdlMusic::getPlayingStream | ( | ) | [inline, static] |
void SdlMusic::setGlbVolume | ( | int | v | ) | [static] |
Changes the global volume, which is used as reference in all SdlMusic derived classes.
v | the volume to set (range 0 (quiet) to 128 (loudest)) |
void SdlMusic::destroy | ( | ) | [protected] |
Uninitalizes the music resource. This is automatically called, when deleting the object. It halts playing, if necessary and frees the resource's data (the mixMusic variable).
static void SdlMusic::onMusicFinished | ( | ) | [inline, static, protected] |
This method should not be called from your application. It's a callback function, called, when the music-channel finishes playing