VAE - Virtual Audio Engine 1
Small Data Driven Audio Engine
vae_event.hpp
Go to the documentation of this file.
1#ifndef _VAE_EVENT
2#define _VAE_EVENT
3
4#include "../vae_types.hpp"
5#include "../vae_config.hpp"
6#include "./vae_mixer.hpp"
7
8
9
10namespace vae { namespace core {
11 /**
12 * @brief An Event is used to control most of the eingines behavior.
13 */
14 struct Event {
15 enum class Action {
16 start = 0, ///< Starts a source if defined and every Event in chained_events
17 stop, ///< Stops a source if defined and stops every voice started from a event in chained_events
18 emit, ///< Emits an event to the EventCallback defined in the engine config
19 random ///< triggers one random chained_events event
20 } action : 3;
21 bool force_mixer : 1; ///< Prevents overriding the mixer from chained events or fireEvent
22 bool loop : 1; ///< gapless looping
23 bool HRTF : 1; ///< Listener and event has to have hrtf set
24 bool spatial : 1; ///< no spatial rendering at all
25 bool attenuate : 1; ///< whether distance is taken into consideration
26 bool critical : 1; ///< wheather the voice can be killer
27
28 MixerHandle mixer = Mixer::MasterMixerHandle; ///< Mixer the source gets written to
29 SourceHandle source = InvalidSourceHandle; ///< Handle to a source
31 Sample gain; ///< Volume applied to triggered voice
32 EventHandle chained_events[StaticConfig::MaxChainedEvents]; ///< Events called when the source starts playing
33 EventHandle on_end; ///< Event fired once the source is finished, not called when there's no source
34 NameString name; ///< Name for debugging
35
36 /**
37 * TODO this isn't exactly pod style but the arrays need to be
38 * initialized properly since 0 is a valid event handle
39 */
41 force_mixer = false;
42 loop = false;
43 HRTF = false;
44 spatial = true;
45 attenuate = true;
46 critical = false;
47 gain = 1.0;
48 for (auto& i : chained_events) { i = InvalidEventHandle; }
50 }
51 };
52
53 constexpr int _VAE_EVENT_SIZE = sizeof(Event);
54} } // namespace vae::vore
55
56#endif // _VAE_EVENT
constexpr Size MaxChainedEvents
How many chained events can fit in chain_events on the core::Event structure.
Definition: vae.hpp:302
constexpr int _VAE_EVENT_SIZE
Definition: vae_event.hpp:53
Contains Typedefinitions and basic structures use by the public API and internally.
Definition: vae.hpp:31
float Sample
Default sample types used where ever possible, changing this means the engine needs to be recompiled,...
Definition: vae.hpp:32
SmallHandle MixerHandle
Definition: vae.hpp:44
constexpr SourceHandle InvalidSourceHandle
Definition: vae.hpp:56
constexpr EventHandle InvalidEventHandle
Definition: vae.hpp:55
GenericHandle EventHandle
The handle used to address events within a bank.
Definition: vae.hpp:41
GenericHandle SourceHandle
Definition: vae.hpp:42
An Event is used to control most of the eingines behavior.
Definition: vae_event.hpp:14
bool loop
gapless looping
Definition: vae_event.hpp:22
EventHandle on_end
Event fired once the source is finished, not called when there's no source.
Definition: vae_event.hpp:33
SourceHandle source
Handle to a source.
Definition: vae_event.hpp:29
Sample gain
Volume applied to triggered voice.
Definition: vae_event.hpp:31
@ random
triggers one random chained_events event
@ emit
Emits an event to the EventCallback defined in the engine config.
@ start
Starts a source if defined and every Event in chained_events.
@ stop
Stops a source if defined and stops every voice started from a event in chained_events.
bool attenuate
whether distance is taken into consideration
Definition: vae_event.hpp:25
NameString name
Name for debugging.
Definition: vae_event.hpp:34
MixerHandle mixer
Mixer the source gets written to.
Definition: vae_event.hpp:28
bool force_mixer
Prevents overriding the mixer from chained events or fireEvent.
Definition: vae_event.hpp:21
enum vae::core::Event::Action action
Event()
TODO this isn't exactly pod style but the arrays need to be initialized properly since 0 is a valid e...
Definition: vae_event.hpp:40
bool HRTF
Listener and event has to have hrtf set.
Definition: vae_event.hpp:23
EventHandle chained_events[StaticConfig::MaxChainedEvents]
Events called when the source starts playing.
Definition: vae_event.hpp:32
bool critical
wheather the voice can be killer
Definition: vae_event.hpp:26
bool spatial
no spatial rendering at all
Definition: vae_event.hpp:24
static constexpr MixerHandle MasterMixerHandle
This is the master mixer for a bank.
Definition: vae_mixer.hpp:13