aboutsummaryrefslogtreecommitdiffstats
path: root/alc/events.h
blob: 3b22a4c454736f04bf07bc504e8c0fa91feca7d1 (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
#ifndef ALC_EVENTS_H
#define ALC_EVENTS_H

#include "inprogext.h"
#include "opthelpers.h"

#include <bitset>
#include <mutex>
#include <string_view>


namespace alc {

enum class EventType : uint8_t {
    DefaultDeviceChanged,
    DeviceAdded,
    DeviceRemoved,

    Count
};

inline std::bitset<al::to_underlying(EventType::Count)> EventsEnabled{0};

inline std::mutex EventMutex;

inline ALCEVENTPROCTYPESOFT EventCallback{};
inline void *EventUserPtr{};

void Event(alc::EventType eventType, ALCdevice *device, std::string_view message) noexcept;

inline void Event(alc::EventType eventType, std::string_view message) noexcept
{ Event(eventType, nullptr, message); }

} // namespace alc

#endif /* ALC_EVENTS_H */