zenilib: zenilib/jni/external/openal-soft/Alc/helpers.c 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
helpers.c
Go to the documentation of this file.
1
21 #include "config.h"
22
23 #include <stdlib.h>
24 #include <time.h>
25 #include <errno.h>
26 #include <stdarg.h>
27 #ifdef HAVE_MALLOC_H
28 #include <malloc.h>
29 #endif
30
31 #if defined(HAVE_GUIDDEF_H) || defined(HAVE_INITGUID_H)
32 #define INITGUID
33 #include <windows.h>
34 #ifdef HAVE_GUIDDEF_H
35 #include <guiddef.h>
36 #else
37 #include <initguid.h>
38 #endif
39
40 DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80,0x00, 0x00,0xaa,0x00,0x38,0x9b,0x71);
41 DEFINE_GUID(KSDATAFORMAT_SUBTYPE_IEEE_FLOAT, 0x00000003, 0x0000, 0x0010, 0x80,0x00, 0x00,0xaa,0x00,0x38,0x9b,0x71);
42
43 DEFINE_GUID(IID_IDirectSoundNotify, 0xb0210783, 0x89cd, 0x11d0, 0xaf,0x08, 0x00,0xa0,0xc9,0x25,0xcd,0x16);
44
45 DEFINE_GUID(CLSID_MMDeviceEnumerator, 0xbcde0395, 0xe52f, 0x467c, 0x8e,0x3d, 0xc4,0x57,0x92,0x91,0x69,0x2e);
46 DEFINE_GUID(IID_IMMDeviceEnumerator, 0xa95664d2, 0x9614, 0x4f35, 0xa7,0x46, 0xde,0x8d,0xb6,0x36,0x17,0xe6);
47 DEFINE_GUID(IID_IAudioClient, 0x1cb9ad4c, 0xdbfa, 0x4c32, 0xb1,0x78, 0xc2,0xf5,0x68,0xa7,0x03,0xb2);
48 DEFINE_GUID(IID_IAudioRenderClient, 0xf294acfc, 0x3146, 0x4483, 0xa7,0xbf, 0xad,0xdc,0xa7,0xc2,0x60,0xe2);
49
50 #ifdef HAVE_MMDEVAPI
51 #include <devpropdef.h>
52 DEFINE_DEVPROPKEY(DEVPKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80,0x20, 0x67,0xd1,0x46,0xa8,0x50,0xe0, 14);
53 #endif
54 #endif
55 #ifdef HAVE_DLFCN_H
56 #include <dlfcn.h>
57 #endif
58 #ifdef HAVE_CPUID_H
59 #include <cpuid.h>
60 #endif
61 #ifdef HAVE_FLOAT_H
62 #include <float.h>
63 #endif
64 #ifdef HAVE_IEEEFP_H
65 #include <ieeefp.h>
66 #endif
67
68 #include "alMain.h"
69
70 ALuint CPUCapFlags = 0;
71
72
73 void FillCPUCaps(ALuint capfilter)
74 {
75 ALuint caps = 0;
76
77 /* FIXME: We really should get this for all available CPUs in case different
78 * CPUs have different caps (is that possible on one machine?). */
79 #if defined(HAVE_CPUID_H) && (defined(__i386__) || defined(__x86_64__) || \
80 defined(_M_IX86) || defined(_M_X64))
81 union {
82 unsigned int regs[4];
83 char str[sizeof(unsigned int[4])];
84 } cpuinf[3];
85
86 if(!__get_cpuid(0, &cpuinf[0].regs[0], &cpuinf[0].regs[1], &cpuinf[0].regs[2], &cpuinf[0].regs[3]))
87 ERR("Failed to get CPUID\n");
88 else
89 {
90 unsigned int maxfunc = cpuinf[0].regs[0];
91 unsigned int maxextfunc = 0;
92
93 if(__get_cpuid(0x80000000, &cpuinf[0].regs[0], &cpuinf[0].regs[1], &cpuinf[0].regs[2], &cpuinf[0].regs[3]))
94 maxextfunc = cpuinf[0].regs[0];
95 TRACE("Detected max CPUID function: 0x%x (ext. 0x%x)\n", maxfunc, maxextfunc);
96
97 TRACE("Vendor ID: \"%.4s%.4s%.4s\"\n", cpuinf[0].str+4, cpuinf[0].str+12, cpuinf[0].str+8);
98 if(maxextfunc >= 0x80000004 &&
99 __get_cpuid(0x80000002, &cpuinf[0].regs[0], &cpuinf[0].regs[1], &cpuinf[0].regs[2], &cpuinf[0].regs[3]) &&
100 __get_cpuid(0x80000003, &cpuinf[1].regs[0], &cpuinf[1].regs[1], &cpuinf[1].regs[2], &cpuinf[1].regs[3]) &&
101 __get_cpuid(0x80000004, &cpuinf[2].regs[0], &cpuinf[2].regs[1], &cpuinf[2].regs[2], &cpuinf[2].regs[3]))
102 TRACE("Name: \"%.16s%.16s%.16s\"\n", cpuinf[0].str, cpuinf[1].str, cpuinf[2].str);
103
104 if(maxfunc >= 1 &&
105 __get_cpuid(1, &cpuinf[0].regs[0], &cpuinf[0].regs[1], &cpuinf[0].regs[2], &cpuinf[0].regs[3]))
106 {
107 #ifdef bit_SSE
108 if((cpuinf[0].regs[3]&bit_SSE))
109 caps |= CPU_CAP_SSE;
110 #endif
111 }
112 }
113 #elif defined(HAVE_WINDOWS_H)
114 HMODULE k32 = GetModuleHandleA("kernel32.dll");
115 BOOL (WINAPI*IsProcessorFeaturePresent)(DWORD ProcessorFeature);
116 IsProcessorFeaturePresent = (BOOL(WINAPI*)(DWORD))GetProcAddress(k32, "IsProcessorFeaturePresent");
117 if(!IsProcessorFeaturePresent)
118 ERR("IsProcessorFeaturePresent not available; CPU caps not detected\n");
119 else
120 {
121 if(IsProcessorFeaturePresent(PF_XMMI_INSTRUCTIONS_AVAILABLE))
122 caps |= CPU_CAP_SSE;
123 }
124 #endif
125 #ifdef HAVE_NEON
126 /* Assume Neon support if compiled with it */
127 caps |= CPU_CAP_NEON;
128 #endif
129
130 TRACE("Got caps:%s%s%s\n", ((caps&CPU_CAP_SSE)?((capfilter&CPU_CAP_SSE)?" SSE":" (SSE)"):""),
131 ((caps&CPU_CAP_NEON)?((capfilter&CPU_CAP_NEON)?" Neon":" (Neon)"):""),
132 ((!caps)?" -none-":""));
133 CPUCapFlags = caps & capfilter;
134 }
135
136
137 void *al_malloc(size_t alignment, size_t size)
138 {
139 #if defined(HAVE_ALIGNED_ALLOC)
140 size = (size+(alignment-1))&~(alignment-1);
141 return aligned_alloc(alignment, size);
142 #elif defined(HAVE_POSIX_MEMALIGN)
143 void *ret;
144 if(posix_memalign(&ret, alignment, size) == 0)
145 return ret;
146 return NULL;
147 #elif defined(HAVE__ALIGNED_MALLOC)
148 return _aligned_malloc(size, alignment);
149 #else
150 char *ret = malloc(size+alignment);
151 if(ret != NULL)
152 {
153 *(ret++) = 0x00;
154 while(((ALintptrEXT)ret&(alignment-1)) != 0)
155 *(ret++) = 0x55;
156 }
157 return ret;
158 #endif
159 }
160
161 void *al_calloc(size_t alignment, size_t size)
162 {
163 void *ret = al_malloc(alignment, size);
164 if(ret) memset(ret, 0, size);
165 return ret;
166 }
167
168 void al_free(void *ptr)
169 {
170 #if defined(HAVE_ALIGNED_ALLOC) || defined(HAVE_POSIX_MEMALIGN)
171 free(ptr);
172 #elif defined(HAVE__ALIGNED_MALLOC)
173 _aligned_free(ptr);
174 #else
175 if(ptr != NULL)
176 {
177 char *finder = ptr;
178 do {
179 --finder;
180 } while(*finder == 0x55);
181 free(finder);
182 }
183 #endif
184 }
185
186
187 #if (defined(HAVE___CONTROL87_2) || defined(HAVE__CONTROLFP)) && (defined(__x86_64__) || defined(_M_X64))
188 /* Win64 doesn't allow us to set the precision control. */
189 #undef _MCW_PC
190 #define _MCW_PC 0
191 #endif
192
193 void SetMixerFPUMode(FPUCtl *ctl)
194 {
195 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
196 unsigned short fpuState;
197 __asm__ __volatile__("fnstcw %0" : "=m" (*&fpuState));
198 ctl->state = fpuState;
199 fpuState &= ~0x300; /* clear precision to single */
200 fpuState |= 0xC00; /* set round-to-zero */
201 __asm__ __volatile__("fldcw %0" : : "m" (*&fpuState));
202 #ifdef HAVE_SSE
203 if((CPUCapFlags&CPU_CAP_SSE))
204 {
205 int sseState;
206 __asm__ __volatile__("stmxcsr %0" : "=m" (*&sseState));
207 ctl->sse_state = sseState;
208 sseState |= 0x0C00; /* set round-to-zero */
209 sseState |= 0x8000; /* set flush-to-zero */
210 __asm__ __volatile__("ldmxcsr %0" : : "m" (*&sseState));
211 }
212 #endif
213 #elif defined(HAVE___CONTROL87_2)
214 int mode;
215 __control87_2(0, 0, &ctl->state, NULL);
216 __control87_2(_RC_CHOP|_PC_24, _MCW_RC|_MCW_PC, &mode, NULL);
217 #ifdef HAVE_SSE
218 if((CPUCapFlags&CPU_CAP_SSE))
219 {
220 __control87_2(0, 0, NULL, &ctl->sse_state);
221 __control87_2(_RC_CHOP|_DN_FLUSH, _MCW_RC|_MCW_DN, NULL, &mode);
222 }
223 #endif
224 #elif defined(HAVE__CONTROLFP)
225 ctl->state = _controlfp(0, 0);
226 (void)_controlfp(_RC_CHOP|_PC_24, _MCW_RC|_MCW_PC);
227 #elif defined(HAVE_FESETROUND)
228 ctl->state = fegetround();
229 #ifdef FE_TOWARDZERO
230 fesetround(FE_TOWARDZERO);
231 #endif
232 #endif
233 }
234
235 void RestoreFPUMode(const FPUCtl *ctl)
236 {
237 #if defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
238 unsigned short fpuState = ctl->state;
239 __asm__ __volatile__("fldcw %0" : : "m" (*&fpuState));
240 #ifdef HAVE_SSE
241 if((CPUCapFlags&CPU_CAP_SSE))
242 __asm__ __volatile__("ldmxcsr %0" : : "m" (*&ctl->sse_state));
243 #endif
244 #elif defined(HAVE___CONTROL87_2)
245 int mode;
246 __control87_2(ctl->state, _MCW_RC|_MCW_PC, &mode, NULL);
247 #ifdef HAVE_SSE
248 if((CPUCapFlags&CPU_CAP_SSE))
249 __control87_2(ctl->sse_state, _MCW_RC|_MCW_DN, NULL, &mode);
250 #endif
251 #elif defined(HAVE__CONTROLFP)
252 _controlfp(ctl->state, _MCW_RC|_MCW_PC);
253 #elif defined(HAVE_FESETROUND)
254 fesetround(ctl->state);
255 #endif
256 }
257
258
259 #ifdef _WIN32
260 void pthread_once(pthread_once_t *once, void (*callback)(void))
261 {
262 LONG ret;
263 while((ret=InterlockedExchange(once, 1)) == 1)
264 sched_yield();
265 if(ret == 0)
266 callback();
267 InterlockedExchange(once, 2);
268 }
269
270
271 int pthread_key_create(pthread_key_t *key, void (*callback)(void*))
272 {
273 *key = TlsAlloc();
274 if(callback)
275 InsertUIntMapEntry(&TlsDestructor, *key, callback);
276 return 0;
277 }
278
279 int pthread_key_delete(pthread_key_t key)
280 {
281 InsertUIntMapEntry(&TlsDestructor, key, NULL);
282 TlsFree(key);
283 return 0;
284 }
285
286 void *pthread_getspecific(pthread_key_t key)
287 { return TlsGetValue(key); }
288
289 int pthread_setspecific(pthread_key_t key, void *val)
290 {
291 TlsSetValue(key, val);
292 return 0;
293 }
294
295
296 void *LoadLib(const char *name)
297 { return LoadLibraryA(name); }
298 void CloseLib(void *handle)
299 { FreeLibrary((HANDLE)handle); }
300 void *GetSymbol(void *handle, const char *name)
301 {
302 void *ret;
303
304 ret = (void*)GetProcAddress((HANDLE)handle, name);
305 if(ret == NULL)
306 ERR("Failed to load %s\n", name);
307 return ret;
308 }
309
310 WCHAR *strdupW(const WCHAR *str)
311 {
312 const WCHAR *n;
313 WCHAR *ret;
314 size_t len;
315
316 n = str;
317 while(*n) n++;
318 len = n - str;
319
320 ret = calloc(sizeof(WCHAR), len+1);
321 if(ret != NULL)
322 memcpy(ret, str, sizeof(WCHAR)*len);
323 return ret;
324 }
325
326 #else
327
328 #include <pthread.h>
329 #ifdef HAVE_PTHREAD_NP_H
330 #include <pthread_np.h>
331 #endif
332 #include <sched.h>
333
334 void InitializeCriticalSection(CRITICAL_SECTION *cs)
335 {
336 pthread_mutexattr_t attrib;
337 int ret;
338
339 ret = pthread_mutexattr_init(&attrib);
340 assert(ret == 0);
341
342 ret = pthread_mutexattr_settype(&attrib, PTHREAD_MUTEX_RECURSIVE);
343 #ifdef HAVE_PTHREAD_NP_H
344 if(ret != 0)
345 ret = pthread_mutexattr_setkind_np(&attrib, PTHREAD_MUTEX_RECURSIVE);
346 #endif
347 assert(ret == 0);
348 ret = pthread_mutex_init(cs, &attrib);
349 assert(ret == 0);
350
351 pthread_mutexattr_destroy(&attrib);
352 }
353 void DeleteCriticalSection(CRITICAL_SECTION *cs)
354 {
355 int ret;
356 ret = pthread_mutex_destroy(cs);
357 assert(ret == 0);
358 }
359 void EnterCriticalSection(CRITICAL_SECTION *cs)
360 {
361 int ret;
362 ret = pthread_mutex_lock(cs);
363 assert(ret == 0);
364 }
365 void LeaveCriticalSection(CRITICAL_SECTION *cs)
366 {
367 int ret;
368 ret = pthread_mutex_unlock(cs);
369 assert(ret == 0);
370 }
371
372 /* NOTE: This wrapper isn't quite accurate as it returns an ALuint, as opposed
373 * to the expected DWORD. Both are defined as unsigned 32-bit types, however.
374 * Additionally, Win32 is supposed to measure the time since Windows started,
375 * as opposed to the actual time. */
376 ALuint timeGetTime(void)
377 {
378 #if _POSIX_TIMERS > 0
379 struct timespec ts;
380 int ret = -1;
381
382 #if defined(_POSIX_MONOTONIC_CLOCK) && (_POSIX_MONOTONIC_CLOCK >= 0)
383 #if _POSIX_MONOTONIC_CLOCK == 0
384 static int hasmono = 0;
385 if(hasmono > 0 || (hasmono == 0 &&
386 (hasmono=sysconf(_SC_MONOTONIC_CLOCK)) > 0))
387 #endif
388 ret = clock_gettime(CLOCK_MONOTONIC, &ts);
389 #endif
390 if(ret != 0)
391 ret = clock_gettime(CLOCK_REALTIME, &ts);
392 assert(ret == 0);
393
394 return ts.tv_nsec/1000000 + ts.tv_sec*1000;
395 #else
396 struct timeval tv;
397 int ret;
398
399 ret = gettimeofday(&tv, NULL);
400 assert(ret == 0);
401
402 return tv.tv_usec/1000 + tv.tv_sec*1000;
403 #endif
404 }
405
406 void Sleep(ALuint t)
407 {
408 struct timespec tv, rem;
409 tv.tv_nsec = (t*1000000)%1000000000;
410 tv.tv_sec = t/1000;
411
412 while(nanosleep(&tv, &rem) == -1 && errno == EINTR)
413 tv = rem;
414 }
415
416 #ifdef HAVE_DLFCN_H
417
418 void *LoadLib(const char *name)
419 {
420 const char *err;
421 void *handle;
422
423 dlerror();
424 handle = dlopen(name, RTLD_NOW);
425 if((err=dlerror()) != NULL)
426 handle = NULL;
427 return handle;
428 }
429 void CloseLib(void *handle)
430 { dlclose(handle); }
431 void *GetSymbol(void *handle, const char *name)
432 {
433 const char *err;
434 void *sym;
435
436 dlerror();
437 sym = dlsym(handle, name);
438 if((err=dlerror()) != NULL)
439 {
440 WARN("Failed to load %s: %s\n", name, err);
441 sym = NULL;
442 }
443 return sym;
444 }
445
446 #endif
447 #endif
448
449
450 void al_print(const char *type, const char *func, const char *fmt, ...)
451 {
452 char str[256];
453 int i;
454
455 i = snprintf(str, sizeof(str), "AL lib: %s %s: ", type, func);
456 if(i > 0 && (unsigned int)i < sizeof(str))
457 {
458 va_list ap;
459 va_start(ap, fmt);
460 vsnprintf(str+i, sizeof(str)-i, fmt, ap);
461 va_end(ap);
462 }
463 str[sizeof(str)-1] = 0;
464
465 fprintf(LogFile, "%s", str);
466 fflush(LogFile);
467 }
468
469
470 void SetRTPriority(void)
471 {
472 ALboolean failed = AL_FALSE;
473
474 #ifdef _WIN32
475 if(RTPrioLevel > 0)
476 failed = !SetThreadPriority(GetCurrentThread(), THREAD_PRIORITY_TIME_CRITICAL);
477 #elif defined(HAVE_PTHREAD_SETSCHEDPARAM) && !defined(__OpenBSD__)
478 if(RTPrioLevel > 0)
479 {
480 struct sched_param param;
481 /* Use the minimum real-time priority possible for now (on Linux this
482 * should be 1 for SCHED_RR) */
483 param.sched_priority = sched_get_priority_min(SCHED_RR);
484 failed = !!pthread_setschedparam(pthread_self(), SCHED_RR, &param);
485 }
486 #else
487 /* Real-time priority not available */
488 failed = (RTPrioLevel>0);
489 #endif
490 if(failed)
491 ERR("Failed to set priority level for thread\n");
492 }
493
494
495 static void Lock(volatile ALenum *l)
496 {
497 while(ExchangeInt(l, AL_TRUE) == AL_TRUE)
498 sched_yield();
499 }
500
501 static void Unlock(volatile ALenum *l)
502 {
503 ExchangeInt(l, AL_FALSE);
504 }
505
506 void RWLockInit(RWLock *lock)
507 {
508 lock->read_count = 0;
509 lock->write_count = 0;
510 lock->read_lock = AL_FALSE;
511 lock->read_entry_lock = AL_FALSE;
512 lock->write_lock = AL_FALSE;
513 }
514
515 void ReadLock(RWLock *lock)
516 {
517 Lock(&lock->read_entry_lock);
518 Lock(&lock->read_lock);
519 if(IncrementRef(&lock->read_count) == 1)
520 Lock(&lock->write_lock);
521 Unlock(&lock->read_lock);
522 Unlock(&lock->read_entry_lock);
523 }
524
525 void ReadUnlock(RWLock *lock)
526 {
527 if(DecrementRef(&lock->read_count) == 0)
528 Unlock(&lock->write_lock);
529 }
530
531 void WriteLock(RWLock *lock)
532 {
533 if(IncrementRef(&lock->write_count) == 1)
534 Lock(&lock->read_lock);
535 Lock(&lock->write_lock);
536 }
537
538 void WriteUnlock(RWLock *lock)
539 {
540 Unlock(&lock->write_lock);
541 if(DecrementRef(&lock->write_count) == 0)
542 Unlock(&lock->read_lock);
543 }
544
545
546 void InitUIntMap(UIntMap *map, ALsizei limit)
547 {
548 map->array = NULL;
549 map->size = 0;
550 map->maxsize = 0;
551 map->limit = limit;
552 RWLockInit(&map->lock);
553 }
554
555 void ResetUIntMap(UIntMap *map)
556 {
557 WriteLock(&map->lock);
558 free(map->array);
559 map->array = NULL;
560 map->size = 0;
561 map->maxsize = 0;
562 WriteUnlock(&map->lock);
563 }
564
565 ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value)
566 {
567 ALsizei pos = 0;
568
569 WriteLock(&map->lock);
570 if(map->size > 0)
571 {
572 ALsizei low = 0;
573 ALsizei high = map->size - 1;
574 while(low < high)
575 {
576 ALsizei mid = low + (high-low)/2;
577 if(map->array[mid].key < key)
578 low = mid + 1;
579 else
580 high = mid;
581 }
582 if(map->array[low].key < key)
583 low++;
584 pos = low;
585 }
586
587 if(pos == map->size || map->array[pos].key != key)
588 {
589 if(map->size == map->limit)
590 {
591 WriteUnlock(&map->lock);
592 return AL_OUT_OF_MEMORY;
593 }
594
595 if(map->size == map->maxsize)
596 {
597 ALvoid *temp = NULL;
598 ALsizei newsize;
599
600 newsize = (map->maxsize ? (map->maxsize<<1) : 4);
601 if(newsize >= map->maxsize)
602 temp = realloc(map->array, newsize*sizeof(map->array[0]));
603 if(!temp)
604 {
605 WriteUnlock(&map->lock);
606 return AL_OUT_OF_MEMORY;
607 }
608 map->array = temp;
609 map->maxsize = newsize;
610 }
611
612 if(pos < map->size)
613 memmove(&map->array[pos+1], &map->array[pos],
614 (map->size-pos)*sizeof(map->array[0]));
615 map->size++;
616 }
617 map->array[pos].key = key;
618 map->array[pos].value = value;
619 WriteUnlock(&map->lock);
620
621 return AL_NO_ERROR;
622 }
623
624 ALvoid *RemoveUIntMapKey(UIntMap *map, ALuint key)
625 {
626 ALvoid *ptr = NULL;
627 WriteLock(&map->lock);
628 if(map->size > 0)
629 {
630 ALsizei low = 0;
631 ALsizei high = map->size - 1;
632 while(low < high)
633 {
634 ALsizei mid = low + (high-low)/2;
635 if(map->array[mid].key < key)
636 low = mid + 1;
637 else
638 high = mid;
639 }
640 if(map->array[low].key == key)
641 {
642 ptr = map->array[low].value;
643 if(low < map->size-1)
644 memmove(&map->array[low], &map->array[low+1],
645 (map->size-1-low)*sizeof(map->array[0]));
646 map->size--;
647 }
648 }
649 WriteUnlock(&map->lock);
650 return ptr;
651 }
652
653 ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key)
654 {
655 ALvoid *ptr = NULL;
656 ReadLock(&map->lock);
657 if(map->size > 0)
658 {
659 ALsizei low = 0;
660 ALsizei high = map->size - 1;
661 while(low < high)
662 {
663 ALsizei mid = low + (high-low)/2;
664 if(map->array[mid].key < key)
665 low = mid + 1;
666 else
667 high = mid;
668 }
669 if(map->array[low].key == key)
670 ptr = map->array[low].value;
671 }
672 ReadUnlock(&map->lock);
673 return ptr;
674 }
val
GLuint const GLfloat * val
Definition: glew.h:2715
ALvoid
void ALvoid
Definition: al.h:74
type
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: gl2ext.h:845
void
GLvoid **typedef void(GLAPIENTRY *PFNGLGETVERTEXATTRIBDVPROC)(GLuint
Definition: glew.h:1824
AL_TRUE
#define AL_TRUE
Definition: al.h:86
NULL
#define NULL
Definition: ftobjs.h:61
TRACE
#define TRACE(...)
Definition: alMain.h:806
UIntMap::array
struct UIntMap::@59 * array
timeGetTime
ALuint timeGetTime(void)
Definition: helpers.c:376
RWLock
Definition: alMain.h:292
n
GLclampd n
Definition: glew.h:7287
memmove
#define memmove
Definition: SDL_qsort.c:81
ALsizei
int ALsizei
Definition: al.h:62
ReadLock
void ReadLock(RWLock *lock)
Definition: helpers.c:515
sym
SDL_Keycode sym
Definition: SDL_pspevents.c:51
free
SDL_EventEntry * free
Definition: SDL_events.c:80
Lock
static void Lock(volatile ALenum *l)
Definition: helpers.c:495
t
GLdouble GLdouble t
Definition: glew.h:1384
memset
#define memset
Definition: SDL_malloc.c:633
AL_FALSE
#define AL_FALSE
Definition: al.h:83
UIntMap::maxsize
ALsizei maxsize
Definition: alMain.h:313
UIntMap::lock
RWLock lock
Definition: alMain.h:315
LookupUIntMapKey
ALvoid * LookupUIntMapKey(UIntMap *map, ALuint key)
Definition: helpers.c:653
UIntMap::limit
ALsizei limit
Definition: alMain.h:314
name
EGLImageKHR EGLint * name
Definition: eglext.h:284
assert
#define assert(x)
Definition: SDL_malloc.c:1234
len
GLenum GLsizei len
Definition: glew.h:7035
RestoreFPUMode
void RestoreFPUMode(const FPUCtl *ctl)
Definition: helpers.c:235
SetMixerFPUMode
void SetMixerFPUMode(FPUCtl *ctl)
Definition: helpers.c:193
CPU_CAP_NEON
Definition: alMain.h:828
func
GLenum func
Definition: SDL_opengl.h:5654
calloc
#define calloc
Definition: SDL_malloc.c:636
ret
ret
Definition: glew_str_glx.c:2
Sleep
#define Sleep(x)
Definition: allatency.c:34
RWLock::write_lock
volatile ALenum write_lock
Definition: alMain.h:297
UIntMap::value
ALvoid * value
Definition: alMain.h:310
al_calloc
void * al_calloc(size_t alignment, size_t size)
Definition: helpers.c:161
ResetUIntMap
void ResetUIntMap(UIntMap *map)
Definition: helpers.c:555
InitializeCriticalSection
void InitializeCriticalSection(CRITICAL_SECTION *cs)
Definition: helpers.c:334
InitUIntMap
void InitUIntMap(UIntMap *map, ALsizei limit)
Definition: helpers.c:546
HANDLE
typedef HANDLE(WINAPI *PFNWGLCREATEBUFFERREGIONARBPROC)(HDC hDC
al_print
void al_print(const char *type, const char *func, const char *fmt,...)
Definition: helpers.c:450
alMain.h
WriteUnlock
void WriteUnlock(RWLock *lock)
Definition: helpers.c:538
TlsDestructor
UIntMap TlsDestructor
ReadUnlock
void ReadUnlock(RWLock *lock)
Definition: helpers.c:525
UIntMap::size
ALsizei size
Definition: alMain.h:312
al_free
void al_free(void *ptr)
Definition: helpers.c:168
realloc
#define realloc
Definition: SDL_malloc.c:637
ALenum
int ALenum
Definition: al.h:65
DEFINE_GUID
DEFINE_GUID(KSDATAFORMAT_SUBTYPE_PCM, 0x00000001, 0x0000, 0x0010, 0x80, 0x00, 0x00, 0xaa, 0x00, 0x38, 0x9b, 0x71)
limit
GLint limit
Definition: glew.h:11829
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
SetRTPriority
void SetRTPriority(void)
Definition: helpers.c:470
UIntMap::key
ALuint key
Definition: alMain.h:309
ALintptrEXT
ptrdiff_t ALintptrEXT
Definition: alMain.h:45
al_malloc
void * al_malloc(size_t alignment, size_t size)
Definition: helpers.c:137
WARN
#define WARN(...)
Definition: alMain.h:811
RTPrioLevel
ALint RTPrioLevel
Definition: ALc.c:630
FPUCtl::state
int state
Definition: alMain.h:739
RWLock::read_lock
volatile ALenum read_lock
Definition: alMain.h:295
CPU_CAP_SSE
Definition: alMain.h:827
CRITICAL_SECTION
pthread_mutex_t CRITICAL_SECTION
Definition: alMain.h:101
EnterCriticalSection
void EnterCriticalSection(CRITICAL_SECTION *cs)
Definition: helpers.c:359
l
GLdouble l
Definition: glew.h:8383
malloc
#define malloc
Definition: SDL_malloc.c:635
DeleteCriticalSection
void DeleteCriticalSection(CRITICAL_SECTION *cs)
Definition: helpers.c:353
LogFile
FILE * LogFile
Definition: ALc.c:632
RWLock::read_entry_lock
volatile ALenum read_entry_lock
Definition: alMain.h:296
value
EGLSurface EGLint void ** value
Definition: eglext.h:301
FPUCtl
Definition: alMain.h:738
Unlock
static void Unlock(volatile ALenum *l)
Definition: helpers.c:501
ERR
#define ERR(...)
Definition: alMain.h:816
lock
SDL_mutex * lock
Definition: SDL_events.c:75
memcpy
#define memcpy
Definition: SDL_malloc.c:634
DWORD
typedef DWORD(WINAPI *XInputGetState_t)(DWORD dwUserIndex
UIntMap
Definition: alMain.h:307
AL_OUT_OF_MEMORY
#define AL_OUT_OF_MEMORY
Definition: al.h:379
low
u_int32_t low
Definition: e_rem_pio2.c:101
ALboolean
char ALboolean
Definition: al.h:38
str
#define str(s)
handle
EGLImageKHR EGLint EGLint * handle
Definition: eglext.h:284
i
int i
Definition: pngrutil.c:1377
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
CPUCapFlags
ALuint CPUCapFlags
Definition: helpers.c:70
LeaveCriticalSection
void LeaveCriticalSection(CRITICAL_SECTION *cs)
Definition: helpers.c:365
InsertUIntMapEntry
ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value)
Definition: helpers.c:565
RemoveUIntMapKey
ALvoid * RemoveUIntMapKey(UIntMap *map, ALuint key)
Definition: helpers.c:624
RWLock::read_count
volatile RefCount read_count
Definition: alMain.h:293
DEFINE_DEVPROPKEY
DEFINE_DEVPROPKEY(DEVPKEY_Device_FriendlyName, 0xa45c254e, 0xdf1c, 0x4efd, 0x80, 0x20, 0x67, 0xd1, 0x46, 0xa8, 0x50, 0xe0, 14)
RWLock::write_count
volatile RefCount write_count
Definition: alMain.h:294
mode
GLenum mode
Definition: glew.h:2394
AL_NO_ERROR
#define AL_NO_ERROR
Definition: al.h:364
WriteLock
void WriteLock(RWLock *lock)
Definition: helpers.c:531
BOOL
typedef BOOL(WINAPI *PFNWGLSETSTEREOEMITTERSTATE3DLPROC)(HDC hDC
size
GLsizei size
Definition: gl2ext.h:1467