Accumulate delays as samples before calculating nanoseconds
[openal-soft.git] / al / event.h
blob44d9306ff502cf2eece5b68447f2b7225f9f83e0
1 #ifndef AL_EVENT_H
2 #define AL_EVENT_H
4 #include "AL/al.h"
5 #include "AL/alc.h"
7 #include "almalloc.h"
9 struct EffectState;
12 enum {
13 /* End event thread processing. */
14 EventType_KillThread = 0,
16 /* User event types. */
17 EventType_SourceStateChange = 1<<0,
18 EventType_BufferCompleted = 1<<1,
19 EventType_Error = 1<<2,
20 EventType_Performance = 1<<3,
21 EventType_Deprecated = 1<<4,
22 EventType_Disconnected = 1<<5,
24 /* Internal events. */
25 EventType_ReleaseEffectState = 65536,
28 struct AsyncEvent {
29 unsigned int EnumType{0u};
30 union {
31 char dummy;
32 struct {
33 ALuint id;
34 ALenum state;
35 } srcstate;
36 struct {
37 ALuint id;
38 ALuint count;
39 } bufcomp;
40 struct {
41 ALenum type;
42 ALuint id;
43 ALuint param;
44 ALchar msg[232];
45 } user;
46 EffectState *mEffectState;
47 } u{};
49 AsyncEvent() noexcept = default;
50 constexpr AsyncEvent(unsigned int type) noexcept : EnumType{type} { }
52 DISABLE_ALLOC()
56 void StartEventThrd(ALCcontext *ctx);
57 void StopEventThrd(ALCcontext *ctx);
59 #endif