aboutsummaryrefslogtreecommitdiffstats
path: root/alc/async_event.h
blob: 1ee58b105f8e28bb0b6df3516a257f1dde2a5450 (plain)
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
#ifndef ALC_EVENT_H
#define ALC_EVENT_H

#include "almalloc.h"

struct EffectState;
enum class VChangeState;

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 {
    uint EnumType{0u};
    union {
        char dummy;
        struct {
            uint id;
            VChangeState 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