#include <sdlaudio.h>
Inheritance diagram for SdlAudio:

Public Types | |
| typedef void(*) | CallBack (SdlAudio *, void *) |
Public Member Functions | |
| DECLSPEC | SdlAudio (const char *name=0) |
| DECLSPEC void | rename (const char *newname) |
| const char * | getName () const |
| |
| virtual int | play (int loops=0)=0 |
| virtual int | fadeIn (int ms, int loops=0)=0 |
| virtual bool | isPlaying ()=0 |
| |
| virtual void | pause ()=0 |
| virtual bool | isPaused ()=0 |
| |
| virtual void | resume ()=0 |
| virtual void | stop ()=0 |
| virtual int | fadeOut (int ms)=0 |
| virtual Mix_Fading | fadeStatus ()=0 |
| virtual void | setVolume (int v)=0 |
| virtual int | getVolume ()=0 |
| |
| virtual int | getChannel ()=0 |
| DECLSPEC void | setCallBack (CallBack c, void *pData) |
| virtual bool | isMusic ()=0 |
| bool | isFailed () |
Protected Member Functions | |
| virtual DECLSPEC void | failed () |
Protected Attributes | |
| CallBack | cb |
| the function to call, when playing finished | |
| void * | cbData |
| the value to use for the second param of the callback function | |
This class is used to handle an audio resource (sound, music...).
| typedef void(*) SdlAudio::CallBack(SdlAudio *, void *) |
Function prototype, called on finish playing an audio resource
| SdlAudio* | pointer to the resource, that just finished playing | |
| void* | pointer to any data, as specified in the second param of setCallback() |
| SdlAudio::SdlAudio | ( | const char * | name = 0 |
) |
Constructor. Registers itself in the SdlManager variable.
| name | the resource's name |
| void SdlAudio::rename | ( | const char * | newname | ) |
Changes the name of the audio resource.
| newname | the new name of the resource |
| virtual int SdlAudio::play | ( | int | loops = 0 |
) | [pure virtual] |
| virtual int SdlAudio::fadeIn | ( | int | ms, | |
| int | loops = 0 | |||
| ) | [pure 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 |
| virtual void SdlAudio::pause | ( | ) | [pure virtual] |
| virtual void SdlAudio::resume | ( | ) | [pure virtual] |
| virtual void SdlAudio::stop | ( | ) | [pure virtual] |
| virtual int SdlAudio::fadeOut | ( | int | ms | ) | [pure virtual] |
| virtual Mix_Fading SdlAudio::fadeStatus | ( | ) | [pure virtual] |
| virtual void SdlAudio::setVolume | ( | int | v | ) | [pure 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) |
| virtual int SdlAudio::getChannel | ( | ) | [pure virtual] |
| void SdlAudio::setCallBack | ( | CallBack | c, | |
| void * | pData | |||
| ) |
Sets the callback function, to be called, when the resource halts playing
| c | is called, when audio-play was halted | |
| pData | pointer to anywhere, this value will be given to the callback as second param |
| virtual bool SdlAudio::isMusic | ( | ) | [pure virtual] |
| bool SdlAudio::isFailed | ( | ) | [inline] |
| void SdlAudio::failed | ( | ) | [protected, virtual] |
Sets the failed state, call this, if an error occured and the resource could not be initialized.
1.5.1