aboutsummaryrefslogtreecommitdiffstats
path: root/core/async_event.h
blob: 5a2f5f91acb0c071719d2cabfd22967406d5a844 (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
50
51
52
53
54
55
#ifndef CORE_EVENT_H
#define CORE_EVENT_H

#include "almalloc.h"

struct EffectState;

using uint = unsigned int;


struct AsyncEvent {
    enum : uint {
        /* User event types. */
        SourceStateChange,
        BufferCompleted,
        Disconnected,
        UserEventCount,

        /* Internal events, always processed. */
        ReleaseEffectState = 128,

        /* End event thread processing. */
        KillThread,
    };

    enum class SrcState {
        Reset,
        Stop,
        Play,
        Pause
    };

    const uint EnumType;
    union {
        char dummy;
        struct {
            uint id;
            SrcState state;
        } srcstate;
        struct {
            uint id;
            uint count;
        } bufcomp;
        struct {
            char msg[244];
        } disconnect;
        EffectState *mEffectState;
    } u{};

    constexpr AsyncEvent(uint type) noexcept : EnumType{type} { }

    DISABLE_ALLOC()
};

#endif