Tramway SDK
Public Member Functions | Static Public Member Functions | Public Attributes | Protected Member Functions | Friends | List of all members
tram::Audio::Sound Class Reference

#include <sound.h>

Inheritance diagram for tram::Audio::Sound:
tram::Resource

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...
 
- Public Member Functions inherited from tram::Resource
 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 SoundFind (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

- Public Types inherited from tram::Resource
enum  Status { UNLOADED , LOADED , READY }
 
- Protected Attributes inherited from tram::Resource
Status status = UNLOADED
 
name_t name
 
bool load_fail = false
 
size_t references = 0
 

Constructor & Destructor Documentation

◆ Sound()

tram::Audio::Sound::Sound ( name_t  name)
inlineprotected

Member Function Documentation

◆ Find()

Sound * tram::Audio::Sound::Find ( name_t  name)
static

Finds a sound by a name.

If a sound by that name doesn't exist, then it will be created.

Returns
Always returns a pointer to a Sound.

◆ GetLength()

float tram::Audio::Sound::GetLength ( )
inline

Returns sound length in seconds.

◆ LoadFromDisk()

void tram::Audio::Sound::LoadFromDisk ( )
virtual

Loads the sound from the disk.

Implements tram::Resource.

◆ LoadFromMemory()

void tram::Audio::Sound::LoadFromMemory ( )
inlinevirtual

Implements tram::Resource.

◆ Unload()

void tram::Sound::Unload ( )
virtual

Removes the sound from memory.

Implements tram::Resource.

Friends And Related Function Documentation

◆ tram::Pool

template<typename >
friend class tram::Pool
friend

Member Data Documentation

◆ channels

int32_t tram::Audio::Sound::channels = 0

◆ sample_rate

int32_t tram::Audio::Sound::sample_rate = 0

◆ sound_buffer

audiobuffer_t tram::Audio::Sound::sound_buffer = {0}

◆ sound_data

int16_t* tram::Audio::Sound::sound_data = nullptr

◆ sound_length

int32_t tram::Audio::Sound::sound_length = 0

The documentation for this class was generated from the following files: