vkmEngine 1.0.15
A C++ game engine · vkmengine.com
Loading...
Searching...
No Matches
audio_source.h
1#pragma once
2
3#include "core/reflect.h"
4
5#include "resource/asset/audio_clip_asset.h"
6
7namespace Vkm::Engine {
8
12enum class AudioRolloff {
13 Linear = 0,
14 Inverse = 1,
15 Count
16};
17
27 AudioClipHandle clip;
28
29 float volume = 1.0f;
30 float pitch = 1.0f;
31 bool loop = false;
32
36 bool spatial = true;
37
44 bool playOnStart = true;
45
49 float minDistance = 1.0f;
50
56 float maxDistance = 50.0f;
57
58 AudioRolloff rolloff = AudioRolloff::Linear;
59
65 int priority = 0;
66
67 bool playing = false;
68 bool started = false;
69};
70
71} // namespace Vkm::Engine
72
73VKM_ENUM_NAMES(::Vkm::Engine::AudioRolloff, "Linear", "Inverse")
74
75VKM_REFLECT_BEGIN(::Vkm::Engine::AudioSource)
76 VKM_F(clip)
77 VKM_F(volume)
78 VKM_F(pitch)
79 VKM_F(loop)
80 VKM_F(spatial)
81 VKM_F(playOnStart)
82 VKM_F(minDistance)
83 VKM_F(maxDistance)
84 VKM_F(rolloff)
85 VKM_F(priority)
86VKM_REFLECT_END()
A sound emitter: one clip, how loud, and where it is heard from.
Definition audio_source.h:26
bool started
Whether playOnStart has been honoured; session state.
Definition audio_source.h:68
AudioRolloff rolloff
How it fades between the two distances.
Definition audio_source.h:58
bool spatial
Whether the source is positioned in the world or mixed flat at constant volume.
Definition audio_source.h:36
int priority
Which voice gives way when too many sounds play (AudioDevice::play).
Definition audio_source.h:65
bool playOnStart
Start playing on the first frame the simulation runs.
Definition audio_source.h:44
float volume
Linear gain, multiplied into the listener's own.
Definition audio_source.h:29
float maxDistance
Distance at which the source is inaudible.
Definition audio_source.h:56
bool playing
Session state.
Definition audio_source.h:67
bool loop
Restart at the end instead of finishing.
Definition audio_source.h:31
float pitch
Playback rate multiplier; also shifts the pitch. Must be > 0.
Definition audio_source.h:30
float minDistance
Radius inside which the source is at full volume: the size of the emitter.
Definition audio_source.h:49