1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
|
#ifndef CORE_EVENT_H
#define CORE_EVENT_H
#include <stdint.h>
#include <variant>
#include "almalloc.h"
struct EffectState;
using uint = unsigned int;
enum class AsyncEnableBits : uint8_t {
SourceState,
BufferCompleted,
Disconnected,
Count
};
enum class AsyncSrcState : uint8_t {
Reset,
Stop,
Play,
Pause
};
using AsyncKillThread = std::monostate;
struct AsyncSourceStateEvent {
uint mId;
AsyncSrcState mState;
};
struct AsyncBufferCompleteEvent {
uint mId;
uint mCount;
};
struct AsyncDisconnectEvent {
char msg[244];
};
struct AsyncEffectReleaseEvent {
EffectState *mEffectState;
};
using AsyncEvent = std::variant<AsyncKillThread,
AsyncSourceStateEvent,
AsyncBufferCompleteEvent,
AsyncEffectReleaseEvent,
AsyncDisconnectEvent>;
template<typename T, typename ...Args>
auto &InitAsyncEvent(AsyncEvent *evt, Args&& ...args)
{ return std::get<T>(*al::construct_at(evt, std::in_place_type<T>, std::forward<Args>(args)...)); }
#endif
|