Add methods to lookup cached buffers without loading them
[alure.git] / src / device.h
blob9d5058774c0f4f32f64567cedf8a45c4296fd88e
1 #ifndef DEVICE_H
2 #define DEVICE_H
4 #include "main.h"
6 #include <mutex>
9 namespace alure {
11 enum class ALC {
12 ENUMERATE_ALL_EXT,
13 EXT_EFX,
14 EXT_thread_local_context,
15 SOFT_device_pause,
16 SOFT_HRTF,
18 EXTENSION_MAX
21 class DeviceImpl {
22 ALCdevice *mDevice;
24 Vector<UniquePtr<ContextImpl>> mContexts;
26 Bitfield<static_cast<size_t>(ALC::EXTENSION_MAX)> mHasExt;
28 std::once_flag mSetExts;
29 void setupExts();
31 public:
32 DeviceImpl(ALCdevice *device);
33 ~DeviceImpl();
35 ALCdevice *getALCdevice() const { return mDevice; }
37 bool hasExtension(ALC ext) const { return mHasExt[static_cast<size_t>(ext)]; }
39 LPALCDEVICEPAUSESOFT alcDevicePauseSOFT;
40 LPALCDEVICERESUMESOFT alcDeviceResumeSOFT;
42 LPALCGETSTRINGISOFT alcGetStringiSOFT;
43 LPALCRESETDEVICESOFT alcResetDeviceSOFT;
45 void removeContext(ContextImpl *ctx);
47 String getName(PlaybackName type) const;
48 bool queryExtension(const char *name) const;
50 Version getALCVersion() const;
51 Version getEFXVersion() const;
53 ALCuint getFrequency() const;
55 ALCuint getMaxAuxiliarySends() const;
57 Vector<String> enumerateHRTFNames() const;
58 bool isHRTFEnabled() const;
59 String getCurrentHRTF() const;
60 void reset(ArrayView<AttributePair> attributes);
62 Context createContext(ArrayView<AttributePair> attributes, bool dothrow);
64 void pauseDSP();
65 void resumeDSP();
67 void close();
70 } // namespace alure
72 #endif /* DEVICE_H */