Use a separate function to remove a source from fading sources
[alure.git] / src / device.h
blob7f38af0762e77772c9ffe139abf25788ad27e69d
1 #ifndef DEVICE_H
2 #define DEVICE_H
4 #include "main.h"
6 #include <mutex>
8 #include "alc.h"
9 #include "alext.h"
12 namespace alure {
15 enum ALCExtension {
16 EXT_thread_local_context,
17 SOFT_device_pause,
18 SOFT_HRTF,
20 ALC_EXTENSION_MAX
23 class DeviceImpl {
24 ALCdevice *mDevice;
26 Vector<UniquePtr<ContextImpl>> mContexts;
28 bool mHasExt[ALC_EXTENSION_MAX];
30 std::once_flag mSetExts;
31 void setupExts();
33 public:
34 DeviceImpl(ALCdevice *device);
35 ~DeviceImpl();
37 ALCdevice *getDevice() const { return mDevice; }
39 bool hasExtension(ALCExtension ext) const { return mHasExt[ext]; }
41 LPALCDEVICEPAUSESOFT alcDevicePauseSOFT;
42 LPALCDEVICERESUMESOFT alcDeviceResumeSOFT;
44 LPALCGETSTRINGISOFT alcGetStringiSOFT;
45 LPALCRESETDEVICESOFT alcResetDeviceSOFT;
47 void removeContext(ContextImpl *ctx);
49 String getName(PlaybackName type) const;
50 bool queryExtension(const char *name) const;
52 Version getALCVersion() const;
53 Version getEFXVersion() const;
55 ALCuint getFrequency() const;
57 ALCuint getMaxAuxiliarySends() const;
59 Vector<String> enumerateHRTFNames() const;
60 bool isHRTFEnabled() const;
61 String getCurrentHRTF() const;
62 void reset(ArrayView<AttributePair> attributes);
64 Context createContext(ArrayView<AttributePair> attributes, bool dothrow);
66 void pauseDSP();
67 void resumeDSP();
69 void close();
72 } // namespace alure
74 #endif /* DEVICE_H */