Minor variable cleanup for the examples
[alure.git] / src / device.h
blob596b0ac468420e76062633dff06b50f049f6fcf5
1 #ifndef DEVICE_H
2 #define DEVICE_H
4 #include "main.h"
6 #include <map>
7 #include <mutex>
9 #include "alc.h"
10 #include "alext.h"
13 namespace alure {
15 class ALContext;
16 class ALBuffer;
19 enum ALCExtension {
20 EXT_thread_local_context,
21 SOFT_device_pause,
22 SOFT_HRTF,
24 ALC_EXTENSION_MAX
27 class ALDevice {
28 ALCdevice *mDevice;
30 Vector<UniquePtr<ALContext>> mContexts;
32 bool mHasExt[ALC_EXTENSION_MAX];
34 std::once_flag mSetExts;
35 void setupExts();
37 public:
38 ALDevice(ALCdevice *device);
39 ~ALDevice();
41 ALCdevice *getDevice() const { return mDevice; }
43 bool hasExtension(ALCExtension ext) const { return mHasExt[ext]; }
45 LPALCDEVICEPAUSESOFT alcDevicePauseSOFT;
46 LPALCDEVICERESUMESOFT alcDeviceResumeSOFT;
48 LPALCGETSTRINGISOFT alcGetStringiSOFT;
49 LPALCRESETDEVICESOFT alcResetDeviceSOFT;
51 void removeContext(ALContext *ctx);
53 String getName(PlaybackDeviceName type) const;
54 bool queryExtension(const String &name) const;
56 ALCuint getALCVersion() const;
57 ALCuint getEFXVersion() const;
59 ALCuint getFrequency() const;
61 ALCuint getMaxAuxiliarySends() const;
63 Vector<String> enumerateHRTFNames() const;
64 bool isHRTFEnabled() const;
65 String getCurrentHRTF() const;
66 void reset(ArrayView<AttributePair> attributes);
68 Context createContext(ArrayView<AttributePair> attributes);
70 void pauseDSP();
71 void resumeDSP();
73 void close();
76 } // namespace alure
78 #endif /* DEVICE_H */