zenilib: zenilib/jni/external/openal-soft/OpenAL32/Include/alMain.h Source File

zenilib 0.5.3.0

- Main Page
- Modules
- Namespaces
- Classes
- Files

- File List
- File Members

All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
alMain.h
Go to the documentation of this file.
1 #ifndef AL_MAIN_H
2 #define AL_MAIN_H
3
4 #include <string.h>
5 #include <stdio.h>
6 #include <stdarg.h>
7 #include <assert.h>
8 #include <math.h>
9
10 #ifdef HAVE_FENV_H
11 #include <fenv.h>
12 #endif
13
14 #include "AL/al.h"
15 #include "AL/alc.h"
16 #include "AL/alext.h"
17
18 #ifndef AL_SOFT_deferred_updates
19 #define AL_SOFT_deferred_updates 1
20 #define AL_DEFERRED_UPDATES_SOFT 0xC002
21 typedef ALvoid (AL_APIENTRY*LPALDEFERUPDATESSOFT)(void);
22 typedef ALvoid (AL_APIENTRY*LPALPROCESSUPDATESSOFT)(void);
23 #ifdef AL_ALEXT_PROTOTYPES
24 AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void);
25 AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void);
26 #endif
27 #endif
28
29
30 #if defined(HAVE_STDINT_H)
31 #include <stdint.h>
32 typedef int64_t ALint64;
33 typedef uint64_t ALuint64;
34 #elif defined(HAVE___INT64)
35 typedef __int64 ALint64;
36 typedef unsigned __int64 ALuint64;
37 #elif (SIZEOF_LONG == 8)
38 typedef long ALint64;
39 typedef unsigned long ALuint64;
40 #elif (SIZEOF_LONG_LONG == 8)
41 typedef long long ALint64;
42 typedef unsigned long long ALuint64;
43 #endif
44
45 typedef ptrdiff_t ALintptrEXT;
46 typedef ptrdiff_t ALsizeiptrEXT;
47
48 #define MAKEU64(x,y) (((ALuint64)(x)<<32)|(ALuint64)(y))
49
50 #ifdef HAVE_GCC_FORMAT
51 #define PRINTF_STYLE(x, y) __attribute__((format(printf, (x), (y))))
52 #else
53 #define PRINTF_STYLE(x, y)
54 #endif
55
56
57 static const union {
58 ALuint u;
59 ALubyte b[sizeof(ALuint)];
60 } EndianTest = { 1 };
61 #define IS_LITTLE_ENDIAN (EndianTest.b[0] == 1)
62
63 #define COUNTOF(x) (sizeof((x))/sizeof((x)[0]))
64
65 #ifdef _WIN32
66
67 #define WIN32_LEAN_AND_MEAN
68 #include <windows.h>
69
70 typedef DWORD pthread_key_t;
71 int pthread_key_create(pthread_key_t *key, void (*callback)(void*));
72 int pthread_key_delete(pthread_key_t key);
73 void *pthread_getspecific(pthread_key_t key);
74 int pthread_setspecific(pthread_key_t key, void *val);
75
76 #define HAVE_DYNLOAD 1
77 void *LoadLib(const char *name);
78 void CloseLib(void *handle);
79 void *GetSymbol(void *handle, const char *name);
80
81 WCHAR *strdupW(const WCHAR *str);
82
83 typedef LONG pthread_once_t;
84 #define PTHREAD_ONCE_INIT 0
85 void pthread_once(pthread_once_t *once, void (*callback)(void));
86
87 static __inline int sched_yield(void)
88 { SwitchToThread(); return 0; }
89
90 #else
91
92 #include <unistd.h>
93 #include <assert.h>
94 #include <pthread.h>
95 #include <sys/time.h>
96 #include <time.h>
97 #include <errno.h>
98
99 #define IsBadWritePtr(a,b) ((a) == NULL && (b) != 0)
100
101 typedef pthread_mutex_t CRITICAL_SECTION;
102 void InitializeCriticalSection(CRITICAL_SECTION *cs);
103 void DeleteCriticalSection(CRITICAL_SECTION *cs);
104 void EnterCriticalSection(CRITICAL_SECTION *cs);
105 void LeaveCriticalSection(CRITICAL_SECTION *cs);
106
107 ALuint timeGetTime(void);
108 void Sleep(ALuint t);
109
110 #if defined(HAVE_DLFCN_H)
111 #define HAVE_DYNLOAD 1
112 void *LoadLib(const char *name);
113 void CloseLib(void *handle);
114 void *GetSymbol(void *handle, const char *name);
115 #endif
116
117 #endif
118
119 typedef void *volatile XchgPtr;
120
121 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
122 typedef ALuint RefCount;
123 static __inline RefCount IncrementRef(volatile RefCount *ptr)
124 { return __sync_add_and_fetch(ptr, 1); }
125 static __inline RefCount DecrementRef(volatile RefCount *ptr)
126 { return __sync_sub_and_fetch(ptr, 1); }
127
128 static __inline int ExchangeInt(volatile int *ptr, int newval)
129 {
130 return __sync_lock_test_and_set(ptr, newval);
131 }
132 static __inline void *ExchangePtr(XchgPtr *ptr, void *newval)
133 {
134 return __sync_lock_test_and_set(ptr, newval);
135 }
136 static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval)
137 {
138 return __sync_bool_compare_and_swap(ptr, oldval, newval);
139 }
140 static __inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
141 {
142 return __sync_bool_compare_and_swap(ptr, oldval, newval);
143 }
144
145 #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
146
147 static __inline int xaddl(volatile int *dest, int incr)
148 {
149 int ret;
150 __asm__ __volatile__("lock; xaddl %0,(%1)"
151 : "=r" (ret)
152 : "r" (dest), "0" (incr)
153 : "memory");
154 return ret;
155 }
156
157 typedef int RefCount;
158 static __inline RefCount IncrementRef(volatile RefCount *ptr)
159 { return xaddl(ptr, 1)+1; }
160 static __inline RefCount DecrementRef(volatile RefCount *ptr)
161 { return xaddl(ptr, -1)-1; }
162
163 static __inline int ExchangeInt(volatile int *dest, int newval)
164 {
165 int ret;
166 __asm__ __volatile__("lock; xchgl %0,(%1)"
167 : "=r" (ret)
168 : "r" (dest), "0" (newval)
169 : "memory");
170 return ret;
171 }
172
173 static __inline ALboolean CompExchangeInt(volatile int *dest, int oldval, int newval)
174 {
175 int ret;
176 __asm__ __volatile__("lock; cmpxchgl %2,(%1)"
177 : "=a" (ret)
178 : "r" (dest), "r" (newval), "0" (oldval)
179 : "memory");
180 return ret == oldval;
181 }
182
183 static __inline void *ExchangePtr(XchgPtr *dest, void *newval)
184 {
185 void *ret;
186 __asm__ __volatile__(
187 #ifdef __i386__
188 "lock; xchgl %0,(%1)"
189 #else
190 "lock; xchgq %0,(%1)"
191 #endif
192 : "=r" (ret)
193 : "r" (dest), "0" (newval)
194 : "memory"
195 );
196 return ret;
197 }
198
199 static __inline ALboolean CompExchangePtr(XchgPtr *dest, void *oldval, void *newval)
200 {
201 void *ret;
202 __asm__ __volatile__(
203 #ifdef __i386__
204 "lock; cmpxchgl %2,(%1)"
205 #else
206 "lock; cmpxchgq %2,(%1)"
207 #endif
208 : "=a" (ret)
209 : "r" (dest), "r" (newval), "0" (oldval)
210 : "memory"
211 );
212 return ret == oldval;
213 }
214
215 #elif defined(_WIN32)
216
217 typedef LONG RefCount;
218 static __inline RefCount IncrementRef(volatile RefCount *ptr)
219 { return InterlockedIncrement(ptr); }
220 static __inline RefCount DecrementRef(volatile RefCount *ptr)
221 { return InterlockedDecrement(ptr); }
222
223 extern ALbyte LONG_size_does_not_match_int[(sizeof(LONG)==sizeof(int))?1:-1];
224
225 static __inline int ExchangeInt(volatile int *ptr, int newval)
226 {
227 union {
228 volatile int *i;
229 volatile LONG *l;
230 } u = { ptr };
231 return InterlockedExchange(u.l, newval);
232 }
233 static __inline void *ExchangePtr(XchgPtr *ptr, void *newval)
234 {
235 return InterlockedExchangePointer(ptr, newval);
236 }
237 static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval)
238 {
239 union {
240 volatile int *i;
241 volatile LONG *l;
242 } u = { ptr };
243 return InterlockedCompareExchange(u.l, newval, oldval) == oldval;
244 }
245 static __inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
246 {
247 return InterlockedCompareExchangePointer(ptr, newval, oldval) == oldval;
248 }
249
250 #elif defined(__APPLE__)
251
252 #include <libkern/OSAtomic.h>
253
254 typedef int32_t RefCount;
255 static __inline RefCount IncrementRef(volatile RefCount *ptr)
256 { return OSAtomicIncrement32Barrier(ptr); }
257 static __inline RefCount DecrementRef(volatile RefCount *ptr)
258 { return OSAtomicDecrement32Barrier(ptr); }
259
260 static __inline int ExchangeInt(volatile int *ptr, int newval)
261 {
262 /* Really? No regular old atomic swap? */
263 int oldval;
264 do {
265 oldval = *ptr;
266 } while(!OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr));
267 return oldval;
268 }
269 static __inline void *ExchangePtr(XchgPtr *ptr, void *newval)
270 {
271 void *oldval;
272 do {
273 oldval = *ptr;
274 } while(!OSAtomicCompareAndSwapPtrBarrier(oldval, newval, ptr));
275 return oldval;
276 }
277 static __inline ALboolean CompExchangeInt(volatile int *ptr, int oldval, int newval)
278 {
279 return OSAtomicCompareAndSwap32Barrier(oldval, newval, ptr);
280 }
281 static __inline ALboolean CompExchangePtr(XchgPtr *ptr, void *oldval, void *newval)
282 {
283 return OSAtomicCompareAndSwapPtrBarrier(oldval, newval, ptr);
284 }
285
286 #else
287 #error "No atomic functions available on this platform!"
288 typedef ALuint RefCount;
289 #endif
290
291
292 typedef struct {
293 volatile RefCount read_count;
294 volatile RefCount write_count;
295 volatile ALenum read_lock;
296 volatile ALenum read_entry_lock;
297 volatile ALenum write_lock;
298 } RWLock;
299
300 void RWLockInit(RWLock *lock);
301 void ReadLock(RWLock *lock);
302 void ReadUnlock(RWLock *lock);
303 void WriteLock(RWLock *lock);
304 void WriteUnlock(RWLock *lock);
305
306
307 typedef struct UIntMap {
308 struct {
309 ALuint key;
310 ALvoid *value;
311 } *array;
312 ALsizei size;
313 ALsizei maxsize;
314 ALsizei limit;
315 RWLock lock;
316 } UIntMap;
317 extern UIntMap TlsDestructor;
318
319 void InitUIntMap(UIntMap *map, ALsizei limit);
320 void ResetUIntMap(UIntMap *map);
321 ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value);
322 ALvoid *RemoveUIntMapKey(UIntMap *map, ALuint key);
323 ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key);
324
325 static __inline void LockUIntMapRead(UIntMap *map)
326 { ReadLock(&map->lock); }
327 static __inline void UnlockUIntMapRead(UIntMap *map)
328 { ReadUnlock(&map->lock); }
329 static __inline void LockUIntMapWrite(UIntMap *map)
330 { WriteLock(&map->lock); }
331 static __inline void UnlockUIntMapWrite(UIntMap *map)
332 { WriteUnlock(&map->lock); }
333
334
335 #ifdef __cplusplus
336 extern "C" {
337 #endif
338
339 struct Hrtf;
340
341
342 #define DEFAULT_OUTPUT_RATE (44100)
343 #define MIN_OUTPUT_RATE (8000)
344
345
346 // Find the next power-of-2 for non-power-of-2 numbers.
347 static __inline ALuint NextPowerOf2(ALuint value)
348 {
349 if(value > 0)
350 {
351 value--;
352 value |= value>>1;
353 value |= value>>2;
354 value |= value>>4;
355 value |= value>>8;
356 value |= value>>16;
357 }
358 return value+1;
359 }
360
361 /* Fast float-to-int conversion. Assumes the FPU is already in round-to-zero
362 * mode. */
363 static __inline ALint fastf2i(ALfloat f)
364 {
365 #ifdef HAVE_LRINTF
366 return lrintf(f);
367 #elif defined(_MSC_VER) && defined(_M_IX86)
368 ALint i;
369 __asm fld f
370 __asm fistp i
371 return i;
372 #else
373 return (ALint)f;
374 #endif
375 }
376
377 /* Fast float-to-uint conversion. Assumes the FPU is already in round-to-zero
378 * mode. */
379 static __inline ALuint fastf2u(ALfloat f)
380 { return fastf2i(f); }
381
382
383 enum DevProbe {
384 ALL_DEVICE_PROBE,
385 CAPTURE_DEVICE_PROBE
386 };
387
388 typedef struct {
389 ALCenum (*OpenPlayback)(ALCdevice*, const ALCchar*);
390 void (*ClosePlayback)(ALCdevice*);
391 ALCboolean (*ResetPlayback)(ALCdevice*);
392 ALCboolean (*StartPlayback)(ALCdevice*);
393 void (*StopPlayback)(ALCdevice*);
394
395 ALCenum (*OpenCapture)(ALCdevice*, const ALCchar*);
396 void (*CloseCapture)(ALCdevice*);
397 void (*StartCapture)(ALCdevice*);
398 void (*StopCapture)(ALCdevice*);
399 ALCenum (*CaptureSamples)(ALCdevice*, void*, ALCuint);
400 ALCuint (*AvailableSamples)(ALCdevice*);
401
402 void (*Lock)(ALCdevice*);
403 void (*Unlock)(ALCdevice*);
404
405 ALint64 (*GetLatency)(ALCdevice*);
406 } BackendFuncs;
407
408 struct BackendInfo {
409 const char *name;
410 ALCboolean (*Init)(BackendFuncs*);
411 void (*Deinit)(void);
412 void (*Probe)(enum DevProbe);
413 BackendFuncs Funcs;
414 };
415
416 ALCboolean alc_alsa_init(BackendFuncs *func_list);
417 void alc_alsa_deinit(void);
418 void alc_alsa_probe(enum DevProbe type);
419 ALCboolean alc_oss_init(BackendFuncs *func_list);
420 void alc_oss_deinit(void);
421 void alc_oss_probe(enum DevProbe type);
422 ALCboolean alc_solaris_init(BackendFuncs *func_list);
423 void alc_solaris_deinit(void);
424 void alc_solaris_probe(enum DevProbe type);
425 ALCboolean alc_sndio_init(BackendFuncs *func_list);
426 void alc_sndio_deinit(void);
427 void alc_sndio_probe(enum DevProbe type);
428 ALCboolean alcMMDevApiInit(BackendFuncs *func_list);
429 void alcMMDevApiDeinit(void);
430 void alcMMDevApiProbe(enum DevProbe type);
431 ALCboolean alcDSoundInit(BackendFuncs *func_list);
432 void alcDSoundDeinit(void);
433 void alcDSoundProbe(enum DevProbe type);
434 ALCboolean alcWinMMInit(BackendFuncs *FuncList);
435 void alcWinMMDeinit(void);
436 void alcWinMMProbe(enum DevProbe type);
437 ALCboolean alc_pa_init(BackendFuncs *func_list);
438 void alc_pa_deinit(void);
439 void alc_pa_probe(enum DevProbe type);
440 ALCboolean alc_wave_init(BackendFuncs *func_list);
441 void alc_wave_deinit(void);
442 void alc_wave_probe(enum DevProbe type);
443 ALCboolean alc_pulse_init(BackendFuncs *func_list);
444 void alc_pulse_deinit(void);
445 void alc_pulse_probe(enum DevProbe type);
446 ALCboolean alc_ca_init(BackendFuncs *func_list);
447 void alc_ca_deinit(void);
448 void alc_ca_probe(enum DevProbe type);
449 ALCboolean alc_opensl_init(BackendFuncs *func_list);
450 void alc_opensl_deinit(void);
451 void alc_opensl_probe(enum DevProbe type);
452 ALCboolean alc_null_init(BackendFuncs *func_list);
453 void alc_null_deinit(void);
454 void alc_null_probe(enum DevProbe type);
455 ALCboolean alc_loopback_init(BackendFuncs *func_list);
456 void alc_loopback_deinit(void);
457 void alc_loopback_probe(enum DevProbe type);
458
459
460 enum DistanceModel {
461 InverseDistanceClamped = AL_INVERSE_DISTANCE_CLAMPED,
462 LinearDistanceClamped = AL_LINEAR_DISTANCE_CLAMPED,
463 ExponentDistanceClamped = AL_EXPONENT_DISTANCE_CLAMPED,
464 InverseDistance = AL_INVERSE_DISTANCE,
465 LinearDistance = AL_LINEAR_DISTANCE,
466 ExponentDistance = AL_EXPONENT_DISTANCE,
467 DisableDistance = AL_NONE,
468
469 DefaultDistanceModel = InverseDistanceClamped
470 };
471
472 enum Resampler {
473 PointResampler,
474 LinearResampler,
475 CubicResampler,
476
477 ResamplerMax,
478 };
479
480 enum Channel {
481 FrontLeft = 0,
482 FrontRight,
483 FrontCenter,
484 LFE,
485 BackLeft,
486 BackRight,
487 BackCenter,
488 SideLeft,
489 SideRight,
490
491 MaxChannels,
492 };
493
494
495 /* Device formats */
496 enum DevFmtType {
497 DevFmtByte = ALC_BYTE_SOFT,
498 DevFmtUByte = ALC_UNSIGNED_BYTE_SOFT,
499 DevFmtShort = ALC_SHORT_SOFT,
500 DevFmtUShort = ALC_UNSIGNED_SHORT_SOFT,
501 DevFmtInt = ALC_INT_SOFT,
502 DevFmtUInt = ALC_UNSIGNED_INT_SOFT,
503 DevFmtFloat = ALC_FLOAT_SOFT,
504
505 DevFmtTypeDefault = DevFmtFloat
506 };
507 enum DevFmtChannels {
508 DevFmtMono = ALC_MONO_SOFT,
509 DevFmtStereo = ALC_STEREO_SOFT,
510 DevFmtQuad = ALC_QUAD_SOFT,
511 DevFmtX51 = ALC_5POINT1_SOFT,
512 DevFmtX61 = ALC_6POINT1_SOFT,
513 DevFmtX71 = ALC_7POINT1_SOFT,
514
515 /* Similar to 5.1, except using the side channels instead of back */
516 DevFmtX51Side = 0x80000000,
517
518 DevFmtChannelsDefault = DevFmtStereo
519 };
520
521 ALuint BytesFromDevFmt(enum DevFmtType type);
522 ALuint ChannelsFromDevFmt(enum DevFmtChannels chans);
523 static __inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans,
524 enum DevFmtType type)
525 {
526 return ChannelsFromDevFmt(chans) * BytesFromDevFmt(type);
527 }
528
529
530 extern const struct EffectList {
531 const char *name;
532 int type;
533 const char *ename;
534 ALenum val;
535 } EffectList[];
536
537
538 enum DeviceType {
539 Playback,
540 Capture,
541 Loopback
542 };
543
544
545 /* Size for temporary storage of buffer data, in ALfloats. Larger values need
546 * more memory, while smaller values may need more iterations. The value needs
547 * to be a sensible size, however, as it constrains the max stepping value used
548 * for mixing, as well as the maximum number of samples per mixing iteration.
549 *
550 * The mixer requires being able to do two samplings per mixing loop. With the
551 * cubic resampler (which requires 3 padding samples), this limits a 2048
552 * buffer size to about 2044. This means that buffer_freq*source_pitch cannot
553 * exceed device_freq*2044 for a 32-bit buffer.
554 */
555 #ifndef BUFFERSIZE
556 #define BUFFERSIZE 2048
557 #endif
558
559
560 struct ALCdevice_struct
561 {
562 volatile RefCount ref;
563
564 ALCboolean Connected;
565 enum DeviceType Type;
566
567 CRITICAL_SECTION Mutex;
568
569 ALuint Frequency;
570 ALuint UpdateSize;
571 ALuint NumUpdates;
572 enum DevFmtChannels FmtChans;
573 enum DevFmtType FmtType;
574
575 ALCchar *DeviceName;
576
577 volatile ALCenum LastError;
578
579 // Maximum number of sources that can be created
580 ALuint MaxNoOfSources;
581 // Maximum number of slots that can be created
582 ALuint AuxiliaryEffectSlotMax;
583
584 ALCuint NumMonoSources;
585 ALCuint NumStereoSources;
586 ALuint NumAuxSends;
587
588 // Map of Buffers for this device
589 UIntMap BufferMap;
590
591 // Map of Effects for this device
592 UIntMap EffectMap;
593
594 // Map of Filters for this device
595 UIntMap FilterMap;
596
597 /* HRTF filter tables */
598 const struct Hrtf *Hrtf;
599
600 // Stereo-to-binaural filter
601 struct bs2b *Bs2b;
602 ALCint Bs2bLevel;
603
604 // Device flags
605 ALuint Flags;
606
607 ALuint ChannelOffsets[MaxChannels];
608
609 enum Channel Speaker2Chan[MaxChannels];
610 ALfloat SpeakerAngle[MaxChannels];
611 ALuint NumChan;
612
613 /* Temp storage used for mixing. +1 for the predictive sample. */
614 ALIGN(16) ALfloat SampleData1[BUFFERSIZE+1];
615 ALIGN(16) ALfloat SampleData2[BUFFERSIZE+1];
616
617 // Dry path buffer mix
618 ALIGN(16) ALfloat DryBuffer[MaxChannels][BUFFERSIZE];
619
620 ALIGN(16) ALfloat ClickRemoval[MaxChannels];
621 ALIGN(16) ALfloat PendingClicks[MaxChannels];
622
623 /* Default effect slot */
624 struct ALeffectslot *DefaultSlot;
625
626 // Contexts created on this device
627 ALCcontext *volatile ContextList;
628
629 BackendFuncs *Funcs;
630 void *ExtraData; // For the backend's use
631
632 ALCdevice *volatile next;
633 };
634
635 #define ALCdevice_OpenPlayback(a,b) ((a)->Funcs->OpenPlayback((a), (b)))
636 #define ALCdevice_ClosePlayback(a) ((a)->Funcs->ClosePlayback((a)))
637 #define ALCdevice_ResetPlayback(a) ((a)->Funcs->ResetPlayback((a)))
638 #define ALCdevice_StartPlayback(a) ((a)->Funcs->StartPlayback((a)))
639 #define ALCdevice_StopPlayback(a) ((a)->Funcs->StopPlayback((a)))
640 #define ALCdevice_OpenCapture(a,b) ((a)->Funcs->OpenCapture((a), (b)))
641 #define ALCdevice_CloseCapture(a) ((a)->Funcs->CloseCapture((a)))
642 #define ALCdevice_StartCapture(a) ((a)->Funcs->StartCapture((a)))
643 #define ALCdevice_StopCapture(a) ((a)->Funcs->StopCapture((a)))
644 #define ALCdevice_CaptureSamples(a,b,c) ((a)->Funcs->CaptureSamples((a), (b), (c)))
645 #define ALCdevice_AvailableSamples(a) ((a)->Funcs->AvailableSamples((a)))
646 #define ALCdevice_Lock(a) ((a)->Funcs->Lock((a)))
647 #define ALCdevice_Unlock(a) ((a)->Funcs->Unlock((a)))
648 #define ALCdevice_GetLatency(a) ((a)->Funcs->GetLatency((a)))
649
650 // Frequency was requested by the app or config file
651 #define DEVICE_FREQUENCY_REQUEST (1<<1)
652 // Channel configuration was requested by the config file
653 #define DEVICE_CHANNELS_REQUEST (1<<2)
654 // Sample type was requested by the config file
655 #define DEVICE_SAMPLE_TYPE_REQUEST (1<<3)
656
657 // Stereo sources cover 120-degree angles around +/-90
658 #define DEVICE_WIDE_STEREO (1<<16)
659
660 // Specifies if the device is currently running
661 #define DEVICE_RUNNING (1<<31)
662
663 /* Invalid channel offset */
664 #define INVALID_OFFSET (~0u)
665
666
667 #define LookupBuffer(m, k) ((struct ALbuffer*)LookupUIntMapKey(&(m)->BufferMap, (k)))
668 #define LookupEffect(m, k) ((struct ALeffect*)LookupUIntMapKey(&(m)->EffectMap, (k)))
669 #define LookupFilter(m, k) ((struct ALfilter*)LookupUIntMapKey(&(m)->FilterMap, (k)))
670 #define RemoveBuffer(m, k) ((struct ALbuffer*)RemoveUIntMapKey(&(m)->BufferMap, (k)))
671 #define RemoveEffect(m, k) ((struct ALeffect*)RemoveUIntMapKey(&(m)->EffectMap, (k)))
672 #define RemoveFilter(m, k) ((struct ALfilter*)RemoveUIntMapKey(&(m)->FilterMap, (k)))
673
674
675 struct ALCcontext_struct
676 {
677 volatile RefCount ref;
678
679 struct ALlistener *Listener;
680
681 UIntMap SourceMap;
682 UIntMap EffectSlotMap;
683
684 ALenum LastError;
685
686 volatile ALenum UpdateSources;
687
688 volatile enum DistanceModel DistanceModel;
689 volatile ALboolean SourceDistanceModel;
690
691 volatile ALfloat DopplerFactor;
692 volatile ALfloat DopplerVelocity;
693 volatile ALfloat SpeedOfSound;
694 volatile ALenum DeferUpdates;
695
696 struct ALsource **ActiveSources;
697 ALsizei ActiveSourceCount;
698 ALsizei MaxActiveSources;
699
700 struct ALeffectslot **ActiveEffectSlots;
701 ALsizei ActiveEffectSlotCount;
702 ALsizei MaxActiveEffectSlots;
703
704 ALCdevice *Device;
705 const ALCchar *ExtensionList;
706
707 ALCcontext *volatile next;
708 };
709
710 #define LookupSource(m, k) ((struct ALsource*)LookupUIntMapKey(&(m)->SourceMap, (k)))
711 #define LookupEffectSlot(m, k) ((struct ALeffectslot*)LookupUIntMapKey(&(m)->EffectSlotMap, (k)))
712 #define RemoveSource(m, k) ((struct ALsource*)RemoveUIntMapKey(&(m)->SourceMap, (k)))
713 #define RemoveEffectSlot(m, k) ((struct ALeffectslot*)RemoveUIntMapKey(&(m)->EffectSlotMap, (k)))
714
715
716 ALCcontext *GetContextRef(void);
717
718 void ALCcontext_IncRef(ALCcontext *context);
719 void ALCcontext_DecRef(ALCcontext *context);
720
721 void AppendAllDevicesList(const ALCchar *name);
722 void AppendCaptureDeviceList(const ALCchar *name);
723
724 void ALCdevice_LockDefault(ALCdevice *device);
725 void ALCdevice_UnlockDefault(ALCdevice *device);
726 ALint64 ALCdevice_GetLatencyDefault(ALCdevice *device);
727
728 static __inline void LockContext(ALCcontext *context)
729 { ALCdevice_Lock(context->Device); }
730 static __inline void UnlockContext(ALCcontext *context)
731 { ALCdevice_Unlock(context->Device); }
732
733
734 void *al_malloc(size_t alignment, size_t size);
735 void *al_calloc(size_t alignment, size_t size);
736 void al_free(void *ptr);
737
738 typedef struct {
739 int state;
740 #ifdef HAVE_SSE
741 int sse_state;
742 #endif
743 } FPUCtl;
744 void SetMixerFPUMode(FPUCtl *ctl);
745 void RestoreFPUMode(const FPUCtl *ctl);
746
747 ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr);
748 ALuint StopThread(ALvoid *thread);
749
750 typedef struct RingBuffer RingBuffer;
751 RingBuffer *CreateRingBuffer(ALsizei frame_size, ALsizei length);
752 void DestroyRingBuffer(RingBuffer *ring);
753 ALsizei RingBufferSize(RingBuffer *ring);
754 void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len);
755 void ReadRingBuffer(RingBuffer *ring, ALubyte *data, ALsizei len);
756
757 void ReadALConfig(void);
758 void FreeALConfig(void);
759 int ConfigValueExists(const char *blockName, const char *keyName);
760 const char *GetConfigValue(const char *blockName, const char *keyName, const char *def);
761 int GetConfigValueBool(const char *blockName, const char *keyName, int def);
762 int ConfigValueStr(const char *blockName, const char *keyName, const char **ret);
763 int ConfigValueInt(const char *blockName, const char *keyName, int *ret);
764 int ConfigValueUInt(const char *blockName, const char *keyName, unsigned int *ret);
765 int ConfigValueFloat(const char *blockName, const char *keyName, float *ret);
766
767 void SetRTPriority(void);
768
769 void SetDefaultChannelOrder(ALCdevice *device);
770 void SetDefaultWFXChannelOrder(ALCdevice *device);
771
772 const ALCchar *DevFmtTypeString(enum DevFmtType type);
773 const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans);
774
775 #define HRIR_BITS (7)
776 #define HRIR_LENGTH (1<<HRIR_BITS)
777 #define HRIR_MASK (HRIR_LENGTH-1)
778 #define HRTFDELAY_BITS (20)
779 #define HRTFDELAY_FRACONE (1<<HRTFDELAY_BITS)
780 #define HRTFDELAY_MASK (HRTFDELAY_FRACONE-1)
781 const struct Hrtf *GetHrtf(ALCdevice *device);
782 void FreeHrtfs(void);
783 ALuint GetHrtfIrSize (const struct Hrtf *Hrtf);
784 ALfloat CalcHrtfDelta(ALfloat oldGain, ALfloat newGain, const ALfloat olddir[3], const ALfloat newdir[3]);
785 void GetLerpedHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat gain, ALfloat (*coeffs)[2], ALuint *delays);
786 ALuint GetMovingHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat gain, ALfloat delta, ALint counter, ALfloat (*coeffs)[2], ALuint *delays, ALfloat (*coeffStep)[2], ALint *delayStep);
787
788 void al_print(const char *type, const char *func, const char *fmt, ...) PRINTF_STYLE(3,4);
789 #define AL_PRINT(T, ...) al_print((T), __FUNCTION__, __VA_ARGS__)
790
791 extern FILE *LogFile;
792 enum LogLevel {
793 NoLog,
794 LogError,
795 LogWarning,
796 LogTrace,
797 LogRef
798 };
799 extern enum LogLevel LogLevel;
800
801 #define TRACEREF(...) do { \
802 if(LogLevel >= LogRef) \
803 AL_PRINT("(--)", __VA_ARGS__); \
804 } while(0)
805
806 #define TRACE(...) do { \
807 if(LogLevel >= LogTrace) \
808 AL_PRINT("(II)", __VA_ARGS__); \
809 } while(0)
810
811 #define WARN(...) do { \
812 if(LogLevel >= LogWarning) \
813 AL_PRINT("(WW)", __VA_ARGS__); \
814 } while(0)
815
816 #define ERR(...) do { \
817 if(LogLevel >= LogError) \
818 AL_PRINT("(EE)", __VA_ARGS__); \
819 } while(0)
820
821
822 extern ALint RTPrioLevel;
823
824
825 extern ALuint CPUCapFlags;
826 enum {
827 CPU_CAP_SSE = 1<<0,
828 CPU_CAP_NEON = 1<<1,
829 };
830
831 void FillCPUCaps(ALuint capfilter);
832
833
838 #define al_try do { \
839 int _al_err=0; \
840 _al_try_label: \
841 if(_al_err == 0)
842
846 #define al_catch(val) else if(_al_err == (val))
847
851 #define al_catchany() else
852
853 #define al_endtry } while(0)
854
860 #define al_throw(e) do { \
861 _al_err = (e); \
862 assert(_al_err != 0); \
863 goto _al_try_label; \
864 } while(0)
865
866 #define al_throwerr(ctx, err) do { \
867 alSetError((ctx), (err)); \
868 al_throw((err)); \
869 } while(0)
870
875 #define CHECK_VALUE(ctx, cond) do { \
876 if(!(cond)) \
877 al_throwerr((ctx), AL_INVALID_VALUE); \
878 } while(0)
879
880 #ifdef __cplusplus
881 }
882 #endif
883
884 #endif
ALCdevice_struct::BufferMap
UIntMap BufferMap
Definition: alMain.h:589
BackCenter
Definition: alMain.h:487
ConfigValueStr
int ConfigValueStr(const char *blockName, const char *keyName, const char **ret)
Definition: alcConfig.c:316
UnlockUIntMapWrite
static __inline void UnlockUIntMapWrite(UIntMap *map)
Definition: alMain.h:331
AL_APIENTRY
#define AL_APIENTRY
Definition: al.h:21
Capture
Definition: alMain.h:540
ALCdevice_struct::NumMonoSources
ALCuint NumMonoSources
Definition: alMain.h:584
ALCcontext_struct::UpdateSources
volatile ALenum UpdateSources
Definition: alMain.h:686
ALubyte
unsigned char ALubyte
Definition: al.h:47
ALCcontext_struct::DopplerFactor
volatile ALfloat DopplerFactor
Definition: alMain.h:691
ALCcontext_struct::Listener
struct ALlistener * Listener
Definition: alMain.h:679
GetLerpedHrtfCoeffs
void GetLerpedHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat gain, ALfloat(*coeffs)[2], ALuint *delays)
Definition: hrtf.c:140
ALCdevice_struct::FilterMap
UIntMap FilterMap
Definition: alMain.h:595
ALCcontext_struct::MaxActiveSources
ALsizei MaxActiveSources
Definition: alMain.h:698
ALCdevice_struct::Connected
ALCboolean Connected
Definition: alMain.h:564
NextPowerOf2
static __inline ALuint NextPowerOf2(ALuint value)
Definition: alMain.h:347
alc_pulse_init
ALCboolean alc_pulse_init(BackendFuncs *func_list)
Definition: pulseaudio.c:1545
val
GLuint const GLfloat * val
Definition: glew.h:2715
ALvoid
void ALvoid
Definition: al.h:74
RefCount
ALuint RefCount
Definition: alMain.h:288
EndianTest
static union @57 EndianTest
AL_INVERSE_DISTANCE_CLAMPED
#define AL_INVERSE_DISTANCE_CLAMPED
Definition: al.h:446
LogError
Definition: alMain.h:794
AL_NONE
#define AL_NONE
Definition: al.h:80
bs2b
Definition: bs2b.h:49
EffectList::name
const char * name
Definition: alMain.h:531
ALCdevice_struct::Type
enum DeviceType Type
Definition: alMain.h:565
DevFmtQuad
Definition: alMain.h:510
ALC_UNSIGNED_SHORT_SOFT
#define ALC_UNSIGNED_SHORT_SOFT
Definition: alext.h:284
type
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: gl2ext.h:845
EffectList
Definition: alMain.h:530
void
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
BackendFuncs
Definition: alMain.h:388
XchgPtr
void *volatile XchgPtr
Definition: alMain.h:119
int64_t
long long int64_t
Definition: types.h:10
LFE
Definition: alMain.h:484
ALCdevice_struct::Mutex
CRITICAL_SECTION Mutex
Definition: alMain.h:567
ALCdevice_struct::Hrtf
struct Hrtf * Hrtf
Definition: alMain.h:598
GetMovingHrtfCoeffs
ALuint GetMovingHrtfCoeffs(const struct Hrtf *Hrtf, ALfloat elevation, ALfloat azimuth, ALfloat gain, ALfloat delta, ALint counter, ALfloat(*coeffs)[2], ALuint *delays, ALfloat(*coeffStep)[2], ALint *delayStep)
Definition: hrtf.c:232
DevFmtUShort
Definition: alMain.h:500
ALCdevice_struct::DefaultSlot
struct ALeffectslot * DefaultSlot
Definition: alMain.h:624
ALCcontext_struct::EffectSlotMap
UIntMap EffectSlotMap
Definition: alMain.h:682
BackRight
Definition: alMain.h:486
ConfigValueInt
int ConfigValueInt(const char *blockName, const char *keyName, int *ret)
Definition: alcConfig.c:325
ALCcontext_struct::ActiveEffectSlotCount
ALsizei ActiveEffectSlotCount
Definition: alMain.h:701
ALCcontext_struct::ActiveSources
struct ALsource ** ActiveSources
Definition: alMain.h:696
f
GLclampf f
Definition: glew.h:3390
UIntMap::array
struct UIntMap::@59 * array
alc_pulse_probe
void alc_pulse_probe(enum DevProbe type)
Definition: pulseaudio.c:1551
timeGetTime
ALuint timeGetTime(void)
Definition: helpers.c:376
DevFmtChannelsString
const ALCchar * DevFmtChannelsString(enum DevFmtChannels chans)
Definition: ALc.c:1150
ConfigValueUInt
int ConfigValueUInt(const char *blockName, const char *keyName, unsigned int *ret)
Definition: alcConfig.c:334
alc_pa_deinit
void alc_pa_deinit(void)
Definition: portaudio.c:447
RWLock
Definition: alMain.h:292
alc_loopback_init
ALCboolean alc_loopback_init(BackendFuncs *func_list)
Definition: loopback.c:75
ALCcontext_struct::SpeedOfSound
volatile ALfloat SpeedOfSound
Definition: alMain.h:693
BackendInfo::Init
ALCboolean(* Init)(BackendFuncs *)
Definition: alMain.h:410
ALCdevice_struct::NumAuxSends
ALuint NumAuxSends
Definition: alMain.h:586
ExponentDistanceClamped
Definition: alMain.h:463
ALCcontext_struct::ExtensionList
const ALCchar * ExtensionList
Definition: alMain.h:705
ALsizei
int ALsizei
Definition: al.h:62
ReadLock
void ReadLock(RWLock *lock)
Definition: helpers.c:515
ALCdevice_struct::Frequency
ALuint Frequency
Definition: alMain.h:569
alc_solaris_probe
void alc_solaris_probe(enum DevProbe type)
Definition: solaris.c:270
Lock
static void Lock(volatile ALenum *l)
Definition: helpers.c:495
ALCcontext_struct::ref
volatile RefCount ref
Definition: alMain.h:677
alc_oss_probe
void alc_oss_probe(enum DevProbe type)
Definition: oss.c:513
uint64_t
unsigned long long uint64_t
Definition: SDL_config_windows.h:64
alcMMDevApiDeinit
void alcMMDevApiDeinit(void)
Definition: mmdevapi.c:978
t
GLdouble GLdouble t
Definition: glew.h:1384
alc_null_init
ALCboolean alc_null_init(BackendFuncs *func_list)
Definition: null.c:152
DevFmtType
DevFmtType
Definition: alMain.h:496
ALCdevice_struct
Definition: alMain.h:560
ALint
int ALint
Definition: al.h:56
LPALPROCESSUPDATESSOFT
ALvoid(AL_APIENTRY * LPALPROCESSUPDATESSOFT)(void)
Definition: alMain.h:22
BackendInfo::Deinit
void(* Deinit)(void)
Definition: alMain.h:411
ALCcontext_struct::SourceMap
UIntMap SourceMap
Definition: alMain.h:681
DistanceModel
DistanceModel
Definition: alMain.h:460
UIntMap::maxsize
ALsizei maxsize
Definition: alMain.h:313
GetHrtfIrSize
ALuint GetHrtfIrSize(const struct Hrtf *Hrtf)
Definition: hrtf.c:801
UIntMap::lock
RWLock lock
Definition: alMain.h:315
LookupUIntMapKey
ALvoid * LookupUIntMapKey(UIntMap *map, ALuint key)
Definition: helpers.c:653
ALCdevice_GetLatencyDefault
ALint64 ALCdevice_GetLatencyDefault(ALCdevice *device)
Definition: ALc.c:1285
UIntMap::limit
ALsizei limit
Definition: alMain.h:314
name
EGLImageKHR EGLint * name
Definition: eglext.h:284
alc_ca_probe
void alc_ca_probe(enum DevProbe type)
Definition: coreaudio.c:695
int32_t
long int32_t
Definition: types.h:9
counter
GLuint counter
Definition: gl2ext.h:936
CalcHrtfDelta
ALfloat CalcHrtfDelta(ALfloat oldGain, ALfloat newGain, const ALfloat olddir[3], const ALfloat newdir[3])
Definition: hrtf.c:106
ALCdevice_struct::Flags
ALuint Flags
Definition: alMain.h:605
ConfigValueExists
int ConfigValueExists(const char *blockName, const char *keyName)
Definition: alcConfig.c:310
len
GLenum GLsizei len
Definition: glew.h:7035
RestoreFPUMode
void RestoreFPUMode(const FPUCtl *ctl)
Definition: helpers.c:235
ALCdevice_struct::Bs2b
struct bs2b * Bs2b
Definition: alMain.h:601
RingBufferSize
ALsizei RingBufferSize(RingBuffer *ring)
Definition: alcRing.c:67
ResamplerMax
Definition: alMain.h:477
SetDefaultChannelOrder
void SetDefaultChannelOrder(ALCdevice *device)
Definition: ALc.c:1352
SetMixerFPUMode
void SetMixerFPUMode(FPUCtl *ctl)
Definition: helpers.c:193
GetContextRef
ALCcontext * GetContextRef(void)
Definition: ALc.c:1999
alc_loopback_probe
void alc_loopback_probe(enum DevProbe type)
Definition: loopback.c:85
InverseDistance
Definition: alMain.h:464
ALCdevice_struct::EffectMap
UIntMap EffectMap
Definition: alMain.h:592
CPU_CAP_NEON
Definition: alMain.h:828
func
GLenum func
Definition: SDL_opengl.h:5654
ALCcontext_struct::ActiveSourceCount
ALsizei ActiveSourceCount
Definition: alMain.h:697
GetConfigValue
const char * GetConfigValue(const char *blockName, const char *keyName, const char *def)
Definition: alcConfig.c:278
AppendCaptureDeviceList
void AppendCaptureDeviceList(const ALCchar *name)
ALCuint
unsigned int ALCuint
Definition: alc.h:60
ALfloat
float ALfloat
Definition: al.h:68
EffectList::ename
const char * ename
Definition: alMain.h:533
ALC_SHORT_SOFT
#define ALC_SHORT_SOFT
Definition: alext.h:283
alc_alsa_probe
void alc_alsa_probe(enum DevProbe type)
Definition: alsa.c:1337
ALCchar
char ALCchar
Definition: alc.h:42
ALbyte
signed char ALbyte
Definition: al.h:44
AL_EXPONENT_DISTANCE
#define AL_EXPONENT_DISTANCE
Definition: al.h:449
DevFmtByte
Definition: alMain.h:497
ret
ret
Definition: glew_str_glx.c:2
SideLeft
Definition: alMain.h:488
LockUIntMapWrite
static __inline void LockUIntMapWrite(UIntMap *map)
Definition: alMain.h:329
DevFmtX51
Definition: alMain.h:511
Sleep
#define Sleep(x)
Definition: allatency.c:34
PRINTF_STYLE
#define PRINTF_STYLE(x, y)
Definition: alMain.h:53
RWLock::write_lock
volatile ALenum write_lock
Definition: alMain.h:297
UIntMap::value
ALvoid * value
Definition: alMain.h:310
ALCdevice_struct::ALIGN
ALIGN(16) ALfloat SampleData1[BUFFERSIZE+1]
al_calloc
void * al_calloc(size_t alignment, size_t size)
Definition: helpers.c:161
ALCdevice_Unlock
#define ALCdevice_Unlock(a)
Definition: alMain.h:647
ResetUIntMap
void ResetUIntMap(UIntMap *map)
Definition: helpers.c:555
ALC_UNSIGNED_BYTE_SOFT
#define ALC_UNSIGNED_BYTE_SOFT
Definition: alext.h:282
ALL_DEVICE_PROBE
Definition: alMain.h:384
InitializeCriticalSection
void InitializeCriticalSection(CRITICAL_SECTION *cs)
Definition: helpers.c:334
RingBuffer
struct RingBuffer RingBuffer
Definition: alMain.h:750
ReadALConfig
void ReadALConfig(void)
Definition: alcConfig.c:208
alc_loopback_deinit
void alc_loopback_deinit(void)
Definition: loopback.c:81
DevFmtChannelsDefault
Definition: alMain.h:518
InitUIntMap
void InitUIntMap(UIntMap *map, ALsizei limit)
Definition: helpers.c:546
alc_alsa_deinit
void alc_alsa_deinit(void)
Definition: alsa.c:1308
alcMMDevApiProbe
void alcMMDevApiProbe(enum DevProbe type)
Definition: mmdevapi.c:1009
AL_EXPONENT_DISTANCE_CLAMPED
#define AL_EXPONENT_DISTANCE_CLAMPED
Definition: al.h:450
DevFmtStereo
Definition: alMain.h:509
ALCdevice_struct::ExtraData
void * ExtraData
Definition: alMain.h:630
alc_pa_init
ALCboolean alc_pa_init(BackendFuncs *func_list)
Definition: portaudio.c:439
ALCdevice_struct::SpeakerAngle
ALfloat SpeakerAngle[MaxChannels]
Definition: alMain.h:610
NoLog
Definition: alMain.h:793
LPALDEFERUPDATESSOFT
ALvoid(AL_APIENTRY * LPALDEFERUPDATESSOFT)(void)
Definition: alMain.h:21
DevFmtFloat
Definition: alMain.h:503
ALCdevice_struct::AuxiliaryEffectSlotMax
ALuint AuxiliaryEffectSlotMax
Definition: alMain.h:582
alcWinMMInit
ALCboolean alcWinMMInit(BackendFuncs *FuncList)
Definition: winmm.c:724
LogLevel
LogLevel
Definition: alMain.h:792
FrontLeft
Definition: alMain.h:481
ALCcontext_struct::MaxActiveEffectSlots
ALsizei MaxActiveEffectSlots
Definition: alMain.h:702
GetConfigValueBool
int GetConfigValueBool(const char *blockName, const char *keyName, int def)
Definition: alcConfig.c:356
ALCdevice_struct::Funcs
BackendFuncs * Funcs
Definition: alMain.h:629
alDeferUpdatesSOFT
AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void)
Definition: alState.c:588
ALCdevice_struct::NumChan
ALuint NumChan
Definition: alMain.h:611
DevFmtInt
Definition: alMain.h:501
u
ALuint u
Definition: alMain.h:58
alc_wave_deinit
void alc_wave_deinit(void)
Definition: wave.c:353
ALCdevice_struct::ChannelOffsets
ALuint ChannelOffsets[MaxChannels]
Definition: alMain.h:607
alc_opensl_deinit
void alc_opensl_deinit(void)
Definition: opensl.c:428
ALCdevice_struct::Speaker2Chan
enum Channel Speaker2Chan[MaxChannels]
Definition: alMain.h:609
ALC_6POINT1_SOFT
#define ALC_6POINT1_SOFT
Definition: alext.h:294
UIntMap
struct UIntMap UIntMap
StopThread
ALuint StopThread(ALvoid *thread)
Definition: alcThread.c:131
al_print
void al_print(const char *type, const char *func, const char *fmt,...)
Definition: helpers.c:450
ALeffectslot
Definition: alAuxEffectSlot.h:19
SetDefaultWFXChannelOrder
void SetDefaultWFXChannelOrder(ALCdevice *device)
Definition: ALc.c:1295
ALCdevice_struct::Bs2bLevel
ALCint Bs2bLevel
Definition: alMain.h:602
FrontCenter
Definition: alMain.h:483
length
GLsizei GLsizei * length
Definition: gl2ext.h:792
alc_ca_init
ALCboolean alc_ca_init(BackendFuncs *func_list)
Definition: coreaudio.c:685
DevFmtShort
Definition: alMain.h:499
WriteUnlock
void WriteUnlock(RWLock *lock)
Definition: helpers.c:538
data
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl2ext.h:848
DevFmtX61
Definition: alMain.h:512
TlsDestructor
UIntMap TlsDestructor
alc_wave_init
ALCboolean alc_wave_init(BackendFuncs *func_list)
Definition: wave.c:347
AL_INVERSE_DISTANCE
#define AL_INVERSE_DISTANCE
Definition: al.h:445
DeviceType
DeviceType
Definition: alMain.h:538
BackLeft
Definition: alMain.h:485
LinearDistance
Definition: alMain.h:465
ReadUnlock
void ReadUnlock(RWLock *lock)
Definition: helpers.c:525
FreeALConfig
void FreeALConfig(void)
Definition: alcConfig.c:258
alc_opensl_init
ALCboolean alc_opensl_init(BackendFuncs *func_list)
Definition: opensl.c:422
Playback
Definition: alMain.h:539
fastf2u
static __inline ALuint fastf2u(ALfloat f)
Definition: alMain.h:379
alc_sndio_probe
void alc_sndio_probe(enum DevProbe type)
Definition: sndio.c:286
UIntMap::size
ALsizei size
Definition: alMain.h:312
CreateRingBuffer
RingBuffer * CreateRingBuffer(ALsizei frame_size, ALsizei length)
Definition: alcRing.c:41
alc_pulse_deinit
void alc_pulse_deinit(void)
Definition: pulseaudio.c:1548
LogWarning
Definition: alMain.h:795
alc_oss_deinit
void alc_oss_deinit(void)
Definition: oss.c:509
ALCdevice_struct::ref
volatile RefCount ref
Definition: alMain.h:562
al_free
void al_free(void *ptr)
Definition: helpers.c:168
UnlockUIntMapRead
static __inline void UnlockUIntMapRead(UIntMap *map)
Definition: alMain.h:327
EffectList::type
int type
Definition: alMain.h:532
ALCcontext_IncRef
void ALCcontext_IncRef(ALCcontext *context)
Definition: ALc.c:1942
ALCcontext_struct::SourceDistanceModel
volatile ALboolean SourceDistanceModel
Definition: alMain.h:689
LogRef
Definition: alMain.h:797
alc_null_probe
void alc_null_probe(enum DevProbe type)
Definition: null.c:162
ALenum
int ALenum
Definition: al.h:65
ALCcontext_struct::DeferUpdates
volatile ALenum DeferUpdates
Definition: alMain.h:694
alcMMDevApiInit
ALCboolean alcMMDevApiInit(BackendFuncs *FuncList)
Definition: mmdevapi.c:970
alc_null_deinit
void alc_null_deinit(void)
Definition: null.c:158
limit
GLint limit
Definition: glew.h:11829
BackendInfo
Definition: alMain.h:408
DevFmtTypeDefault
Definition: alMain.h:505
alc_opensl_probe
void alc_opensl_probe(enum DevProbe type)
Definition: opensl.c:432
FillCPUCaps
void FillCPUCaps(ALuint capfilter)
Definition: helpers.c:73
RWLockInit
void RWLockInit(RWLock *lock)
Definition: helpers.c:506
ALuint
unsigned int ALuint
Definition: al.h:59
alc_alsa_init
ALCboolean alc_alsa_init(BackendFuncs *func_list)
Definition: alsa.c:1300
SetRTPriority
void SetRTPriority(void)
Definition: helpers.c:470
FreeHrtfs
void FreeHrtfs(void)
Definition: hrtf.c:786
UIntMap::key
ALuint key
Definition: alMain.h:309
ALintptrEXT
ptrdiff_t ALintptrEXT
Definition: alMain.h:45
DefaultDistanceModel
Definition: alMain.h:469
AL_API
#define AL_API
Definition: al.h:14
al_malloc
void * al_malloc(size_t alignment, size_t size)
Definition: helpers.c:137
RTPrioLevel
ALint RTPrioLevel
Definition: ALc.c:630
FPUCtl::state
int state
Definition: alMain.h:739
ALC_5POINT1_SOFT
#define ALC_5POINT1_SOFT
Definition: alext.h:293
ALCdevice_struct::FmtChans
enum DevFmtChannels FmtChans
Definition: alMain.h:572
ALCcontext_struct::DopplerVelocity
volatile ALfloat DopplerVelocity
Definition: alMain.h:692
alc_ca_deinit
void alc_ca_deinit(void)
Definition: coreaudio.c:691
ALCcontext_struct::LastError
ALenum LastError
Definition: alMain.h:684
RWLock::read_lock
volatile ALenum read_lock
Definition: alMain.h:295
ExponentDistance
Definition: alMain.h:466
CPU_CAP_SSE
Definition: alMain.h:827
alc_sndio_init
ALCboolean alc_sndio_init(BackendFuncs *func_list)
Definition: sndio.c:274
AL_LINEAR_DISTANCE_CLAMPED
#define AL_LINEAR_DISTANCE_CLAMPED
Definition: al.h:448
DisableDistance
Definition: alMain.h:467
DevFmtX51Side
Definition: alMain.h:516
CRITICAL_SECTION
pthread_mutex_t CRITICAL_SECTION
Definition: alMain.h:101
thread
static SDL_Thread * thread
Definition: SDL_sysjoystick.c:41
ALC_FLOAT_SOFT
#define ALC_FLOAT_SOFT
Definition: alext.h:287
BackendInfo::Funcs
BackendFuncs Funcs
Definition: alMain.h:413
alc_pa_probe
void alc_pa_probe(enum DevProbe type)
Definition: portaudio.c:461
CubicResampler
Definition: alMain.h:475
Loopback
Definition: alMain.h:541
ALlistener
Definition: alListener.h:10
CAPTURE_DEVICE_PROBE
Definition: alMain.h:385
EnterCriticalSection
void EnterCriticalSection(CRITICAL_SECTION *cs)
Definition: helpers.c:359
l
GLdouble l
Definition: glew.h:8383
ALCdevice_LockDefault
void ALCdevice_LockDefault(ALCdevice *device)
Definition: ALc.c:1277
alc_oss_init
ALCboolean alc_oss_init(BackendFuncs *func_list)
Definition: oss.c:500
ALCdevice_struct::next
ALCdevice *volatile next
Definition: alMain.h:632
DeleteCriticalSection
void DeleteCriticalSection(CRITICAL_SECTION *cs)
Definition: helpers.c:353
LogFile
FILE * LogFile
Definition: ALc.c:632
ALCcontext_DecRef
void ALCcontext_DecRef(ALCcontext *context)
Definition: ALc.c:1949
RWLock::read_entry_lock
volatile ALenum read_entry_lock
Definition: alMain.h:296
value
EGLSurface EGLint void ** value
Definition: eglext.h:301
ALC_STEREO_SOFT
#define ALC_STEREO_SOFT
Definition: alext.h:291
FPUCtl
Definition: alMain.h:738
ALCboolean
char ALCboolean
Definition: alc.h:39
alc_sndio_deinit
void alc_sndio_deinit(void)
Definition: sndio.c:282
Unlock
static void Unlock(volatile ALenum *l)
Definition: helpers.c:501
DevFmtUInt
Definition: alMain.h:502
DevFmtMono
Definition: alMain.h:508
BackendInfo::name
const char * name
Definition: alMain.h:409
LinearResampler
Definition: alMain.h:474
lock
SDL_mutex * lock
Definition: SDL_events.c:75
ALC_7POINT1_SOFT
#define ALC_7POINT1_SOFT
Definition: alext.h:295
ALC_UNSIGNED_INT_SOFT
#define ALC_UNSIGNED_INT_SOFT
Definition: alext.h:286
ALCdevice_struct::ContextList
ALCcontext *volatile ContextList
Definition: alMain.h:627
ALCdevice_struct::UpdateSize
ALuint UpdateSize
Definition: alMain.h:570
Resampler
Resampler
Definition: alMain.h:472
ALCcontext_struct
Definition: alMain.h:675
ALCdevice_struct::NumUpdates
ALuint NumUpdates
Definition: alMain.h:571
DWORD
typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex
ALCint
int ALCint
Definition: alc.h:57
UIntMap
Definition: alMain.h:307
alProcessUpdatesSOFT
AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void)
Definition: alState.c:643
LockUIntMapRead
static __inline void LockUIntMapRead(UIntMap *map)
Definition: alMain.h:325
ConfigValueFloat
int ConfigValueFloat(const char *blockName, const char *keyName, float *ret)
Definition: alcConfig.c:343
alcDSoundProbe
void alcDSoundProbe(enum DevProbe type)
Definition: dsound.c:990
ALCdevice_struct::FmtType
enum DevFmtType FmtType
Definition: alMain.h:573
String.h
FrontRight
Definition: alMain.h:482
ALCdevice_struct::DeviceName
ALCchar * DeviceName
Definition: alMain.h:575
ALboolean
char ALboolean
Definition: al.h:38
b
GLdouble GLdouble GLdouble b
Definition: glew.h:8383
ALsource
Definition: alSource.h:82
ALCdevice_struct::NumStereoSources
ALCuint NumStereoSources
Definition: alMain.h:585
ALCcontext_struct::next
ALCcontext *volatile next
Definition: alMain.h:707
alc_solaris_init
ALCboolean alc_solaris_init(BackendFuncs *func_list)
Definition: solaris.c:258
ReadRingBuffer
void ReadRingBuffer(RingBuffer *ring, ALubyte *data, ALsizei len)
Definition: alcRing.c:108
alcWinMMProbe
void alcWinMMProbe(enum DevProbe type)
Definition: winmm.c:750
alcDSoundInit
ALCboolean alcDSoundInit(BackendFuncs *FuncList)
Definition: dsound.c:961
BackendInfo::Probe
void(* Probe)(enum DevProbe)
Definition: alMain.h:412
ALCcontext_struct::Device
ALCdevice * Device
Definition: alMain.h:704
LockContext
static __inline void LockContext(ALCcontext *context)
Definition: alMain.h:728
str
#define str(s)
SideRight
Definition: alMain.h:489
PointResampler
Definition: alMain.h:473
ALC_QUAD_SOFT
#define ALC_QUAD_SOFT
Definition: alext.h:292
handle
EGLImageKHR EGLint EGLint * handle
Definition: eglext.h:284
context
TParseContext * context
Definition: glslang_tab.cpp:1907
i
int i
Definition: pngrutil.c:1377
fastf2i
static __inline ALint fastf2i(ALfloat f)
Definition: alMain.h:363
alc_wave_probe
void alc_wave_probe(enum DevProbe type)
Definition: wave.c:357
map
const GLubyte GLuint GLuint GLuint GLuint alpha GLboolean GLboolean GLboolean GLboolean alpha GLint GLint GLsizei GLsizei GLenum type GLenum GLint GLenum GLint GLint GLsizei GLsizei GLint border GLenum GLint GLint GLint GLint GLint GLsizei GLsizei height GLsizei GLsizei GLenum GLenum const GLvoid *pixels GLenum GLint GLint GLint GLint j2 GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLint *params GLenum GLenum GLfloat *params GLenum GLint GLenum GLenum GLvoid *pixels GLenum GLint GLenum GLint *params GLenum GLenum GLint *params GLenum GLsizei const GLvoid *pointer GLenum GLenum const GLint *params GLenum GLfloat GLfloat GLint GLint const GLfloat *points GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat *points GLint GLfloat GLfloat GLint GLfloat GLfloat v2 GLenum GLenum const GLint *params GLdouble GLdouble GLdouble GLdouble GLdouble GLdouble zFar GLenum map
Definition: SDL_glfuncs.h:268
ALCenum
int ALCenum
Definition: alc.h:66
CPUCapFlags
ALuint CPUCapFlags
Definition: helpers.c:70
LeaveCriticalSection
void LeaveCriticalSection(CRITICAL_SECTION *cs)
Definition: helpers.c:365
DevFmtTypeString
const ALCchar * DevFmtTypeString(enum DevFmtType type)
Definition: ALc.c:1136
DevFmtUByte
Definition: alMain.h:498
InsertUIntMapEntry
ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value)
Definition: helpers.c:565
UnlockContext
static __inline void UnlockContext(ALCcontext *context)
Definition: alMain.h:730
RemoveUIntMapKey
ALvoid * RemoveUIntMapKey(UIntMap *map, ALuint key)
Definition: helpers.c:624
BUFFERSIZE
#define BUFFERSIZE
Definition: alMain.h:556
ALCdevice_struct::LastError
volatile ALCenum LastError
Definition: alMain.h:577
alcDSoundDeinit
void alcDSoundDeinit(void)
Definition: dsound.c:969
GetHrtf
struct Hrtf * GetHrtf(ALCdevice *device)
Definition: hrtf.c:762
BytesFromDevFmt
ALuint BytesFromDevFmt(enum DevFmtType type)
Definition: ALc.c:1165
RWLock::read_count
volatile RefCount read_count
Definition: alMain.h:293
ALCcontext_struct::ActiveEffectSlots
struct ALeffectslot ** ActiveEffectSlots
Definition: alMain.h:700
LinearDistanceClamped
Definition: alMain.h:462
ALC_INT_SOFT
#define ALC_INT_SOFT
Definition: alext.h:285
alcWinMMDeinit
void alcWinMMDeinit()
Definition: winmm.c:730
DevFmtX71
Definition: alMain.h:513
DestroyRingBuffer
void DestroyRingBuffer(RingBuffer *ring)
Definition: alcRing.c:58
LogTrace
Definition: alMain.h:796
RWLock::write_count
volatile RefCount write_count
Definition: alMain.h:294
InverseDistanceClamped
Definition: alMain.h:461
ALsizeiptrEXT
ptrdiff_t ALsizeiptrEXT
Definition: alMain.h:46
ALC_MONO_SOFT
#define ALC_MONO_SOFT
Definition: alext.h:290
ALCdevice_UnlockDefault
void ALCdevice_UnlockDefault(ALCdevice *device)
Definition: ALc.c:1281
ALC_BYTE_SOFT
#define ALC_BYTE_SOFT
Definition: alext.h:281
Channel
Channel
Definition: alMain.h:480
WriteLock
void WriteLock(RWLock *lock)
Definition: helpers.c:531
DevFmtChannels
DevFmtChannels
Definition: alMain.h:507
WriteRingBuffer
void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len)
Definition: alcRing.c:78
EffectList::val
ALenum val
Definition: alMain.h:534
coeffs
GLenum GLenum const GLfloat * coeffs
Definition: glew.h:12405
AL_LINEAR_DISTANCE
#define AL_LINEAR_DISTANCE
Definition: al.h:447
MaxChannels
Definition: alMain.h:491
ChannelsFromDevFmt
ALuint ChannelsFromDevFmt(enum DevFmtChannels chans)
Definition: ALc.c:1179
ALCdevice_Lock
#define ALCdevice_Lock(a)
Definition: alMain.h:646
alc_solaris_deinit
void alc_solaris_deinit(void)
Definition: solaris.c:266
AppendAllDevicesList
void AppendAllDevicesList(const ALCchar *name)
StartThread
ALvoid * StartThread(ALuint(*func)(ALvoid *), ALvoid *ptr)
Definition: alcThread.c:100
DevProbe
DevProbe
Definition: alMain.h:383
FrameSizeFromDevFmt
static __inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans, enum DevFmtType type)
Definition: alMain.h:523
size
GLsizei size
Definition: gl2ext.h:1467
ALCdevice_struct::MaxNoOfSources
ALuint MaxNoOfSources
Definition: alMain.h:580