|
NWengine 0.9
|
Represents a sound asset. More...
#include <Audio.h>
Public Member Functions | |
| Sound ()=default | |
| Default constructor for the Sound class. | |
| void | Play () |
| Plays the sound. | |
| void | SetVolume (float volume) |
| Sets the volume of the sound. | |
| void | SetFrequency (float frequency) |
| Sets the frequency of the sound. | |
| void | SetLoop (bool loop) |
| Sets whether the sound should loop or not. | |
| void | Stop () |
| Stops the sound. | |
| bool | HasFinished () |
| Checks if the sound has finished playing. | |
| void | Clean () override |
| Cleans up the sound. | |
| Asset * | GetFromCache (void *id) |
| Gets the sound asset from the cache. | |
| Asset * | LoadFromFile (const char *path, void *id) |
| Loads the sound asset from a file. | |
| Asset * | LoadFromBuffer (void *alBuffer, void *id) |
| Loads the sound asset from a buffer. | |
| NW_DECL_RES_LIST (SoundIdentifier, Sound) | |
| Declares the resource list for SoundIdentifier and Sound. | |
Static Public Member Functions | |
| static bool | Init () |
| Initializes the Sound class. | |
| static void | Destroy () |
| Destroys the Sound class. | |
Public Attributes | |
| uint32 | _buffID = 0 |
| uint32 | _source = 0 |
| float | volume = 1.0f |
| float | frequency = 1.0f |
| bool | isLooping = false |
| bool | isPlaying = false |
Represents a sound asset.
Gets the sound asset from the cache.
| id | The ID of the sound asset. |
Reimplemented from Asset.
| bool Sound::HasFinished | ( | ) |
Checks if the sound has finished playing.
|
static |
Initializes the Sound class.
Loads the sound asset from a buffer.
| alBuffer | The OpenAL buffer. |
| id | The ID of the sound asset. |
Reimplemented from Asset.
Loads the sound asset from a file.
| path | The path of the sound file. |
| id | The ID of the sound asset. |
Reimplemented from Asset.
Sets the frequency of the sound.
| frequency | The frequency value to set. |
Sets whether the sound should loop or not.
| loop | True to enable looping, false otherwise. |
Sets the volume of the sound.
| volume | The volume value to set. |
| uint32 Sound::_buffID = 0 |
The buffer ID of the sound.
| uint32 Sound::_source = 0 |
The source ID of the sound.
| float Sound::frequency = 1.0f |
The frequency of the sound.
| float Sound::volume = 1.0f |
The volume of the sound.