Crimson Engine
1.0.0
A high-performance C++20 game engine prototype showcasing a custom ECS, Vulkan renderer, and ImGui editor.
Toggle main menu visibility
Loading...
Searching...
No Matches
AudioSource.hpp
Go to the documentation of this file.
1
#pragma once
2
#include <string>
3
#include <glm/glm.hpp>
4
#include "
core/EngineAPI.hpp
"
5
#include "
meta/ComponentReflection.hpp
"
6
7
12
// [ReflectClass]
13
struct
ENGINE_API
AudioSourceComponent
{
15
// [ReflectField]
16
std::string
clipPath
=
""
;
18
// [ReflectField]
19
float
volume
= 1.0f;
21
// [ReflectField]
22
float
pitch
= 1.0f;
24
// [ReflectField]
25
bool
loop
=
false
;
27
// [ReflectField]
28
bool
playOnAwake
=
true
;
30
// [ReflectField]
31
bool
spatialized
=
true
;
33
// [ReflectField]
34
float
minDistance
= 1.0f;
36
// [ReflectField]
37
float
maxDistance
= 50.0f;
38
39
41
bool
isPlaying
=
false
;
43
bool
wasPlaying
=
false
;
45
void
*
internalSound
=
nullptr
;
47
std::string
currentLoadedPath
=
""
;
48
};
49
50
51
REGISTER_COMPONENT
(
AudioSourceComponent
,
"Audio/Audio Source"
);
52
53
54
55
56
57
58
59
ComponentReflection.hpp
REGISTER_COMPONENT
#define REGISTER_COMPONENT(Type, MenuPath)
Definition
ComponentReflection.hpp:156
EngineAPI.hpp
ENGINE_API
#define ENGINE_API
Definition
EngineAPI.hpp:10
AudioSourceComponent
Component to emit 2D or spatialized 3D sounds.
Definition
AudioSource.hpp:13
AudioSourceComponent::isPlaying
bool isPlaying
Active playback state flag.
Definition
AudioSource.hpp:41
AudioSourceComponent::wasPlaying
bool wasPlaying
Previous frame playback state flag.
Definition
AudioSource.hpp:43
AudioSourceComponent::internalSound
void * internalSound
Opaque handle pointer to miniaudio sound object (ma_sound*).
Definition
AudioSource.hpp:45
AudioSourceComponent::minDistance
float minDistance
Distance at which volume starts attenuating.
Definition
AudioSource.hpp:34
AudioSourceComponent::playOnAwake
bool playOnAwake
Automatically start audio playback when scene initializes.
Definition
AudioSource.hpp:28
AudioSourceComponent::loop
bool loop
Whether sound loops continuously when playback completes.
Definition
AudioSource.hpp:25
AudioSourceComponent::pitch
float pitch
Playback pitch/frequency multiplier.
Definition
AudioSource.hpp:22
AudioSourceComponent::currentLoadedPath
std::string currentLoadedPath
Currently loaded audio file path.
Definition
AudioSource.hpp:47
AudioSourceComponent::clipPath
std::string clipPath
Path to the audio sound clip file (e.g. .wav, .mp3, .flac).
Definition
AudioSource.hpp:16
AudioSourceComponent::spatialized
bool spatialized
Enable 3D spatial attenuation and directional panning.
Definition
AudioSource.hpp:31
AudioSourceComponent::maxDistance
float maxDistance
Maximum distance beyond which sound is silent.
Definition
AudioSource.hpp:37
AudioSourceComponent::volume
float volume
Playback volume multiplier (0.0 to 1.0+).
Definition
AudioSource.hpp:19
engine
include
ecs
components
AudioSource.hpp
Generated by
1.17.0