Constify the format when unlocking
[wine/multimedia.git] / dsound_private.h
blobb33a06a4649284d6c1951ca0ce0fa5c809057cfe
1 /* DirectSound
3 * Copyright 1998 Marcus Meissner
4 * Copyright 1998 Rob Riggs
5 * Copyright 2000-2001 TransGaming Technologies, Inc.
7 * This library is free software; you can redistribute it and/or
8 * modify it under the terms of the GNU Lesser General Public
9 * License as published by the Free Software Foundation; either
10 * version 2.1 of the License, or (at your option) any later version.
12 * This library is distributed in the hope that it will be useful,
13 * but WITHOUT ANY WARRANTY; without even the implied warranty of
14 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
15 * Lesser General Public License for more details.
17 * You should have received a copy of the GNU Lesser General Public
18 * License along with this library; if not, write to the Free Software
19 * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA
22 /* Linux does not support better timing than 10ms */
23 #define DS_TIME_RES 2 /* Resolution of multimedia timer */
24 #define DS_TIME_DEL 10 /* Delay of multimedia timer callback, and duration of HEL fragment */
25 /* Default refresh count, can be overridden */
26 #define FAKE_REFRESH_COUNT (1000/DS_TIME_DEL/2)
29 #ifdef __WINESRC__
31 #ifdef __APPLE__
32 #include <OpenAL/al.h>
33 #include <OpenAL/alc.h>
34 #else
35 #include <AL/al.h>
36 #include <AL/alc.h>
37 #endif
39 #else
41 #include <al.h>
42 #include <alc.h>
44 #include <stdio.h>
46 extern int LogLevel;
48 #ifdef DEBUG_INFO
49 #define TRACE(fmt,args...) do { \
50 if(LogLevel >= 3) \
51 fprintf(stderr, "%04x:trace:dsound:%s " fmt, (UINT)GetCurrentThreadId(), __FUNCTION__, ##args); \
52 } while(0)
53 #define WARN(fmt,args...) do { \
54 if(LogLevel >= 2) \
55 fprintf(stderr, "%04x:warn:dsound:%s " fmt, (UINT)GetCurrentThreadId(), __FUNCTION__, ##args); \
56 } while(0)
57 #define FIXME(fmt,args...) do { \
58 if(LogLevel >= 1) \
59 fprintf(stderr, "%04x:fixme:dsound:%s " fmt, (UINT)GetCurrentThreadId(), __FUNCTION__, ##args); \
60 } while(0)
61 #define ERR(fmt,args...) do { \
62 if(LogLevel >= 0) \
63 fprintf(stderr, "%04x:err:dsound:%s " fmt, (UINT)GetCurrentThreadId(), __FUNCTION__, ##args); \
64 } while(0)
65 #else
66 #define TRACE(args...)
67 #define WARN(args...)
68 #define FIXME(args...)
69 #define ERR(args...)
70 #endif
72 const char *wine_dbg_sprintf( const char *format, ... );
73 const char *wine_dbgstr_wn( const WCHAR *str, int n );
75 static inline const char *debugstr_guid( const GUID *id )
77 if (!id) return "(null)";
78 if (!((ULONG_PTR)id >> 16)) return wine_dbg_sprintf( "<guid-0x%04hx>", (WORD)(ULONG_PTR)id );
79 return wine_dbg_sprintf( "{%08x-%04x-%04x-%02x%02x-%02x%02x%02x%02x%02x%02x}",
80 id->Data1, id->Data2, id->Data3,
81 id->Data4[0], id->Data4[1], id->Data4[2], id->Data4[3],
82 id->Data4[4], id->Data4[5], id->Data4[6], id->Data4[7] );
85 static inline const char *debugstr_w( const WCHAR *s ) { return wine_dbgstr_wn( s, -1 ); }
87 #endif
90 #include "alext.h"
91 #include "eax.h"
93 /* Set to 1 to build a DLL that can be used in an app that uses OpenAL itself.
94 * Thread-local contexts are needed for true concurrency, however. Disallowing
95 * concurrency can avoid a save and restore of the context. */
96 #define ALLOW_CONCURRENT_AL 0
98 /* All openal functions */
99 extern int openal_loaded;
100 #ifdef SONAME_LIBOPENAL
101 extern LPALCCREATECONTEXT palcCreateContext;
102 extern LPALCMAKECONTEXTCURRENT palcMakeContextCurrent;
103 extern LPALCPROCESSCONTEXT palcProcessContext;
104 extern LPALCSUSPENDCONTEXT palcSuspendContext;
105 extern LPALCDESTROYCONTEXT palcDestroyContext;
106 extern LPALCGETCURRENTCONTEXT palcGetCurrentContext;
107 extern LPALCGETCONTEXTSDEVICE palcGetContextsDevice;
108 extern LPALCOPENDEVICE palcOpenDevice;
109 extern LPALCCLOSEDEVICE palcCloseDevice;
110 extern LPALCGETERROR palcGetError;
111 extern LPALCISEXTENSIONPRESENT palcIsExtensionPresent;
112 extern LPALCGETPROCADDRESS palcGetProcAddress;
113 extern LPALCGETENUMVALUE palcGetEnumValue;
114 extern LPALCGETSTRING palcGetString;
115 extern LPALCGETINTEGERV palcGetIntegerv;
116 extern LPALCCAPTUREOPENDEVICE palcCaptureOpenDevice;
117 extern LPALCCAPTURECLOSEDEVICE palcCaptureCloseDevice;
118 extern LPALCCAPTURESTART palcCaptureStart;
119 extern LPALCCAPTURESTOP palcCaptureStop;
120 extern LPALCCAPTURESAMPLES palcCaptureSamples;
121 extern LPALENABLE palEnable;
122 extern LPALDISABLE palDisable;
123 extern LPALISENABLED palIsEnabled;
124 extern LPALGETSTRING palGetString;
125 extern LPALGETBOOLEANV palGetBooleanv;
126 extern LPALGETINTEGERV palGetIntegerv;
127 extern LPALGETFLOATV palGetFloatv;
128 extern LPALGETDOUBLEV palGetDoublev;
129 extern LPALGETBOOLEAN palGetBoolean;
130 extern LPALGETINTEGER palGetInteger;
131 extern LPALGETFLOAT palGetFloat;
132 extern LPALGETDOUBLE palGetDouble;
133 extern LPALGETERROR palGetError;
134 extern LPALISEXTENSIONPRESENT palIsExtensionPresent;
135 extern LPALGETPROCADDRESS palGetProcAddress;
136 extern LPALGETENUMVALUE palGetEnumValue;
137 extern LPALLISTENERF palListenerf;
138 extern LPALLISTENER3F palListener3f;
139 extern LPALLISTENERFV palListenerfv;
140 extern LPALLISTENERI palListeneri;
141 extern LPALLISTENER3I palListener3i;
142 extern LPALLISTENERIV palListeneriv;
143 extern LPALGETLISTENERF palGetListenerf;
144 extern LPALGETLISTENER3F palGetListener3f;
145 extern LPALGETLISTENERFV palGetListenerfv;
146 extern LPALGETLISTENERI palGetListeneri;
147 extern LPALGETLISTENER3I palGetListener3i;
148 extern LPALGETLISTENERIV palGetListeneriv;
149 extern LPALGENSOURCES palGenSources;
150 extern LPALDELETESOURCES palDeleteSources;
151 extern LPALISSOURCE palIsSource;
152 extern LPALSOURCEF palSourcef;
153 extern LPALSOURCE3F palSource3f;
154 extern LPALSOURCEFV palSourcefv;
155 extern LPALSOURCEI palSourcei;
156 extern LPALSOURCE3I palSource3i;
157 extern LPALSOURCEIV palSourceiv;
158 extern LPALGETSOURCEF palGetSourcef;
159 extern LPALGETSOURCE3F palGetSource3f;
160 extern LPALGETSOURCEFV palGetSourcefv;
161 extern LPALGETSOURCEI palGetSourcei;
162 extern LPALGETSOURCE3I palGetSource3i;
163 extern LPALGETSOURCEIV palGetSourceiv;
164 extern LPALSOURCEPLAYV palSourcePlayv;
165 extern LPALSOURCESTOPV palSourceStopv;
166 extern LPALSOURCEREWINDV palSourceRewindv;
167 extern LPALSOURCEPAUSEV palSourcePausev;
168 extern LPALSOURCEPLAY palSourcePlay;
169 extern LPALSOURCESTOP palSourceStop;
170 extern LPALSOURCEREWIND palSourceRewind;
171 extern LPALSOURCEPAUSE palSourcePause;
172 extern LPALSOURCEQUEUEBUFFERS palSourceQueueBuffers;
173 extern LPALSOURCEUNQUEUEBUFFERS palSourceUnqueueBuffers;
174 extern LPALGENBUFFERS palGenBuffers;
175 extern LPALDELETEBUFFERS palDeleteBuffers;
176 extern LPALISBUFFER palIsBuffer;
177 extern LPALBUFFERF palBufferf;
178 extern LPALBUFFER3F palBuffer3f;
179 extern LPALBUFFERFV palBufferfv;
180 extern LPALBUFFERI palBufferi;
181 extern LPALBUFFER3I palBuffer3i;
182 extern LPALBUFFERIV palBufferiv;
183 extern LPALGETBUFFERF palGetBufferf;
184 extern LPALGETBUFFER3F palGetBuffer3f;
185 extern LPALGETBUFFERFV palGetBufferfv;
186 extern LPALGETBUFFERI palGetBufferi;
187 extern LPALGETBUFFER3I palGetBuffer3i;
188 extern LPALGETBUFFERIV palGetBufferiv;
189 extern LPALBUFFERDATA palBufferData;
190 extern LPALDOPPLERFACTOR palDopplerFactor;
191 extern LPALDOPPLERVELOCITY palDopplerVelocity;
192 extern LPALDISTANCEMODEL palDistanceModel;
193 extern LPALSPEEDOFSOUND palSpeedOfSound;
195 #define alcCreateContext palcCreateContext
196 #define alcMakeContextCurrent palcMakeContextCurrent
197 #define alcProcessContext palcProcessContext
198 #define alcSuspendContext palcSuspendContext
199 #define alcDestroyContext palcDestroyContext
200 #define alcGetCurrentContext palcGetCurrentContext
201 #define alcGetContextsDevice palcGetContextsDevice
202 #define alcOpenDevice palcOpenDevice
203 #define alcCloseDevice palcCloseDevice
204 #define alcGetError palcGetError
205 #define alcIsExtensionPresent palcIsExtensionPresent
206 #define alcGetProcAddress palcGetProcAddress
207 #define alcGetEnumValue palcGetEnumValue
208 #define alcGetString palcGetString
209 #define alcGetIntegerv palcGetIntegerv
210 #define alcCaptureOpenDevice palcCaptureOpenDevice
211 #define alcCaptureCloseDevice palcCaptureCloseDevice
212 #define alcCaptureStart palcCaptureStart
213 #define alcCaptureStop palcCaptureStop
214 #define alcCaptureSamples palcCaptureSamples
215 #define alEnable palEnable
216 #define alDisable palDisable
217 #define alIsEnabled palIsEnabled
218 #define alGetString palGetString
219 #define alGetBooleanv palGetBooleanv
220 #define alGetIntegerv palGetIntegerv
221 #define alGetFloatv palGetFloatv
222 #define alGetDoublev palGetDoublev
223 #define alGetBoolean palGetBoolean
224 #define alGetInteger palGetInteger
225 #define alGetFloat palGetFloat
226 #define alGetDouble palGetDouble
227 #define alGetError palGetError
228 #define alIsExtensionPresent palIsExtensionPresent
229 #define alGetProcAddress palGetProcAddress
230 #define alGetEnumValue palGetEnumValue
231 #define alListenerf palListenerf
232 #define alListener3f palListener3f
233 #define alListenerfv palListenerfv
234 #define alListeneri palListeneri
235 #define alListener3i palListener3i
236 #define alListeneriv palListeneriv
237 #define alGetListenerf palGetListenerf
238 #define alGetListener3f palGetListener3f
239 #define alGetListenerfv palGetListenerfv
240 #define alGetListeneri palGetListeneri
241 #define alGetListener3i palGetListener3i
242 #define alGetListeneriv palGetListeneriv
243 #define alGenSources palGenSources
244 #define alDeleteSources palDeleteSources
245 #define alIsSource palIsSource
246 #define alSourcef palSourcef
247 #define alSource3f palSource3f
248 #define alSourcefv palSourcefv
249 #define alSourcei palSourcei
250 #define alSource3i palSource3i
251 #define alSourceiv palSourceiv
252 #define alGetSourcef palGetSourcef
253 #define alGetSource3f palGetSource3f
254 #define alGetSourcefv palGetSourcefv
255 #define alGetSourcei palGetSourcei
256 #define alGetSource3i palGetSource3i
257 #define alGetSourceiv palGetSourceiv
258 #define alSourcePlayv palSourcePlayv
259 #define alSourceStopv palSourceStopv
260 #define alSourceRewindv palSourceRewindv
261 #define alSourcePausev palSourcePausev
262 #define alSourcePlay palSourcePlay
263 #define alSourceStop palSourceStop
264 #define alSourceRewind palSourceRewind
265 #define alSourcePause palSourcePause
266 #define alSourceQueueBuffers palSourceQueueBuffers
267 #define alSourceUnqueueBuffers palSourceUnqueueBuffers
268 #define alGenBuffers palGenBuffers
269 #define alDeleteBuffers palDeleteBuffers
270 #define alIsBuffer palIsBuffer
271 #define alBufferf palBufferf
272 #define alBuffer3f palBuffer3f
273 #define alBufferfv palBufferfv
274 #define alBufferi palBufferi
275 #define alBuffer3i palBuffer3i
276 #define alBufferiv palBufferiv
277 #define alGetBufferf palGetBufferf
278 #define alGetBuffer3f palGetBuffer3f
279 #define alGetBufferfv palGetBufferfv
280 #define alGetBufferi palGetBufferi
281 #define alGetBuffer3i palGetBuffer3i
282 #define alGetBufferiv palGetBufferiv
283 #define alBufferData palBufferData
284 #define alDopplerFactor palDopplerFactor
285 #define alDopplerVelocity palDopplerVelocity
286 #define alDistanceModel palDistanceModel
287 #define alSpeedOfSound palSpeedOfSound
288 #endif
290 #include <math.h>
291 #include "wingdi.h"
292 #include "mmreg.h"
294 /* OpenAL only allows for 1 single access to the device at the same time */
295 extern CRITICAL_SECTION openal_crst;
297 extern const ALCchar *DSOUND_getdevicestrings(void);
298 extern const ALCchar *DSOUND_getcapturedevicestrings(void);
300 extern LPALCMAKECONTEXTCURRENT set_context;
301 extern LPALCGETCURRENTCONTEXT get_context;
302 extern BOOL local_contexts;
304 /* Device implementation */
305 typedef struct DS8Primary DS8Primary;
306 typedef struct DS8Buffer DS8Buffer;
308 typedef struct DS8Impl
310 IDirectSound8 IDirectSound8_iface;
312 LONG ref;
313 BOOL is_8;
315 LONG *deviceref;
316 ALCdevice *device;
317 DS8Primary *primary;
319 DWORD speaker_config;
320 DWORD prio_level;
321 GUID guid;
322 } DS8Impl;
324 /* Sample types */
325 #define AL_BYTE 0x1400
326 #define AL_UNSIGNED_BYTE 0x1401
327 #define AL_SHORT 0x1402
328 #define AL_UNSIGNED_SHORT 0x1403
329 #define AL_INT 0x1404
330 #define AL_UNSIGNED_INT 0x1405
331 #define AL_FLOAT 0x1406
332 #define AL_DOUBLE 0x1407
333 #define AL_BYTE3 0x1408
334 #define AL_UNSIGNED_BYTE3 0x1409
335 #define AL_MULAW 0x1410
336 #define AL_IMA4 0x1411
338 /* Channel configurations */
339 #define AL_MONO 0x1500
340 #define AL_STEREO 0x1501
341 #define AL_REAR 0x1502
342 #define AL_QUAD 0x1503
343 #define AL_5POINT1 0x1504 /* (WFX order) */
344 #define AL_6POINT1 0x1505 /* (WFX order) */
345 #define AL_7POINT1 0x1506 /* (WFX order) */
347 /* Storage formats */
348 #define AL_MONO8 0x1100
349 #define AL_MONO16 0x1101
350 #define AL_MONO32F 0x10010
351 #define AL_STEREO8 0x1102
352 #define AL_STEREO16 0x1103
353 #define AL_STEREO32F 0x10011
354 #define AL_QUAD8 0x1204
355 #define AL_QUAD16 0x1205
356 #define AL_QUAD32F 0x1206
357 #define AL_REAR8 0x1207
358 #define AL_REAR16 0x1208
359 #define AL_REAR32F 0x1209
360 #define AL_5POINT1_8 0x120A
361 #define AL_5POINT1_16 0x120B
362 #define AL_5POINT1_32F 0x120C
363 #define AL_6POINT1_8 0x120D
364 #define AL_6POINT1_16 0x120E
365 #define AL_6POINT1_32F 0x120F
366 #define AL_7POINT1_8 0x1210
367 #define AL_7POINT1_16 0x1211
368 #define AL_7POINT1_32F 0x1212
370 enum {
371 EXT_EFX,
372 EXT_FLOAT32,
373 EXT_MCFORMATS,
374 EXT_STATIC_BUFFER,
375 SOFT_BUFFER_SAMPLES,
376 SOFT_BUFFER_SUB_DATA,
377 SOFT_DEFERRED_UPDATES,
379 MAX_EXTENSIONS
382 typedef struct ExtALFuncs
384 PFNALBUFFERSUBDATASOFTPROC BufferSubData;
385 PFNALBUFFERDATASTATICPROC BufferDataStatic;
387 LPALGENEFFECTS GenEffects;
388 LPALDELETEEFFECTS DeleteEffects;
389 LPALEFFECTI Effecti;
390 LPALEFFECTF Effectf;
392 LPALGENAUXILIARYEFFECTSLOTS GenAuxiliaryEffectSlots;
393 LPALDELETEAUXILIARYEFFECTSLOTS DeleteAuxiliaryEffectSlots;
394 LPALAUXILIARYEFFECTSLOTI AuxiliaryEffectSloti;
396 void (AL_APIENTRY*BufferSamplesSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*);
397 void (AL_APIENTRY*BufferSubSamplesSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,const ALvoid*);
398 void (AL_APIENTRY*GetBufferSamplesSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*);
399 ALboolean (AL_APIENTRY*IsBufferFormatSupportedSOFT)(ALenum);
401 void (AL_APIENTRY*DeferUpdates)(void);
402 void (AL_APIENTRY*ProcessUpdates)(void);
403 } ExtALFuncs;
405 struct DS8Primary
407 IDirectSoundBuffer IDirectSoundBuffer_iface;
408 IDirectSound3DListener IDirectSound3DListener_iface;
409 IKsPropertySet IKsPropertySet_iface;
411 LONG ref, ds3d_ref, prop_ref;
412 IDirectSoundBuffer8 *write_emu;
413 DS8Impl *parent;
415 CRITICAL_SECTION crst;
417 DWORD buf_size;
418 BOOL stopped;
419 DWORD flags;
420 WAVEFORMATEXTENSIBLE format;
421 ALCcontext *ctx;
423 ALboolean SupportedExt[MAX_EXTENSIONS];
425 ALuint *sources;
426 DWORD nsources, sizesources;
427 DWORD max_sources;
428 DS8Buffer **buffers;
429 DWORD nbuffers, sizebuffers;
430 DS8Buffer **notifies;
431 DWORD nnotifies, sizenotifies;
433 UINT timer_id;
434 DWORD timer_res;
435 HANDLE thread_hdl;
436 DWORD thread_id;
438 ALuint auxslot;
439 ALuint effect;
440 EAXLISTENERPROPERTIES eax_prop;
442 ExtALFuncs ExtAL;
443 union {
444 struct {
445 BOOL pos : 1;
446 BOOL vel : 1;
447 BOOL orientation : 1;
448 BOOL distancefactor : 1;
449 BOOL rollofffactor : 1;
450 BOOL dopplerfactor : 1;
451 BOOL effect : 1;
452 } bit;
453 int flags;
454 } dirty;
455 ALfloat rollofffactor;
456 DS3DLISTENER listen;
460 typedef struct DS8Data {
461 LONG ref;
463 /* Lock was called and unlock isn't? */
464 BOOL locked;
466 WAVEFORMATEXTENSIBLE format;
468 ALuint buf_size;
469 ALenum buf_format;
470 ALenum in_type, in_chans;
471 DWORD dsbflags;
472 BYTE *data;
473 ALuint *buffers;
474 ALuint numsegs;
475 ALuint segsize;
476 ALuint lastsegsize;
477 } DS8Data;
478 /* Amount of buffers that have to be queued when
479 * bufferdatastatic and buffersubdata are not available */
480 #define QBUFFERS 3
482 struct DS8Buffer
484 IDirectSoundBuffer8 IDirectSoundBuffer8_iface;
485 IDirectSound3DBuffer IDirectSound3DBuffer_iface;
486 IDirectSoundNotify IDirectSoundNotify_iface;
487 IKsPropertySet IKsPropertySet_iface;
489 LONG ref, ds3d_ref, not_ref, prop_ref;
490 LONG all_ref;
492 DWORD ds3dmode;
493 DS8Primary *primary;
494 DS8Data *buffer;
495 ALuint source;
496 ALuint curidx;
497 BOOL isplaying, islooping, bufferlost;
498 ALCcontext *ctx;
499 ExtALFuncs *ExtAL;
500 CRITICAL_SECTION *crst;
502 DS3DBUFFER ds3dbuffer;
503 union {
504 struct {
505 BOOL pos : 1;
506 BOOL vel : 1;
507 BOOL cone_angles : 1;
508 BOOL cone_orient : 1;
509 BOOL cone_outsidevolume : 1;
510 BOOL min_distance : 1;
511 BOOL max_distance : 1;
512 BOOL mode : 1;
513 } bit;
514 int flags;
515 } dirty;
517 DWORD nnotify, lastpos;
518 DSBPOSITIONNOTIFY *notify;
521 extern HRESULT DS8Primary_Create(DS8Primary **prim, DS8Impl *parent);
522 extern void DS8Primary_Destroy(DS8Primary *prim);
524 extern HRESULT DS8Buffer_Create(DS8Buffer **ppv, DS8Primary *parent, IDirectSoundBuffer *orig);
525 extern void DS8Buffer_Destroy(DS8Buffer *buf);
527 static inline ALdouble gain_to_mB(ALdouble gain)
529 return log10(gain) * 2000.0;
531 static inline ALdouble mB_to_gain(ALdouble millibels)
533 return pow(10.0, millibels/2000.0);
536 static inline LONG clampI(LONG val, LONG minval, LONG maxval)
538 if(val >= maxval) return maxval;
539 if(val <= minval) return minval;
540 return val;
542 static inline ULONG clampU(ULONG val, ULONG minval, ULONG maxval)
544 if(val >= maxval) return maxval;
545 if(val <= minval) return minval;
546 return val;
548 static inline FLOAT clampF(FLOAT val, FLOAT minval, FLOAT maxval)
550 if(val >= maxval) return maxval;
551 if(val <= minval) return minval;
552 return val;
556 #define getALError() \
557 do { \
558 ALenum err = alGetError(); \
559 if(err != AL_NO_ERROR) \
560 ERR(">>>>>>>>>>>> Received AL error %#x on context %p, %s:%u\n", err, get_context(), __FUNCTION__, __LINE__); \
561 } while (0)
563 #define getALCError(dev) \
564 do { \
565 ALenum err = alcGetError(dev); \
566 if(err != ALC_NO_ERROR) \
567 ERR(">>>>>>>>>>>> Received ALC error %#x on device %p, %s:%u\n", err, dev, __FUNCTION__, __LINE__); \
568 } while(0)
570 #if ALLOW_CONCURRENT_AL
572 #define setALContext(actx) \
573 do { \
574 ALCcontext *__old_ctx, *cur_ctx = actx; \
575 if (!local_contexts) EnterCriticalSection(&openal_crst); \
576 __old_ctx = get_context(); \
577 if (__old_ctx != cur_ctx && set_context(cur_ctx) == ALC_FALSE) {\
578 ERR("Couldn't set current context!!\n"); \
579 getALCError(alcGetContextsDevice(cur_ctx)); \
582 /* Only restore a NULL context if using global contexts, for TLS contexts always restore */
583 #define popALContext() \
584 if (__old_ctx != cur_ctx && \
585 (local_contexts || __old_ctx) && \
586 set_context(__old_ctx) == ALC_FALSE) { \
587 ERR("Couldn't restore old context!!\n"); \
588 getALCError(alcGetContextsDevice(__old_ctx)); \
590 if (!local_contexts) LeaveCriticalSection(&openal_crst); \
591 } while (0)
593 #else
595 #define setALContext(actx) \
596 do { \
597 ALCcontext *cur_ctx = actx; \
598 if (!local_contexts) EnterCriticalSection(&openal_crst); \
599 if (set_context(cur_ctx) == ALC_FALSE) { \
600 ERR("Couldn't set current context!!\n"); \
601 getALCError(alcGetContextsDevice(cur_ctx)); \
604 #define popALContext() \
605 if (!local_contexts) LeaveCriticalSection(&openal_crst); \
606 } while (0)
608 #endif
610 HRESULT DSOUND_Create(REFIID riid, void **ppDS);
611 HRESULT DSOUND_Create8(REFIID riid, void **ppDS);
612 HRESULT DSOUND_FullDuplexCreate(REFIID riid, void **ppDSFD);
613 HRESULT IKsPrivatePropertySetImpl_Create(REFIID riid, void **piks);
614 HRESULT DSOUND_CaptureCreate(REFIID riid, void **ppDSC);
615 HRESULT DSOUND_CaptureCreate8(REFIID riid, void **ppDSC8);
617 extern const GUID DSOUND_renderer_guid;
618 extern const GUID DSOUND_capture_guid;