10 std::atomic
<DriverIface
*> CurrentCtxDriver
{nullptr};
12 #define DECL_THUNK1(R,n,T1) AL_API R AL_APIENTRY n(T1 a) \
14 DriverIface *iface = ThreadCtxDriver; \
15 if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
18 #define DECL_THUNK2(R,n,T1,T2) AL_API R AL_APIENTRY n(T1 a, T2 b) \
20 DriverIface *iface = ThreadCtxDriver; \
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) AL_API R AL_APIENTRY n(T1 a, T2 b, T3 c) \
26 DriverIface *iface = ThreadCtxDriver; \
27 if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
28 return iface->n(a, b, c); \
30 #define DECL_THUNK4(R,n,T1,T2,T3,T4) AL_API R AL_APIENTRY n(T1 a, T2 b, T3 c, T4 d) \
32 DriverIface *iface = ThreadCtxDriver; \
33 if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
34 return iface->n(a, b, c, d); \
36 #define DECL_THUNK5(R,n,T1,T2,T3,T4,T5) AL_API R AL_APIENTRY n(T1 a, T2 b, T3 c, T4 d, T5 e) \
38 DriverIface *iface = ThreadCtxDriver; \
39 if(!iface) iface = CurrentCtxDriver.load(std::memory_order_acquire); \
40 return iface->n(a, b, c, d, e); \
44 /* Ugly hack for some apps calling alGetError without a current context, and
45 * expecting it to be AL_NO_ERROR.
47 AL_API ALenum AL_APIENTRY
alGetError(void)
49 DriverIface
*iface
= ThreadCtxDriver
;
50 if(!iface
) iface
= CurrentCtxDriver
.load(std::memory_order_acquire
);
51 return iface
? iface
->alGetError() : AL_NO_ERROR
;
55 DECL_THUNK1(void, alDopplerFactor
, ALfloat
)
56 DECL_THUNK1(void, alDopplerVelocity
, ALfloat
)
57 DECL_THUNK1(void, alSpeedOfSound
, ALfloat
)
58 DECL_THUNK1(void, alDistanceModel
, ALenum
)
60 DECL_THUNK1(void, alEnable
, ALenum
)
61 DECL_THUNK1(void, alDisable
, ALenum
)
62 DECL_THUNK1(ALboolean
, alIsEnabled
, ALenum
)
64 DECL_THUNK1(const ALchar
*, alGetString
, ALenum
)
65 DECL_THUNK2(void, alGetBooleanv
, ALenum
, ALboolean
*)
66 DECL_THUNK2(void, alGetIntegerv
, ALenum
, ALint
*)
67 DECL_THUNK2(void, alGetFloatv
, ALenum
, ALfloat
*)
68 DECL_THUNK2(void, alGetDoublev
, ALenum
, ALdouble
*)
69 DECL_THUNK1(ALboolean
, alGetBoolean
, ALenum
)
70 DECL_THUNK1(ALint
, alGetInteger
, ALenum
)
71 DECL_THUNK1(ALfloat
, alGetFloat
, ALenum
)
72 DECL_THUNK1(ALdouble
, alGetDouble
, ALenum
)
74 DECL_THUNK1(ALboolean
, alIsExtensionPresent
, const ALchar
*)
75 DECL_THUNK1(void*, alGetProcAddress
, const ALchar
*)
76 DECL_THUNK1(ALenum
, alGetEnumValue
, const ALchar
*)
78 DECL_THUNK2(void, alListenerf
, ALenum
, ALfloat
)
79 DECL_THUNK4(void, alListener3f
, ALenum
, ALfloat
, ALfloat
, ALfloat
)
80 DECL_THUNK2(void, alListenerfv
, ALenum
, const ALfloat
*)
81 DECL_THUNK2(void, alListeneri
, ALenum
, ALint
)
82 DECL_THUNK4(void, alListener3i
, ALenum
, ALint
, ALint
, ALint
)
83 DECL_THUNK2(void, alListeneriv
, ALenum
, const ALint
*)
84 DECL_THUNK2(void, alGetListenerf
, ALenum
, ALfloat
*)
85 DECL_THUNK4(void, alGetListener3f
, ALenum
, ALfloat
*, ALfloat
*, ALfloat
*)
86 DECL_THUNK2(void, alGetListenerfv
, ALenum
, ALfloat
*)
87 DECL_THUNK2(void, alGetListeneri
, ALenum
, ALint
*)
88 DECL_THUNK4(void, alGetListener3i
, ALenum
, ALint
*, ALint
*, ALint
*)
89 DECL_THUNK2(void, alGetListeneriv
, ALenum
, ALint
*)
91 DECL_THUNK2(void, alGenSources
, ALsizei
, ALuint
*)
92 DECL_THUNK2(void, alDeleteSources
, ALsizei
, const ALuint
*)
93 DECL_THUNK1(ALboolean
, alIsSource
, ALuint
)
94 DECL_THUNK3(void, alSourcef
, ALuint
, ALenum
, ALfloat
)
95 DECL_THUNK5(void, alSource3f
, ALuint
, ALenum
, ALfloat
, ALfloat
, ALfloat
)
96 DECL_THUNK3(void, alSourcefv
, ALuint
, ALenum
, const ALfloat
*)
97 DECL_THUNK3(void, alSourcei
, ALuint
, ALenum
, ALint
)
98 DECL_THUNK5(void, alSource3i
, ALuint
, ALenum
, ALint
, ALint
, ALint
)
99 DECL_THUNK3(void, alSourceiv
, ALuint
, ALenum
, const ALint
*)
100 DECL_THUNK3(void, alGetSourcef
, ALuint
, ALenum
, ALfloat
*)
101 DECL_THUNK5(void, alGetSource3f
, ALuint
, ALenum
, ALfloat
*, ALfloat
*, ALfloat
*)
102 DECL_THUNK3(void, alGetSourcefv
, ALuint
, ALenum
, ALfloat
*)
103 DECL_THUNK3(void, alGetSourcei
, ALuint
, ALenum
, ALint
*)
104 DECL_THUNK5(void, alGetSource3i
, ALuint
, ALenum
, ALint
*, ALint
*, ALint
*)
105 DECL_THUNK3(void, alGetSourceiv
, ALuint
, ALenum
, ALint
*)
106 DECL_THUNK2(void, alSourcePlayv
, ALsizei
, const ALuint
*)
107 DECL_THUNK2(void, alSourceStopv
, ALsizei
, const ALuint
*)
108 DECL_THUNK2(void, alSourceRewindv
, ALsizei
, const ALuint
*)
109 DECL_THUNK2(void, alSourcePausev
, ALsizei
, const ALuint
*)
110 DECL_THUNK1(void, alSourcePlay
, ALuint
)
111 DECL_THUNK1(void, alSourceStop
, ALuint
)
112 DECL_THUNK1(void, alSourceRewind
, ALuint
)
113 DECL_THUNK1(void, alSourcePause
, ALuint
)
114 DECL_THUNK3(void, alSourceQueueBuffers
, ALuint
, ALsizei
, const ALuint
*)
115 DECL_THUNK3(void, alSourceUnqueueBuffers
, ALuint
, ALsizei
, ALuint
*)
117 DECL_THUNK2(void, alGenBuffers
, ALsizei
, ALuint
*)
118 DECL_THUNK2(void, alDeleteBuffers
, ALsizei
, const ALuint
*)
119 DECL_THUNK1(ALboolean
, alIsBuffer
, ALuint
)
120 DECL_THUNK3(void, alBufferf
, ALuint
, ALenum
, ALfloat
)
121 DECL_THUNK5(void, alBuffer3f
, ALuint
, ALenum
, ALfloat
, ALfloat
, ALfloat
)
122 DECL_THUNK3(void, alBufferfv
, ALuint
, ALenum
, const ALfloat
*)
123 DECL_THUNK3(void, alBufferi
, ALuint
, ALenum
, ALint
)
124 DECL_THUNK5(void, alBuffer3i
, ALuint
, ALenum
, ALint
, ALint
, ALint
)
125 DECL_THUNK3(void, alBufferiv
, ALuint
, ALenum
, const ALint
*)
126 DECL_THUNK3(void, alGetBufferf
, ALuint
, ALenum
, ALfloat
*)
127 DECL_THUNK5(void, alGetBuffer3f
, ALuint
, ALenum
, ALfloat
*, ALfloat
*, ALfloat
*)
128 DECL_THUNK3(void, alGetBufferfv
, ALuint
, ALenum
, ALfloat
*)
129 DECL_THUNK3(void, alGetBufferi
, ALuint
, ALenum
, ALint
*)
130 DECL_THUNK5(void, alGetBuffer3i
, ALuint
, ALenum
, ALint
*, ALint
*, ALint
*)
131 DECL_THUNK3(void, alGetBufferiv
, ALuint
, ALenum
, ALint
*)
132 DECL_THUNK5(void, alBufferData
, ALuint
, ALenum
, const ALvoid
*, ALsizei
, ALsizei
)
134 DECL_THUNK2(void, alGenFilters
, ALsizei
, ALuint
*)
135 DECL_THUNK2(void, alDeleteFilters
, ALsizei
, const ALuint
*)
136 DECL_THUNK1(ALboolean
, alIsFilter
, ALuint
)
137 DECL_THUNK3(void, alFilterf
, ALuint
, ALenum
, ALfloat
)
138 DECL_THUNK3(void, alFilterfv
, ALuint
, ALenum
, const ALfloat
*)
139 DECL_THUNK3(void, alFilteri
, ALuint
, ALenum
, ALint
)
140 DECL_THUNK3(void, alFilteriv
, ALuint
, ALenum
, const ALint
*)
141 DECL_THUNK3(void, alGetFilterf
, ALuint
, ALenum
, ALfloat
*)
142 DECL_THUNK3(void, alGetFilterfv
, ALuint
, ALenum
, ALfloat
*)
143 DECL_THUNK3(void, alGetFilteri
, ALuint
, ALenum
, ALint
*)
144 DECL_THUNK3(void, alGetFilteriv
, ALuint
, ALenum
, ALint
*)
146 DECL_THUNK2(void, alGenEffects
, ALsizei
, ALuint
*)
147 DECL_THUNK2(void, alDeleteEffects
, ALsizei
, const ALuint
*)
148 DECL_THUNK1(ALboolean
, alIsEffect
, ALuint
)
149 DECL_THUNK3(void, alEffectf
, ALuint
, ALenum
, ALfloat
)
150 DECL_THUNK3(void, alEffectfv
, ALuint
, ALenum
, const ALfloat
*)
151 DECL_THUNK3(void, alEffecti
, ALuint
, ALenum
, ALint
)
152 DECL_THUNK3(void, alEffectiv
, ALuint
, ALenum
, const ALint
*)
153 DECL_THUNK3(void, alGetEffectf
, ALuint
, ALenum
, ALfloat
*)
154 DECL_THUNK3(void, alGetEffectfv
, ALuint
, ALenum
, ALfloat
*)
155 DECL_THUNK3(void, alGetEffecti
, ALuint
, ALenum
, ALint
*)
156 DECL_THUNK3(void, alGetEffectiv
, ALuint
, ALenum
, ALint
*)
158 DECL_THUNK2(void, alGenAuxiliaryEffectSlots
, ALsizei
, ALuint
*)
159 DECL_THUNK2(void, alDeleteAuxiliaryEffectSlots
, ALsizei
, const ALuint
*)
160 DECL_THUNK1(ALboolean
, alIsAuxiliaryEffectSlot
, ALuint
)
161 DECL_THUNK3(void, alAuxiliaryEffectSlotf
, ALuint
, ALenum
, ALfloat
)
162 DECL_THUNK3(void, alAuxiliaryEffectSlotfv
, ALuint
, ALenum
, const ALfloat
*)
163 DECL_THUNK3(void, alAuxiliaryEffectSloti
, ALuint
, ALenum
, ALint
)
164 DECL_THUNK3(void, alAuxiliaryEffectSlotiv
, ALuint
, ALenum
, const ALint
*)
165 DECL_THUNK3(void, alGetAuxiliaryEffectSlotf
, ALuint
, ALenum
, ALfloat
*)
166 DECL_THUNK3(void, alGetAuxiliaryEffectSlotfv
, ALuint
, ALenum
, ALfloat
*)
167 DECL_THUNK3(void, alGetAuxiliaryEffectSloti
, ALuint
, ALenum
, ALint
*)
168 DECL_THUNK3(void, alGetAuxiliaryEffectSlotiv
, ALuint
, ALenum
, ALint
*)