aboutsummaryrefslogtreecommitdiffstats
path: root/alc/events.h
diff options
context:
space:
mode:
Diffstat (limited to 'alc/events.h')
-rw-r--r--alc/events.h36
1 files changed, 36 insertions, 0 deletions
diff --git a/alc/events.h b/alc/events.h
new file mode 100644
index 00000000..51f32e57
--- /dev/null
+++ b/alc/events.h
@@ -0,0 +1,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(ALCenum eventType, ALCdevice *device, std::string_view message) noexcept;
+
+inline void Event(ALCenum eventType, std::string_view message) noexcept
+{ Event(eventType, nullptr, message); }
+
+} // namespace alc
+
+#endif /* ALC_EVENTS_H */