From 8d09d03ed363ab1735b1933588d8242ba85ddf10 Mon Sep 17 00:00:00 2001 From: Chris Robinson Date: Sun, 25 Apr 2021 14:29:21 -0700 Subject: Move async_event.h to core --- core/async_event.h | 55 ++++++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 55 insertions(+) create mode 100644 core/async_event.h (limited to 'core/async_event.h') 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 -- cgit v1.2.3