2 * Copyright 2009 Maarten Lankhorst
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Lesser General Public
6 * License as published by the Free Software Foundation; either
7 * version 2.1 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Lesser General Public License for more details.
14 * You should have received a copy of the GNU Lesser General Public
15 * License along with this library; if not, write to the Free Software
16 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
19 #ifndef __WINE_CONFIG_H
20 # error You must include config.h to use this header
23 extern HRESULT
MMDevEnum_Create(REFIID riid
, void **ppv
);
24 extern void MMDevEnum_Free(void);
26 extern HRESULT
MMDevice_GetPropValue(const GUID
*devguid
, DWORD flow
, REFPROPERTYKEY key
, PROPVARIANT
*pv
);
27 extern HRESULT
MMDevice_SetPropValue(const GUID
*devguid
, DWORD flow
, REFPROPERTYKEY key
, REFPROPVARIANT pv
);
29 typedef struct MMDevice
{
30 const IMMDeviceVtbl
*lpVtbl
;
31 const IMMEndpointVtbl
*lpEndpointVtbl
;
34 CRITICAL_SECTION crst
;
46 /* All openal functions */
47 extern int openal_loaded
;
48 #ifdef SONAME_LIBOPENAL
49 extern LPALCCREATECONTEXT palcCreateContext
;
50 extern LPALCMAKECONTEXTCURRENT palcMakeContextCurrent
;
51 extern LPALCPROCESSCONTEXT palcProcessContext
;
52 extern LPALCSUSPENDCONTEXT palcSuspendContext
;
53 extern LPALCDESTROYCONTEXT palcDestroyContext
;
54 extern LPALCGETCURRENTCONTEXT palcGetCurrentContext
;
55 extern LPALCGETCONTEXTSDEVICE palcGetContextsDevice
;
56 extern LPALCOPENDEVICE palcOpenDevice
;
57 extern LPALCCLOSEDEVICE palcCloseDevice
;
58 extern LPALCGETERROR palcGetError
;
59 extern LPALCISEXTENSIONPRESENT palcIsExtensionPresent
;
60 extern LPALCGETPROCADDRESS palcGetProcAddress
;
61 extern LPALCGETENUMVALUE palcGetEnumValue
;
62 extern LPALCGETSTRING palcGetString
;
63 extern LPALCGETINTEGERV palcGetIntegerv
;
64 extern LPALCCAPTUREOPENDEVICE palcCaptureOpenDevice
;
65 extern LPALCCAPTURECLOSEDEVICE palcCaptureCloseDevice
;
66 extern LPALCCAPTURESTART palcCaptureStart
;
67 extern LPALCCAPTURESTOP palcCaptureStop
;
68 extern LPALCCAPTURESAMPLES palcCaptureSamples
;
69 extern LPALENABLE palEnable
;
70 extern LPALDISABLE palDisable
;
71 extern LPALISENABLED palIsEnabled
;
72 extern LPALGETSTRING palGetString
;
73 extern LPALGETBOOLEANV palGetBooleanv
;
74 extern LPALGETINTEGERV palGetIntegerv
;
75 extern LPALGETFLOATV palGetFloatv
;
76 extern LPALGETDOUBLEV palGetDoublev
;
77 extern LPALGETBOOLEAN palGetBoolean
;
78 extern LPALGETINTEGER palGetInteger
;
79 extern LPALGETFLOAT palGetFloat
;
80 extern LPALGETDOUBLE palGetDouble
;
81 extern LPALGETERROR palGetError
;
82 extern LPALISEXTENSIONPRESENT palIsExtensionPresent
;
83 extern LPALGETPROCADDRESS palGetProcAddress
;
84 extern LPALGETENUMVALUE palGetEnumValue
;
85 extern LPALLISTENERF palListenerf
;
86 extern LPALLISTENER3F palListener3f
;
87 extern LPALLISTENERFV palListenerfv
;
88 extern LPALLISTENERI palListeneri
;
89 extern LPALLISTENER3I palListener3i
;
90 extern LPALLISTENERIV palListeneriv
;
91 extern LPALGETLISTENERF palGetListenerf
;
92 extern LPALGETLISTENER3F palGetListener3f
;
93 extern LPALGETLISTENERFV palGetListenerfv
;
94 extern LPALGETLISTENERI palGetListeneri
;
95 extern LPALGETLISTENER3I palGetListener3i
;
96 extern LPALGETLISTENERIV palGetListeneriv
;
97 extern LPALGENSOURCES palGenSources
;
98 extern LPALDELETESOURCES palDeleteSources
;
99 extern LPALISSOURCE palIsSource
;
100 extern LPALSOURCEF palSourcef
;
101 extern LPALSOURCE3F palSource3f
;
102 extern LPALSOURCEFV palSourcefv
;
103 extern LPALSOURCEI palSourcei
;
104 extern LPALSOURCE3I palSource3i
;
105 extern LPALSOURCEIV palSourceiv
;
106 extern LPALGETSOURCEF palGetSourcef
;
107 extern LPALGETSOURCE3F palGetSource3f
;
108 extern LPALGETSOURCEFV palGetSourcefv
;
109 extern LPALGETSOURCEI palGetSourcei
;
110 extern LPALGETSOURCE3I palGetSource3i
;
111 extern LPALGETSOURCEIV palGetSourceiv
;
112 extern LPALSOURCEPLAYV palSourcePlayv
;
113 extern LPALSOURCESTOPV palSourceStopv
;
114 extern LPALSOURCEREWINDV palSourceRewindv
;
115 extern LPALSOURCEPAUSEV palSourcePausev
;
116 extern LPALSOURCEPLAY palSourcePlay
;
117 extern LPALSOURCESTOP palSourceStop
;
118 extern LPALSOURCEREWIND palSourceRewind
;
119 extern LPALSOURCEPAUSE palSourcePause
;
120 extern LPALSOURCEQUEUEBUFFERS palSourceQueueBuffers
;
121 extern LPALSOURCEUNQUEUEBUFFERS palSourceUnqueueBuffers
;
122 extern LPALGENBUFFERS palGenBuffers
;
123 extern LPALDELETEBUFFERS palDeleteBuffers
;
124 extern LPALISBUFFER palIsBuffer
;
125 extern LPALBUFFERF palBufferf
;
126 extern LPALBUFFER3F palBuffer3f
;
127 extern LPALBUFFERFV palBufferfv
;
128 extern LPALBUFFERI palBufferi
;
129 extern LPALBUFFER3I palBuffer3i
;
130 extern LPALBUFFERIV palBufferiv
;
131 extern LPALGETBUFFERF palGetBufferf
;
132 extern LPALGETBUFFER3F palGetBuffer3f
;
133 extern LPALGETBUFFERFV palGetBufferfv
;
134 extern LPALGETBUFFERI palGetBufferi
;
135 extern LPALGETBUFFER3I palGetBuffer3i
;
136 extern LPALGETBUFFERIV palGetBufferiv
;
137 extern LPALBUFFERDATA palBufferData
;
138 extern LPALDOPPLERFACTOR palDopplerFactor
;
139 extern LPALDOPPLERVELOCITY palDopplerVelocity
;
140 extern LPALDISTANCEMODEL palDistanceModel
;
141 extern LPALSPEEDOFSOUND palSpeedOfSound
;
143 #define palcCreateContext alcCreateContext
144 #define palcMakeContextCurrent alcMakeContextCurrent
145 #define palcProcessContext alcProcessContext
146 #define palcSuspendContext alcSuspendContext
147 #define palcDestroyContext alcDestroyContext
148 #define palcGetCurrentContext alcGetCurrentContext
149 #define palcGetContextsDevice alcGetContextsDevice
150 #define palcOpenDevice alcOpenDevice
151 #define palcCloseDevice alcCloseDevice
152 #define palcGetError alcGetError
153 #define palcIsExtensionPresent alcIsExtensionPresent
154 #define palcGetProcAddress alcGetProcAddress
155 #define palcGetEnumValue alcGetEnumValue
156 #define palcGetString alcGetString
157 #define palcGetIntegerv alcGetIntegerv
158 #define palcCaptureOpenDevice alcCaptureOpenDevice
159 #define palcCaptureCloseDevice alcCaptureCloseDevice
160 #define palcCaptureStart alcCaptureStart
161 #define palcCaptureStop alcCaptureStop
162 #define palcCaptureSamples alcCaptureSamples
163 #define palEnable alEnable
164 #define palDisable alDisable
165 #define palIsEnabled alIsEnabled
166 #define palGetString alGetString
167 #define palGetBooleanv alGetBooleanv
168 #define palGetIntegerv alGetIntegerv
169 #define palGetFloatv alGetFloatv
170 #define palGetDoublev alGetDoublev
171 #define palGetBoolean alGetBoolean
172 #define palGetInteger alGetInteger
173 #define palGetFloat alGetFloat
174 #define palGetDouble alGetDouble
175 #define palGetError alGetError
176 #define palIsExtensionPresent alIsExtensionPresent
177 #define palGetProcAddress alGetProcAddress
178 #define palGetEnumValue alGetEnumValue
179 #define palListenerf alListenerf
180 #define palListener3f alListener3f
181 #define palListenerfv alListenerfv
182 #define palListeneri alListeneri
183 #define palListener3i alListener3i
184 #define palListeneriv alListeneriv
185 #define palGetListenerf alGetListenerf
186 #define palGetListener3f alGetListener3f
187 #define palGetListenerfv alGetListenerfv
188 #define palGetListeneri alGetListeneri
189 #define palGetListener3i alGetListener3i
190 #define palGetListeneriv alGetListeneriv
191 #define palGenSources alGenSources
192 #define palDeleteSources alDeleteSources
193 #define palIsSource alIsSource
194 #define palSourcef alSourcef
195 #define palSource3f alSource3f
196 #define palSourcefv alSourcefv
197 #define palSourcei alSourcei
198 #define palSource3i alSource3i
199 #define palSourceiv alSourceiv
200 #define palGetSourcef alGetSourcef
201 #define palGetSource3f alGetSource3f
202 #define palGetSourcefv alGetSourcefv
203 #define palGetSourcei alGetSourcei
204 #define palGetSource3i alGetSource3i
205 #define palGetSourceiv alGetSourceiv
206 #define palSourcePlayv alSourcePlayv
207 #define palSourceStopv alSourceStopv
208 #define palSourceRewindv alSourceRewindv
209 #define palSourcePausev alSourcePausev
210 #define palSourcePlay alSourcePlay
211 #define palSourceStop alSourceStop
212 #define palSourceRewind alSourceRewind
213 #define palSourcePause alSourcePause
214 #define palSourceQueueBuffers alSourceQueueBuffers
215 #define palSourceUnqueueBuffers alSourceUnqueueBuffers
216 #define palGenBuffers alGenBuffers
217 #define palDeleteBuffers alDeleteBuffers
218 #define palIsBuffer alIsBuffer
219 #define palBufferf alBufferf
220 #define palBuffer3f alBuffer3f
221 #define palBufferfv alBufferfv
222 #define palBufferi alBufferi
223 #define palBuffer3i alBuffer3i
224 #define palBufferiv alBufferiv
225 #define palGetBufferf alGetBufferf
226 #define palGetBuffer3f alGetBuffer3f
227 #define palGetBufferfv alGetBufferfv
228 #define palGetBufferi alGetBufferi
229 #define palGetBuffer3i alGetBuffer3i
230 #define palGetBufferiv alGetBufferiv
231 #define palBufferData alBufferData
232 #define palDopplerFactor alDopplerFactor
233 #define palDopplerVelocity alDopplerVelocity
234 #define palDistanceModel alDistanceModel
235 #define palSpeedOfSound alSpeedOfSound
238 /* OpenAL only allows for 1 single access to the device at the same time */
239 extern CRITICAL_SECTION openal_crst
;
240 extern int local_contexts
;
241 extern typeof(alcGetCurrentContext
) *get_context
;
242 extern typeof(alcMakeContextCurrent
) *set_context
;
244 #define getALError() \
246 ALenum err = palGetError(); \
247 if(err != AL_NO_ERROR) \
249 ERR(">>>>>>>>>>>> Received AL error %#x on context %p, %s:%u\n", err, get_context(), __FUNCTION__, __LINE__); \
253 #define getALCError(dev) \
255 ALenum err = palcGetError(dev); \
256 if(err != ALC_NO_ERROR) \
258 ERR(">>>>>>>>>>>> Received ALC error %#x on device %p, %s:%u\n", err, dev, __FUNCTION__, __LINE__); \
262 #define setALContext(actx) \
264 ALCcontext *__old_ctx, *cur_ctx = actx ; \
265 if (!local_contexts) EnterCriticalSection(&openal_crst); \
266 __old_ctx = get_context(); \
267 if (__old_ctx != cur_ctx && set_context(cur_ctx) == ALC_FALSE) {\
268 ERR("Couldn't set current context!!\n"); \
269 getALCError(palcGetContextsDevice(cur_ctx)); \
272 /* Only restore a NULL context if using global contexts, for TLS contexts always restore */
273 #define popALContext() \
274 if (__old_ctx != cur_ctx \
275 && (local_contexts || __old_ctx) \
276 && set_context(__old_ctx) == ALC_FALSE) { \
277 ERR("Couldn't restore old context!!\n"); \
278 getALCError(palcGetContextsDevice(__old_ctx)); \
280 if (!local_contexts) LeaveCriticalSection(&openal_crst); \