Tramway SDK
audio.h
Go to the documentation of this file.
1// TRAMWAY DRIFT AND DUNGEON EXPLORATION SIMULATOR 2022
2// All rights reserved.
3
4#ifndef TRAM_SDK_COMPONENTS_AUDIOCOMPONENT_H
5#define TRAM_SDK_COMPONENTS_AUDIOCOMPONENT_H
6
9
10#include <audio/sound.h>
11
12namespace tram {
13
15public:
18 void Start();
20 void SetSound(name_t name);
21 void SetRepeating(bool is_repeating);
22 bool IsPlaying();
23 void Play();
24 void Pause();
25 void Stop();
26
27 void EventHandler(Event &event){}
28protected:
31 vec3 location = {0.0f, 0.0f, 0.0f};
32 bool repeat = false;
33 bool play_on_start = false;
34};
35
36}
37
38#endif // TRAM_SDK_COMPONENTS_AUDIOCOMPONENT_H
Definition: audio.h:14
void Start()
Definition: audio.cpp:20
~AudioComponent()
Definition: audio.cpp:13
bool IsPlaying()
Checks if component is playing a sound.
Definition: audio.cpp:93
vec3 location
Definition: audio.h:31
void Play()
Plays the sound.
Definition: audio.cpp:65
void Stop()
Stops the sound.
Definition: audio.cpp:83
void SetSound(name_t name)
Sets the sound that the component will play.
Definition: audio.cpp:41
void SetRepeating(bool is_repeating)
Sets whether the component will repeat its sound.
Definition: audio.cpp:55
ResourceProxy< Audio::Sound > sound
Definition: audio.h:29
bool repeat
Definition: audio.h:32
void EventHandler(Event &event)
Definition: audio.h:27
Audio::audiosource_t source
Definition: audio.h:30
void SetLocation(vec3 location)
Sets the location from which the sound will play.
Definition: audio.cpp:46
void Pause()
Pauses the sound.
Definition: audio.cpp:76
bool play_on_start
Definition: audio.h:33
AudioComponent()
Definition: audio.h:16
Definition: entitycomponent.h:18
Definition: resource.h:47
Definition: api.h:9
glm::vec3 vec3
Definition: math.h:12
Definition: audio.h:12
void * generic
Definition: audio.h:15
Definition: event.h:24
Definition: uid.h:11