Tramway SDK
Public Member Functions | Protected Attributes | List of all members
tram::AudioComponent Class Reference

#include <audio.h>

Inheritance diagram for tram::AudioComponent:
tram::EntityComponent

Public Member Functions

 AudioComponent ()
 
 ~AudioComponent ()
 
void Start ()
 
void SetLocation (vec3 location)
 Sets the location from which the sound will play. More...
 
void SetSound (name_t name)
 Sets the sound that the component will play. More...
 
void SetRepeating (bool is_repeating)
 Sets whether the component will repeat its sound. More...
 
bool IsPlaying ()
 Checks if component is playing a sound. More...
 
void Play ()
 Plays the sound. More...
 
void Pause ()
 Pauses the sound. More...
 
void Stop ()
 Stops the sound. More...
 
void EventHandler (Event &event)
 
- Public Member Functions inherited from tram::EntityComponent
 EntityComponent ()
 
virtual ~EntityComponent ()
 
virtual void Init ()
 
bool IsReady ()
 
bool IsInit ()
 
EntityGetParent ()
 
void SetParent (Entity *parent)
 

Protected Attributes

ResourceProxy< Audio::Soundsound
 
Audio::audiosource_t source = {.generic = nullptr}
 
vec3 location = {0.0f, 0.0f, 0.0f}
 
bool repeat = false
 
bool play_on_start = false
 
- Protected Attributes inherited from tram::EntityComponent
size_t resources_waiting = 0
 
bool is_ready = false
 
bool is_init = false
 
Entityparent = nullptr
 

Additional Inherited Members

- Protected Member Functions inherited from tram::EntityComponent
void ResourceReady ()
 

Constructor & Destructor Documentation

◆ AudioComponent()

tram::AudioComponent::AudioComponent ( )
inline

◆ ~AudioComponent()

tram::AudioComponent::~AudioComponent ( )

Member Function Documentation

◆ EventHandler()

void tram::AudioComponent::EventHandler ( Event event)
inlinevirtual

Implements tram::EntityComponent.

◆ IsPlaying()

bool tram::AudioComponent::IsPlaying ( )

Checks if component is playing a sound.

Returns
True, if a sound is playing, false if it hasn't started or has stopped.

◆ Pause()

void tram::AudioComponent::Pause ( )

Pauses the sound.

Pauses the sound that the component is playing, or does nothing, if no sound is playing.

◆ Play()

void tram::AudioComponent::Play ( )

Plays the sound.

Plays the sound that the component has been set to play.

◆ SetLocation()

void tram::AudioComponent::SetLocation ( vec3  location)

Sets the location from which the sound will play.

◆ SetRepeating()

void tram::AudioComponent::SetRepeating ( bool  is_repeating)

Sets whether the component will repeat its sound.

◆ SetSound()

void tram::AudioComponent::SetSound ( name_t  name)

Sets the sound that the component will play.

◆ Start()

void tram::AudioComponent::Start ( )
virtual

Implements tram::EntityComponent.

◆ Stop()

void tram::AudioComponent::Stop ( )

Stops the sound.

Stops the sound that the component is playing, or does nothing, if no sound is playing.

Member Data Documentation

◆ location

vec3 tram::AudioComponent::location = {0.0f, 0.0f, 0.0f}
protected

◆ play_on_start

bool tram::AudioComponent::play_on_start = false
protected

◆ repeat

bool tram::AudioComponent::repeat = false
protected

◆ sound

ResourceProxy<Audio::Sound> tram::AudioComponent::sound
protected

◆ source

Audio::audiosource_t tram::AudioComponent::source = {.generic = nullptr}
protected

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