2021-05-14 10:15:42 +08:00
|
|
|
#ifndef CORE_EVENT_H
|
|
|
|
#define CORE_EVENT_H
|
|
|
|
|
|
|
|
#include "almalloc.h"
|
|
|
|
|
|
|
|
struct EffectState;
|
|
|
|
|
|
|
|
using uint = unsigned int;
|
|
|
|
|
|
|
|
|
2022-04-25 12:02:45 +08:00
|
|
|
struct AsyncEvent {
|
|
|
|
enum : uint {
|
|
|
|
/* End event thread processing. */
|
|
|
|
KillThread = 0,
|
2021-05-14 10:15:42 +08:00
|
|
|
|
2022-04-25 12:02:45 +08:00
|
|
|
/* User event types. */
|
|
|
|
SourceStateChange = 1<<0,
|
|
|
|
BufferCompleted = 1<<1,
|
|
|
|
Disconnected = 1<<2,
|
2021-05-14 10:15:42 +08:00
|
|
|
|
2022-04-25 12:02:45 +08:00
|
|
|
/* Internal events. */
|
|
|
|
ReleaseEffectState = 65536,
|
|
|
|
};
|
2021-05-14 10:15:42 +08:00
|
|
|
|
|
|
|
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
|