Fix compilation with newer versions of DUMB
[alure.git] / src / device.h
blob640d1a0299d44c514b07e39a7ac629c1eef3fce9
1 #ifndef DEVICE_H
2 #define DEVICE_H
4 #include <mutex>
6 #include "main.h"
9 namespace alure {
11 enum class ALC {
12 ENUMERATE_ALL_EXT,
13 EXT_EFX,
14 EXT_thread_local_context,
15 SOFT_HRTF,
16 SOFT_pause_device,
18 EXTENSION_MAX
21 class DeviceImpl {
22 ALCdevice *mDevice{nullptr};
24 std::chrono::nanoseconds mTimeBase, mPauseTime;
25 bool mIsPaused{false};
27 Vector<UniquePtr<ContextImpl>> mContexts;
29 Bitfield<static_cast<size_t>(ALC::EXTENSION_MAX)> mHasExt;
31 std::once_flag mSetExts;
32 void setupExts();
34 public:
35 DeviceImpl(const char *name);
36 ~DeviceImpl();
38 ALCdevice *getALCdevice() const { return mDevice; }
40 bool hasExtension(ALC ext) const { return mHasExt[static_cast<size_t>(ext)]; }
42 LPALCDEVICEPAUSESOFT alcDevicePauseSOFT{nullptr};
43 LPALCDEVICERESUMESOFT alcDeviceResumeSOFT{nullptr};
45 LPALCGETSTRINGISOFT alcGetStringiSOFT{nullptr};
46 LPALCRESETDEVICESOFT alcResetDeviceSOFT{nullptr};
48 void removeContext(ContextImpl *ctx);
50 String getName(PlaybackName type) const;
51 bool queryExtension(const char *name) const;
53 Version getALCVersion() const;
54 Version getEFXVersion() const;
56 ALCuint getFrequency() const;
58 ALCuint getMaxAuxiliarySends() const;
60 Vector<String> enumerateHRTFNames() const;
61 bool isHRTFEnabled() const;
62 String getCurrentHRTF() const;
63 void reset(ArrayView<AttributePair> attributes);
65 Context createContext(ArrayView<AttributePair> attributes);
67 void pauseDSP();
68 void resumeDSP();
70 std::chrono::nanoseconds getClockTime();
72 void close();
75 } // namespace alure
77 #endif /* DEVICE_H */