Tramway SDK
|
#include <audio/sound.h>
Public Member Functions | |
void | LoadFromDisk () |
Loads the sound from the disk. More... | |
void | LoadFromMemory () |
void | Unload () |
Removes the sound from memory. More... | |
float | GetLength () |
Returns sound length in seconds. More... | |
![]() | |
Resource (name_t name) | |
Resource::Status | GetStatus () const |
name_t | GetName () const |
size_t | GetReferences () const |
bool | IsLoadFailed () const |
void | AddReference () |
void | RemoveReference () |
void | Load () |
Static Public Member Functions | |
static Sound * | Find (name_t name) |
Finds a sound by a name. More... | |
Public Attributes | |
audiobuffer_t | sound_buffer = {0} |
int32_t | channels = 0 |
int32_t | sample_rate = 0 |
int32_t | sound_length = 0 |
int16_t * | sound_data = nullptr |
Protected Member Functions | |
Sound (name_t name) | |
Friends | |
template<typename > | |
class | tram::Pool |
Additional Inherited Members | |
![]() | |
enum | Status { UNLOADED , LOADED , READY } |
![]() | |
Status | status = UNLOADED |
name_t | name |
bool | load_fail = false |
size_t | references = 0 |
Audio data resource.
Currently we only support .ogg
files, via the stb_vorbis
library.
|
inlineprotected |
Finds a sound by a name.
If a sound by that name doesn't exist, it will be created.
|
inline |
Returns sound length in seconds.
|
virtual |
Loads the sound from the disk.
Implements tram::Resource.
|
inlinevirtual |
Implements tram::Resource.
|
virtual |
Removes the sound from memory.
Implements tram::Resource.
|
friend |
int32_t tram::Audio::Sound::channels = 0 |
int32_t tram::Audio::Sound::sample_rate = 0 |
audiobuffer_t tram::Audio::Sound::sound_buffer = {0} |
int16_t* tram::Audio::Sound::sound_data = nullptr |
int32_t tram::Audio::Sound::sound_length = 0 |