|
enum | SOUND_TYPES { MUSIC = 0,
SPEECH = 1,
SFX = 2
} |
|
typedef void(* | DynamicSoundReadCallback) (void *UserData, void *Data, uint DataLength) |
|
|
| SoundEngine (Kernel *pKernel) |
|
bool | init (uint sampleRate, uint channels=32) |
|
void | update () |
|
void | setVolume (float volume, SOUND_TYPES type) |
|
float | getVolume (SOUND_TYPES type) |
|
void | pauseAll () |
|
void | resumeAll () |
|
void | pauseLayer (uint layer) |
|
void | resumeLayer (uint layer) |
|
bool | playSound (const Common::String &fileName, SOUND_TYPES type, float volume=1.0f, float pan=0.0f, bool loop=false, int loopStart=-1, int loopEnd=-1, uint layer=0) |
|
uint | playSoundEx (const Common::String &fileName, SOUND_TYPES type, float volume=1.0f, float pan=0.0f, bool loop=false, int loopStart=-1, int loopEnd=-1, uint layer=0, uint handleId=0x1337) |
|
void | setSoundVolume (uint handle, float volume) |
|
void | setSoundPanning (uint handle, float pan) |
|
void | pauseSound (uint handle) |
|
void | resumeSound (uint handle) |
|
void | stopSound (uint handle) |
|
bool | isSoundPaused (uint handle) |
|
bool | isSoundPlaying (uint handle) |
|
float | getSoundVolume (uint handle) |
|
float | getSoundPanning (uint handle) |
|
Resource * | loadResource (const Common::String &fileName) override |
|
bool | canLoadResource (const Common::String &fileName) override |
|
bool | persist (OutputPersistenceBlock &writer) override |
|
bool | unpersist (InputPersistenceBlock &reader) override |
|
| ResourceService (Kernel *pKernel) |
|
◆ DynamicSoundReadCallback
typedef void(* Sword25::SoundEngine::DynamicSoundReadCallback) (void *UserData, void *Data, uint DataLength) |
The callback function of PlayDynamicSoundEx
- Parameters
-
UserData | User-specified pointer |
Data | Pointer to the data buffer |
DataLength | Length of the data to be written in bytes |
◆ init()
bool Sword25::SoundEngine::init |
( |
uint |
sampleRate, |
|
|
uint |
channels = 32 |
|
) |
| |
Initializes the sound engine
- Parameters
-
SampleRate | Specifies the sample rate to use. |
Channels | The maximum number of channels. The default is 32. |
- Returns
- Returns true on success, otherwise false.
◆ update()
void Sword25::SoundEngine::update |
( |
| ) |
|
Performs a "tick" of the sound engine
This method should be called once per frame. It can be used by implementations of the sound engine that are not running in their own thread, or to perform additional administrative tasks that are needed.
◆ setVolume()
void Sword25::SoundEngine::setVolume |
( |
float |
volume, |
|
|
SOUND_TYPES |
type |
|
) |
| |
Sets the default volume for the different sound types
- Parameters
-
Volume | The default volume level (0 = off, 1 = full volume) |
Type | The SoundType whose volume is to be changed |
◆ getVolume()
float Sword25::SoundEngine::getVolume |
( |
SOUND_TYPES |
type | ) |
|
Specifies the default volume of different sound types
- Parameters
-
- Returns
- Returns the standard sound volume for the given type (0 = off, 1 = full volume).
◆ pauseAll()
void Sword25::SoundEngine::pauseAll |
( |
| ) |
|
Pauses all the sounds that are playing.
◆ resumeAll()
void Sword25::SoundEngine::resumeAll |
( |
| ) |
|
Resumes all currently stopped sounds
◆ pauseLayer()
void Sword25::SoundEngine::pauseLayer |
( |
uint |
layer | ) |
|
Pauses all sounds of a given layer.
- Parameters
-
◆ resumeLayer()
void Sword25::SoundEngine::resumeLayer |
( |
uint |
layer | ) |
|
Resumes all the sounds in a layer that was previously stopped with PauseLayer()
- Parameters
-
◆ playSound()
bool Sword25::SoundEngine::playSound |
( |
const Common::String & |
fileName, |
|
|
SOUND_TYPES |
type, |
|
|
float |
volume = 1.0f , |
|
|
float |
pan = 0.0f , |
|
|
bool |
loop = false , |
|
|
int |
loopStart = -1 , |
|
|
int |
loopEnd = -1 , |
|
|
uint |
layer = 0 |
|
) |
| |
Plays a sound
- Parameters
-
FileName | The filename of the sound to be played |
Type | The type of sound |
Volume | The volume of the sound (0 = off, 1 = full volume) |
Pan | Panning (-1 = full left, 1 = right) |
Loop | Indicates whether the sound should be looped |
LoopStart | Indicates the starting loop point. If a value less than 0 is passed, the start of the sound is used. |
LoopEnd | Indicates the ending loop point. If a avlue is passed less than 0, the end of the sound is used. |
Layer | The sound layer |
- Returns
- Returns true if the playback of the sound was started successfully.
◆ playSoundEx()
uint Sword25::SoundEngine::playSoundEx |
( |
const Common::String & |
fileName, |
|
|
SOUND_TYPES |
type, |
|
|
float |
volume = 1.0f , |
|
|
float |
pan = 0.0f , |
|
|
bool |
loop = false , |
|
|
int |
loopStart = -1 , |
|
|
int |
loopEnd = -1 , |
|
|
uint |
layer = 0 , |
|
|
uint |
handleId = 0x1337 |
|
) |
| |
Plays a sound
- Parameters
-
Type | The type of sound |
Volume | The volume of the sound (0 = off, 1 = full volume) |
Pan | Panning (-1 = full left, 1 = right) |
Loop | Indicates whether the sound should be looped |
LoopStart | Indicates the starting loop point. If a value less than 0 is passed, the start of the sound is used. |
LoopEnd | Indicates the ending loop point. If a avlue is passed less than 0, the end of the sound is used. |
Layer | The sound layer |
- Returns
- Returns a handle to the sound. With this handle, the sound can be manipulated during playback.
◆ setSoundVolume()
void Sword25::SoundEngine::setSoundVolume |
( |
uint |
handle, |
|
|
float |
volume |
|
) |
| |
Sets the volume of a playing sound
- Parameters
-
Handle | The sound handle |
Volume | The volume of the sound (0 = off, 1 = full volume) |
◆ setSoundPanning()
void Sword25::SoundEngine::setSoundPanning |
( |
uint |
handle, |
|
|
float |
pan |
|
) |
| |
Sets the panning of a playing sound
- Parameters
-
Handle | The sound handle |
Pan | Panning (-1 = full left, 1 = right) |
◆ pauseSound()
void Sword25::SoundEngine::pauseSound |
( |
uint |
handle | ) |
|
Pauses a playing sound
- Parameters
-
◆ resumeSound()
void Sword25::SoundEngine::resumeSound |
( |
uint |
handle | ) |
|
Resumes a paused sound
- Parameters
-
◆ stopSound()
void Sword25::SoundEngine::stopSound |
( |
uint |
handle | ) |
|
Stops a playing sound
- Parameters
-
◆ isSoundPaused()
bool Sword25::SoundEngine::isSoundPaused |
( |
uint |
handle | ) |
|
Returns whether a sound is paused
- Parameters
-
- Returns
- Returns true if the sound is paused, false otherwise.
◆ isSoundPlaying()
bool Sword25::SoundEngine::isSoundPlaying |
( |
uint |
handle | ) |
|
Returns whether a sound is still playing.
- Parameters
-
- Returns
- Returns true if the sound is playing, false otherwise.
◆ getSoundVolume()
float Sword25::SoundEngine::getSoundVolume |
( |
uint |
handle | ) |
|
Returns the volume of a playing sound (0 = off, 1 = full volume)
◆ getSoundPanning()
float Sword25::SoundEngine::getSoundPanning |
( |
uint |
handle | ) |
|
Returns the panning of a playing sound (-1 = full left, 1 = right)
◆ loadResource()
◆ canLoadResource()
bool Sword25::SoundEngine::canLoadResource |
( |
const Common::String & |
fileName | ) |
|
|
overridevirtual |
Checks whether the given name can be loaded by the resource service
- Parameters
-
- Returns
- Returns true if the resource can be loaded.
Implements Sword25::ResourceService.
The documentation for this class was generated from the following file: