Use filebuf instead of ifstream in allafplay
[openal-soft.git] / alc / events.h
blob3f53ec76265be90edb00b4ac568c1578e68603e5
1 #ifndef ALC_EVENTS_H
2 #define ALC_EVENTS_H
4 #include "inprogext.h"
5 #include "opthelpers.h"
7 #include <bitset>
8 #include <mutex>
9 #include <optional>
10 #include <string_view>
13 namespace alc {
15 enum class EventType : uint8_t {
16 DefaultDeviceChanged,
17 DeviceAdded,
18 DeviceRemoved,
20 Count
23 std::optional<alc::EventType> GetEventType(ALCenum type);
25 enum class EventSupport : ALCenum {
26 FullSupport = ALC_EVENT_SUPPORTED_SOFT,
27 NoSupport = ALC_EVENT_NOT_SUPPORTED_SOFT,
30 enum class DeviceType : ALCenum {
31 Playback = ALC_PLAYBACK_DEVICE_SOFT,
32 Capture = ALC_CAPTURE_DEVICE_SOFT,
35 using EventBitSet = std::bitset<al::to_underlying(EventType::Count)>;
36 inline EventBitSet EventsEnabled{0};
38 inline std::mutex EventMutex;
40 inline ALCEVENTPROCTYPESOFT EventCallback{};
41 inline void *EventUserPtr{};
43 void Event(EventType eventType, DeviceType deviceType, ALCdevice *device, std::string_view message) noexcept;
45 inline void Event(EventType eventType, DeviceType deviceType, std::string_view message) noexcept
46 { Event(eventType, deviceType, nullptr, message); }
48 } // namespace alc
50 #endif /* ALC_EVENTS_H */