Fix lambda callback parameter type
[openal-soft.git] / router / al.cpp
blob57c8d17977dccb0b00c37b6778bc538af1bbd271
2 #include "config.h"
4 #include <cstddef>
6 #include "AL/al.h"
7 #include "router.h"
10 #define DECL_THUNK1(R,n,T1) \
11 AL_API auto AL_APIENTRY n(T1 a) noexcept -> R \
12 { \
13 DriverIface *iface = GetThreadDriver(); \
14 if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
15 return iface->n(a); \
17 #define DECL_THUNK2(R,n,T1,T2) \
18 AL_API auto AL_APIENTRY n(T1 a, T2 b) noexcept -> R \
19 { \
20 DriverIface *iface = GetThreadDriver(); \
21 if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
22 return iface->n(a, b); \
24 #define DECL_THUNK3(R,n,T1,T2,T3) \
25 AL_API auto AL_APIENTRY n(T1 a, T2 b, T3 c) noexcept -> R \
26 { \
27 DriverIface *iface = GetThreadDriver(); \
28 if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
29 return iface->n(a, b, c); \
31 #define DECL_THUNK4(R,n,T1,T2,T3,T4) \
32 AL_API auto AL_APIENTRY n(T1 a, T2 b, T3 c, T4 d) noexcept -> R \
33 { \
34 DriverIface *iface = GetThreadDriver(); \
35 if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
36 return iface->n(a, b, c, d); \
38 #define DECL_THUNK5(R,n,T1,T2,T3,T4,T5) \
39 AL_API auto AL_APIENTRY n(T1 a, T2 b, T3 c, T4 d, T5 e) noexcept -> R \
40 { \
41 DriverIface *iface = GetThreadDriver(); \
42 if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
43 return iface->n(a, b, c, d, e); \
47 /* Ugly hack for some apps calling alGetError without a current context, and
48 * expecting it to be AL_NO_ERROR.
50 AL_API auto AL_APIENTRY alGetError() noexcept -> ALenum
52 DriverIface *iface = GetThreadDriver();
53 if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire);
54 return iface ? iface->alGetError() : AL_NO_ERROR;
58 DECL_THUNK1(void, alDopplerFactor, ALfloat)
59 DECL_THUNK1(void, alDopplerVelocity, ALfloat)
60 DECL_THUNK1(void, alSpeedOfSound, ALfloat)
61 DECL_THUNK1(void, alDistanceModel, ALenum)
63 DECL_THUNK1(void, alEnable, ALenum)
64 DECL_THUNK1(void, alDisable, ALenum)
65 DECL_THUNK1(ALboolean, alIsEnabled, ALenum)
67 DECL_THUNK1(const ALchar*, alGetString, ALenum)
68 DECL_THUNK2(void, alGetBooleanv, ALenum, ALboolean*)
69 DECL_THUNK2(void, alGetIntegerv, ALenum, ALint*)
70 DECL_THUNK2(void, alGetFloatv, ALenum, ALfloat*)
71 DECL_THUNK2(void, alGetDoublev, ALenum, ALdouble*)
72 DECL_THUNK1(ALboolean, alGetBoolean, ALenum)
73 DECL_THUNK1(ALint, alGetInteger, ALenum)
74 DECL_THUNK1(ALfloat, alGetFloat, ALenum)
75 DECL_THUNK1(ALdouble, alGetDouble, ALenum)
77 DECL_THUNK1(ALboolean, alIsExtensionPresent, const ALchar*)
78 DECL_THUNK1(void*, alGetProcAddress, const ALchar*)
79 DECL_THUNK1(ALenum, alGetEnumValue, const ALchar*)
81 DECL_THUNK2(void, alListenerf, ALenum, ALfloat)
82 DECL_THUNK4(void, alListener3f, ALenum, ALfloat, ALfloat, ALfloat)
83 DECL_THUNK2(void, alListenerfv, ALenum, const ALfloat*)
84 DECL_THUNK2(void, alListeneri, ALenum, ALint)
85 DECL_THUNK4(void, alListener3i, ALenum, ALint, ALint, ALint)
86 DECL_THUNK2(void, alListeneriv, ALenum, const ALint*)
87 DECL_THUNK2(void, alGetListenerf, ALenum, ALfloat*)
88 DECL_THUNK4(void, alGetListener3f, ALenum, ALfloat*, ALfloat*, ALfloat*)
89 DECL_THUNK2(void, alGetListenerfv, ALenum, ALfloat*)
90 DECL_THUNK2(void, alGetListeneri, ALenum, ALint*)
91 DECL_THUNK4(void, alGetListener3i, ALenum, ALint*, ALint*, ALint*)
92 DECL_THUNK2(void, alGetListeneriv, ALenum, ALint*)
94 DECL_THUNK2(void, alGenSources, ALsizei, ALuint*)
95 DECL_THUNK2(void, alDeleteSources, ALsizei, const ALuint*)
96 DECL_THUNK1(ALboolean, alIsSource, ALuint)
97 DECL_THUNK3(void, alSourcef, ALuint, ALenum, ALfloat)
98 DECL_THUNK5(void, alSource3f, ALuint, ALenum, ALfloat, ALfloat, ALfloat)
99 DECL_THUNK3(void, alSourcefv, ALuint, ALenum, const ALfloat*)
100 DECL_THUNK3(void, alSourcei, ALuint, ALenum, ALint)
101 DECL_THUNK5(void, alSource3i, ALuint, ALenum, ALint, ALint, ALint)
102 DECL_THUNK3(void, alSourceiv, ALuint, ALenum, const ALint*)
103 DECL_THUNK3(void, alGetSourcef, ALuint, ALenum, ALfloat*)
104 DECL_THUNK5(void, alGetSource3f, ALuint, ALenum, ALfloat*, ALfloat*, ALfloat*)
105 DECL_THUNK3(void, alGetSourcefv, ALuint, ALenum, ALfloat*)
106 DECL_THUNK3(void, alGetSourcei, ALuint, ALenum, ALint*)
107 DECL_THUNK5(void, alGetSource3i, ALuint, ALenum, ALint*, ALint*, ALint*)
108 DECL_THUNK3(void, alGetSourceiv, ALuint, ALenum, ALint*)
109 DECL_THUNK2(void, alSourcePlayv, ALsizei, const ALuint*)
110 DECL_THUNK2(void, alSourceStopv, ALsizei, const ALuint*)
111 DECL_THUNK2(void, alSourceRewindv, ALsizei, const ALuint*)
112 DECL_THUNK2(void, alSourcePausev, ALsizei, const ALuint*)
113 DECL_THUNK1(void, alSourcePlay, ALuint)
114 DECL_THUNK1(void, alSourceStop, ALuint)
115 DECL_THUNK1(void, alSourceRewind, ALuint)
116 DECL_THUNK1(void, alSourcePause, ALuint)
117 DECL_THUNK3(void, alSourceQueueBuffers, ALuint, ALsizei, const ALuint*)
118 DECL_THUNK3(void, alSourceUnqueueBuffers, ALuint, ALsizei, ALuint*)
120 DECL_THUNK2(void, alGenBuffers, ALsizei, ALuint*)
121 DECL_THUNK2(void, alDeleteBuffers, ALsizei, const ALuint*)
122 DECL_THUNK1(ALboolean, alIsBuffer, ALuint)
123 DECL_THUNK3(void, alBufferf, ALuint, ALenum, ALfloat)
124 DECL_THUNK5(void, alBuffer3f, ALuint, ALenum, ALfloat, ALfloat, ALfloat)
125 DECL_THUNK3(void, alBufferfv, ALuint, ALenum, const ALfloat*)
126 DECL_THUNK3(void, alBufferi, ALuint, ALenum, ALint)
127 DECL_THUNK5(void, alBuffer3i, ALuint, ALenum, ALint, ALint, ALint)
128 DECL_THUNK3(void, alBufferiv, ALuint, ALenum, const ALint*)
129 DECL_THUNK3(void, alGetBufferf, ALuint, ALenum, ALfloat*)
130 DECL_THUNK5(void, alGetBuffer3f, ALuint, ALenum, ALfloat*, ALfloat*, ALfloat*)
131 DECL_THUNK3(void, alGetBufferfv, ALuint, ALenum, ALfloat*)
132 DECL_THUNK3(void, alGetBufferi, ALuint, ALenum, ALint*)
133 DECL_THUNK5(void, alGetBuffer3i, ALuint, ALenum, ALint*, ALint*, ALint*)
134 DECL_THUNK3(void, alGetBufferiv, ALuint, ALenum, ALint*)
135 DECL_THUNK5(void, alBufferData, ALuint, ALenum, const ALvoid*, ALsizei, ALsizei)
137 /* EFX 1.0. Required here to be exported from libOpenAL32.dll.a/OpenAL32.lib
138 * with the router enabled.
140 DECL_THUNK2(void, alGenFilters, ALsizei, ALuint*)
141 DECL_THUNK2(void, alDeleteFilters, ALsizei, const ALuint*)
142 DECL_THUNK1(ALboolean, alIsFilter, ALuint)
143 DECL_THUNK3(void, alFilterf, ALuint, ALenum, ALfloat)
144 DECL_THUNK3(void, alFilterfv, ALuint, ALenum, const ALfloat*)
145 DECL_THUNK3(void, alFilteri, ALuint, ALenum, ALint)
146 DECL_THUNK3(void, alFilteriv, ALuint, ALenum, const ALint*)
147 DECL_THUNK3(void, alGetFilterf, ALuint, ALenum, ALfloat*)
148 DECL_THUNK3(void, alGetFilterfv, ALuint, ALenum, ALfloat*)
149 DECL_THUNK3(void, alGetFilteri, ALuint, ALenum, ALint*)
150 DECL_THUNK3(void, alGetFilteriv, ALuint, ALenum, ALint*)
152 DECL_THUNK2(void, alGenEffects, ALsizei, ALuint*)
153 DECL_THUNK2(void, alDeleteEffects, ALsizei, const ALuint*)
154 DECL_THUNK1(ALboolean, alIsEffect, ALuint)
155 DECL_THUNK3(void, alEffectf, ALuint, ALenum, ALfloat)
156 DECL_THUNK3(void, alEffectfv, ALuint, ALenum, const ALfloat*)
157 DECL_THUNK3(void, alEffecti, ALuint, ALenum, ALint)
158 DECL_THUNK3(void, alEffectiv, ALuint, ALenum, const ALint*)
159 DECL_THUNK3(void, alGetEffectf, ALuint, ALenum, ALfloat*)
160 DECL_THUNK3(void, alGetEffectfv, ALuint, ALenum, ALfloat*)
161 DECL_THUNK3(void, alGetEffecti, ALuint, ALenum, ALint*)
162 DECL_THUNK3(void, alGetEffectiv, ALuint, ALenum, ALint*)
164 DECL_THUNK2(void, alGenAuxiliaryEffectSlots, ALsizei, ALuint*)
165 DECL_THUNK2(void, alDeleteAuxiliaryEffectSlots, ALsizei, const ALuint*)
166 DECL_THUNK1(ALboolean, alIsAuxiliaryEffectSlot, ALuint)
167 DECL_THUNK3(void, alAuxiliaryEffectSlotf, ALuint, ALenum, ALfloat)
168 DECL_THUNK3(void, alAuxiliaryEffectSlotfv, ALuint, ALenum, const ALfloat*)
169 DECL_THUNK3(void, alAuxiliaryEffectSloti, ALuint, ALenum, ALint)
170 DECL_THUNK3(void, alAuxiliaryEffectSlotiv, ALuint, ALenum, const ALint*)
171 DECL_THUNK3(void, alGetAuxiliaryEffectSlotf, ALuint, ALenum, ALfloat*)
172 DECL_THUNK3(void, alGetAuxiliaryEffectSlotfv, ALuint, ALenum, ALfloat*)
173 DECL_THUNK3(void, alGetAuxiliaryEffectSloti, ALuint, ALenum, ALint*)
174 DECL_THUNK3(void, alGetAuxiliaryEffectSlotiv, ALuint, ALenum, ALint*)