Tramway SDK
audio.h
Go to the documentation of this file.
1// Tramway Drifting and Dungeon Exploration Simulator SDK Runtime
2
3#ifndef TRAM_SDK_COMPONENTS_AUDIOCOMPONENT_H
4#define TRAM_SDK_COMPONENTS_AUDIOCOMPONENT_H
5
8
9#include <components/render.h>
10
11#include <audio/sound.h>
12
13namespace tram {
14
15class RenderComponent;
16
18public:
21 void Start();
23 void SetSound(name_t name);
24 void SetRepeating(bool is_repeating);
25 bool IsPlaying();
26 void Play();
27 void Pause();
28 void Stop();
29
30 void EventHandler(Event &event){}
31
32 static bool IsSourceDraw();
33 static bool IsDebugInfoDraw();
34
35 static void SetSourceDraw(bool);
36 static void SetDebugInfoDraw(bool);
37protected:
40 vec3 location = {0.0f, 0.0f, 0.0f};
41 bool repeat = false;
42 bool play_on_start = false;
43
44 void SetupModel();
46};
47
48}
49
50#endif // TRAM_SDK_COMPONENTS_AUDIOCOMPONENT_H
Sound resource definition.
Plays back Sounds.
Definition: audio.h:17
static void SetSourceDraw(bool)
Sets the drawing of audio sources.
Definition: audio.cpp:165
static void SetDebugInfoDraw(bool)
Sets the drawing of debug info.
Definition: audio.cpp:177
void Start()
Definition: audio.cpp:49
~AudioComponent()
Definition: audio.cpp:42
bool IsPlaying()
Checks if component is playing a sound.
Definition: audio.cpp:128
vec3 location
Definition: audio.h:40
void Play()
Plays the sound.
Definition: audio.cpp:100
void Stop()
Stops the sound.
Definition: audio.cpp:118
void SetSound(name_t name)
Sets the sound that the component will play.
Definition: audio.cpp:72
static bool IsDebugInfoDraw()
Checks whether the debug text is drawn.
Definition: audio.cpp:158
static bool IsSourceDraw()
Checks whether the audio source is drawn.
Definition: audio.cpp:152
void SetRepeating(bool is_repeating)
Sets whether the component will repeat its sound.
Definition: audio.cpp:90
ResourceProxy< Audio::Sound > sound
Definition: audio.h:38
void SetupModel()
Definition: audio.cpp:137
bool repeat
Definition: audio.h:41
void EventHandler(Event &event)
Definition: audio.h:30
Component< RenderComponent > model
Definition: audio.h:45
Audio::audiosource_t source
Definition: audio.h:39
void SetLocation(vec3 location)
Sets the location from which the sound will play.
Definition: audio.cpp:77
void Pause()
Pauses the sound.
Definition: audio.cpp:111
bool play_on_start
Definition: audio.h:42
AudioComponent()
Definition: audio.h:19
Wrapper for an EntityComponent pointer.
Definition: entitycomponent.h:51
Component base class.
Definition: entitycomponent.h:16
Definition: resource.h:46
Serialization, i.e.
glm::vec3 vec3
Definition: math.h:11
Audio source handle.
Definition: audio.h:18
Event data.
Definition: event.h:24
Interned string type.
Definition: uid.h:10