aboutsummaryrefslogtreecommitdiffstats
path: root/core/async_event.h
diff options
context:
space:
mode:
authorChris Robinson <[email protected]>2021-04-25 14:29:21 -0700
committerChris Robinson <[email protected]>2021-04-25 14:29:21 -0700
commit8d09d03ed363ab1735b1933588d8242ba85ddf10 (patch)
tree515b4149211d29b04f7076ee943bed6bb62d0a90 /core/async_event.h
parent0fe38c053d8dd827e774fbe0aef121e7aa0a0f28 (diff)
Move async_event.h to core
Diffstat (limited to 'core/async_event.h')
-rw-r--r--core/async_event.h55
1 files changed, 55 insertions, 0 deletions
diff --git a/core/async_event.h b/core/async_event.h
new file mode 100644
index 00000000..054f0563
--- /dev/null
+++ b/core/async_event.h
@@ -0,0 +1,55 @@
+#ifndef CORE_EVENT_H
+#define CORE_EVENT_H
+
+#include "almalloc.h"
+
+struct EffectState;
+
+using uint = unsigned int;
+
+
+enum {
+ /* End event thread processing. */
+ EventType_KillThread = 0,
+
+ /* User event types. */
+ EventType_SourceStateChange = 1<<0,
+ EventType_BufferCompleted = 1<<1,
+ EventType_Disconnected = 1<<2,
+
+ /* Internal events. */
+ EventType_ReleaseEffectState = 65536,
+};
+
+struct AsyncEvent {
+ enum class SrcState {
+ Reset,
+ Stop,
+ Play,
+ Pause
+ };
+
+ uint EnumType{0u};
+ union {
+ char dummy;
+ struct {
+ uint id;
+ SrcState state;
+ } srcstate;
+ struct {
+ uint id;
+ uint count;
+ } bufcomp;
+ struct {
+ char msg[244];
+ } disconnect;
+ EffectState *mEffectState;
+ } u{};
+
+ AsyncEvent() noexcept = default;
+ constexpr AsyncEvent(uint type) noexcept : EnumType{type} { }
+
+ DISABLE_ALLOC()
+};
+
+#endif