13 #ifdef HAVE_FPU_CONTROL_H
14 #include <fpu_control.h>
21 #ifndef AL_SOFT_deferred_updates
22 #define AL_SOFT_deferred_updates 1
23 #define AL_DEFERRED_UPDATES_SOFT 0xC002
24 typedef ALvoid (AL_APIENTRY
*LPALDEFERUPDATESSOFT
)(void);
25 typedef ALvoid (AL_APIENTRY
*LPALPROCESSUPDATESSOFT
)(void);
26 #ifdef AL_ALEXT_PROTOTYPES
27 AL_API ALvoid AL_APIENTRY
alDeferUpdatesSOFT(void);
28 AL_API ALvoid AL_APIENTRY
alProcessUpdatesSOFT(void);
33 #if defined(HAVE_STDINT_H)
35 typedef int64_t ALint64
;
36 typedef uint64_t ALuint64
;
37 #elif defined(HAVE___INT64)
38 typedef __int64 ALint64
;
39 typedef unsigned __int64 ALuint64
;
40 #elif (SIZEOF_LONG == 8)
42 typedef unsigned long ALuint64
;
43 #elif (SIZEOF_LONG_LONG == 8)
44 typedef long long ALint64
;
45 typedef unsigned long long ALuint64
;
48 typedef ptrdiff_t ALintptrEXT
;
49 typedef ptrdiff_t ALsizeiptrEXT
;
51 #ifdef HAVE_GCC_FORMAT
52 #define PRINTF_STYLE(x, y) __attribute__((format(printf, (x), (y))))
54 #define PRINTF_STYLE(x, y)
57 #if defined(HAVE_RESTRICT)
58 #define RESTRICT restrict
59 #elif defined(HAVE___RESTRICT)
60 #define RESTRICT __restrict
68 ALubyte b
[sizeof(ALuint
)];
70 #define IS_LITTLE_ENDIAN (EndianTest.b[0] == 1)
72 #define COUNTOF(x) (sizeof((x))/sizeof((x)[0]))
78 typedef DWORD pthread_key_t
;
79 int pthread_key_create(pthread_key_t
*key
, void (*callback
)(void*));
80 int pthread_key_delete(pthread_key_t key
);
81 void *pthread_getspecific(pthread_key_t key
);
82 int pthread_setspecific(pthread_key_t key
, void *val
);
84 #define HAVE_DYNLOAD 1
85 void *LoadLib(const char *name
);
86 void CloseLib(void *handle
);
87 void *GetSymbol(void *handle
, const char *name
);
89 WCHAR
*strdupW(const WCHAR
*str
);
91 typedef LONG pthread_once_t
;
92 #define PTHREAD_ONCE_INIT 0
93 void pthread_once(pthread_once_t
*once
, void (*callback
)(void));
95 static __inline
int sched_yield(void)
96 { SwitchToThread(); return 0; }
103 #ifdef HAVE_PTHREAD_NP_H
104 #include <pthread_np.h>
106 #include <sys/time.h>
110 #define IsBadWritePtr(a,b) ((a) == NULL && (b) != 0)
112 typedef pthread_mutex_t CRITICAL_SECTION
;
113 void InitializeCriticalSection(CRITICAL_SECTION
*cs
);
114 void DeleteCriticalSection(CRITICAL_SECTION
*cs
);
115 void EnterCriticalSection(CRITICAL_SECTION
*cs
);
116 void LeaveCriticalSection(CRITICAL_SECTION
*cs
);
118 ALuint
timeGetTime(void);
119 void Sleep(ALuint t
);
121 #if defined(HAVE_DLFCN_H)
122 #define HAVE_DYNLOAD 1
123 void *LoadLib(const char *name
);
124 void CloseLib(void *handle
);
125 void *GetSymbol(void *handle
, const char *name
);
130 typedef void *volatile XchgPtr
;
132 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
133 typedef ALuint RefCount
;
134 static __inline RefCount
IncrementRef(volatile RefCount
*ptr
)
135 { return __sync_add_and_fetch(ptr
, 1); }
136 static __inline RefCount
DecrementRef(volatile RefCount
*ptr
)
137 { return __sync_sub_and_fetch(ptr
, 1); }
139 static __inline
int ExchangeInt(volatile int *ptr
, int newval
)
141 return __sync_lock_test_and_set(ptr
, newval
);
143 static __inline
void *ExchangePtr(XchgPtr
*ptr
, void *newval
)
145 return __sync_lock_test_and_set(ptr
, newval
);
147 static __inline ALboolean
CompExchangeInt(volatile int *ptr
, int oldval
, int newval
)
149 return __sync_bool_compare_and_swap(ptr
, oldval
, newval
);
151 static __inline ALboolean
CompExchangePtr(XchgPtr
*ptr
, void *oldval
, void *newval
)
153 return __sync_bool_compare_and_swap(ptr
, oldval
, newval
);
156 #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
158 static __inline
int xaddl(volatile int *dest
, int incr
)
161 __asm__
__volatile__("lock; xaddl %0,(%1)"
163 : "r" (dest
), "0" (incr
)
168 typedef int RefCount
;
169 static __inline RefCount
IncrementRef(volatile RefCount
*ptr
)
170 { return xaddl(ptr
, 1)+1; }
171 static __inline RefCount
DecrementRef(volatile RefCount
*ptr
)
172 { return xaddl(ptr
, -1)-1; }
174 static __inline
int ExchangeInt(volatile int *dest
, int newval
)
177 __asm__
__volatile__("lock; xchgl %0,(%1)"
179 : "r" (dest
), "0" (newval
)
184 static __inline ALboolean
CompExchangeInt(volatile int *dest
, int oldval
, int newval
)
187 __asm__
__volatile__("lock; cmpxchgl %2,(%1)"
189 : "r" (dest
), "r" (newval
), "0" (oldval
)
191 return ret
== oldval
;
194 static __inline
void *ExchangePtr(XchgPtr
*dest
, void *newval
)
197 __asm__
__volatile__(
199 "lock; xchgl %0,(%1)"
201 "lock; xchgq %0,(%1)"
204 : "r" (dest
), "0" (newval
)
210 static __inline ALboolean
CompExchangePtr(XchgPtr
*dest
, void *oldval
, void *newval
)
213 __asm__
__volatile__(
215 "lock; cmpxchgl %2,(%1)"
217 "lock; cmpxchgq %2,(%1)"
220 : "r" (dest
), "r" (newval
), "0" (oldval
)
223 return ret
== oldval
;
226 #elif defined(_WIN32)
228 typedef LONG RefCount
;
229 static __inline RefCount
IncrementRef(volatile RefCount
*ptr
)
230 { return InterlockedIncrement(ptr
); }
231 static __inline RefCount
DecrementRef(volatile RefCount
*ptr
)
232 { return InterlockedDecrement(ptr
); }
234 extern ALbyte LONG_size_does_not_match_int
[(sizeof(LONG
)==sizeof(int))?1:-1];
236 static __inline
int ExchangeInt(volatile int *ptr
, int newval
)
242 return InterlockedExchange(u
.l
, newval
);
244 static __inline
void *ExchangePtr(XchgPtr
*ptr
, void *newval
)
246 return InterlockedExchangePointer(ptr
, newval
);
248 static __inline ALboolean
CompExchangeInt(volatile int *ptr
, int oldval
, int newval
)
254 return InterlockedCompareExchange(u
.l
, newval
, oldval
) == oldval
;
256 static __inline ALboolean
CompExchangePtr(XchgPtr
*ptr
, void *oldval
, void *newval
)
258 return InterlockedCompareExchangePointer(ptr
, newval
, oldval
) == oldval
;
261 #elif defined(__APPLE__)
263 #include <libkern/OSAtomic.h>
265 typedef int32_t RefCount
;
266 static __inline RefCount
IncrementRef(volatile RefCount
*ptr
)
267 { return OSAtomicIncrement32Barrier(ptr
); }
268 static __inline RefCount
DecrementRef(volatile RefCount
*ptr
)
269 { return OSAtomicDecrement32Barrier(ptr
); }
271 static __inline
int ExchangeInt(volatile int *ptr
, int newval
)
273 /* Really? No regular old atomic swap? */
277 } while(!OSAtomicCompareAndSwap32Barrier(oldval
, newval
, ptr
));
280 static __inline
void *ExchangePtr(XchgPtr
*ptr
, void *newval
)
285 } while(!OSAtomicCompareAndSwapPtrBarrier(oldval
, newval
, ptr
));
288 static __inline ALboolean
CompExchangeInt(volatile int *ptr
, int oldval
, int newval
)
290 return OSAtomicCompareAndSwap32Barrier(oldval
, newval
, ptr
);
292 static __inline ALboolean
CompExchangePtr(XchgPtr
*ptr
, void *oldval
, void *newval
)
294 return OSAtomicCompareAndSwapPtrBarrier(oldval
, newval
, ptr
);
298 #error "No atomic functions available on this platform!"
299 typedef ALuint RefCount
;
304 volatile RefCount read_count
;
305 volatile RefCount write_count
;
306 volatile ALenum read_lock
;
307 volatile ALenum read_entry_lock
;
308 volatile ALenum write_lock
;
311 void RWLockInit(RWLock
*lock
);
312 void ReadLock(RWLock
*lock
);
313 void ReadUnlock(RWLock
*lock
);
314 void WriteLock(RWLock
*lock
);
315 void WriteUnlock(RWLock
*lock
);
318 typedef struct UIntMap
{
328 extern UIntMap TlsDestructor
;
330 void InitUIntMap(UIntMap
*map
, ALsizei limit
);
331 void ResetUIntMap(UIntMap
*map
);
332 ALenum
InsertUIntMapEntry(UIntMap
*map
, ALuint key
, ALvoid
*value
);
333 ALvoid
*RemoveUIntMapKey(UIntMap
*map
, ALuint key
);
334 ALvoid
*LookupUIntMapKey(UIntMap
*map
, ALuint key
);
336 static __inline
void LockUIntMapRead(UIntMap
*map
)
337 { ReadLock(&map
->lock
); }
338 static __inline
void UnlockUIntMapRead(UIntMap
*map
)
339 { ReadUnlock(&map
->lock
); }
340 static __inline
void LockUIntMapWrite(UIntMap
*map
)
341 { WriteLock(&map
->lock
); }
342 static __inline
void UnlockUIntMapWrite(UIntMap
*map
)
343 { WriteUnlock(&map
->lock
); }
345 #include "alListener.h"
353 #define DEFAULT_OUTPUT_RATE (44100)
354 #define MIN_OUTPUT_RATE (8000)
356 #define SPEEDOFSOUNDMETRESPERSEC (343.3f)
357 #define AIRABSORBGAINHF (0.99426f) /* -0.05dB */
359 #define LOWPASSFREQREF (5000)
365 // Find the next power-of-2 for non-power-of-2 numbers.
366 static __inline ALuint
NextPowerOf2(ALuint value
)
382 /* Fast float-to-int conversion. Assumes the FPU is already in round-to-zero
384 static __inline ALint
fastf2i(ALfloat f
)
387 #if defined(_MSC_VER) && defined(_M_IX86)
390 #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
391 __asm__
__volatile__("flds %1\n\t"
401 /* Fast float-to-uint conversion. Assumes the FPU is already in round-to-zero
403 static __inline ALuint
fastf2u(ALfloat f
)
404 { return fastf2i(f
); }
413 ALCenum (*OpenPlayback
)(ALCdevice
*, const ALCchar
*);
414 void (*ClosePlayback
)(ALCdevice
*);
415 ALCboolean (*ResetPlayback
)(ALCdevice
*);
416 ALCboolean (*StartPlayback
)(ALCdevice
*);
417 void (*StopPlayback
)(ALCdevice
*);
419 ALCenum (*OpenCapture
)(ALCdevice
*, const ALCchar
*);
420 void (*CloseCapture
)(ALCdevice
*);
421 void (*StartCapture
)(ALCdevice
*);
422 void (*StopCapture
)(ALCdevice
*);
423 ALCenum (*CaptureSamples
)(ALCdevice
*, void*, ALCuint
);
424 ALCuint (*AvailableSamples
)(ALCdevice
*);
429 ALCboolean (*Init
)(BackendFuncs
*);
430 void (*Deinit
)(void);
431 void (*Probe
)(enum DevProbe
);
435 ALCboolean
alc_alsa_init(BackendFuncs
*func_list
);
436 void alc_alsa_deinit(void);
437 void alc_alsa_probe(enum DevProbe type
);
438 ALCboolean
alc_oss_init(BackendFuncs
*func_list
);
439 void alc_oss_deinit(void);
440 void alc_oss_probe(enum DevProbe type
);
441 ALCboolean
alc_solaris_init(BackendFuncs
*func_list
);
442 void alc_solaris_deinit(void);
443 void alc_solaris_probe(enum DevProbe type
);
444 ALCboolean
alc_sndio_init(BackendFuncs
*func_list
);
445 void alc_sndio_deinit(void);
446 void alc_sndio_probe(enum DevProbe type
);
447 ALCboolean
alcMMDevApiInit(BackendFuncs
*func_list
);
448 void alcMMDevApiDeinit(void);
449 void alcMMDevApiProbe(enum DevProbe type
);
450 ALCboolean
alcDSoundInit(BackendFuncs
*func_list
);
451 void alcDSoundDeinit(void);
452 void alcDSoundProbe(enum DevProbe type
);
453 ALCboolean
alcWinMMInit(BackendFuncs
*FuncList
);
454 void alcWinMMDeinit(void);
455 void alcWinMMProbe(enum DevProbe type
);
456 ALCboolean
alc_pa_init(BackendFuncs
*func_list
);
457 void alc_pa_deinit(void);
458 void alc_pa_probe(enum DevProbe type
);
459 ALCboolean
alc_wave_init(BackendFuncs
*func_list
);
460 void alc_wave_deinit(void);
461 void alc_wave_probe(enum DevProbe type
);
462 ALCboolean
alc_pulse_init(BackendFuncs
*func_list
);
463 void alc_pulse_deinit(void);
464 void alc_pulse_probe(enum DevProbe type
);
465 ALCboolean
alc_ca_init(BackendFuncs
*func_list
);
466 void alc_ca_deinit(void);
467 void alc_ca_probe(enum DevProbe type
);
468 ALCboolean
alc_opensl_init(BackendFuncs
*func_list
);
469 void alc_opensl_deinit(void);
470 void alc_opensl_probe(enum DevProbe type
);
471 ALCboolean
alc_null_init(BackendFuncs
*func_list
);
472 void alc_null_deinit(void);
473 void alc_null_probe(enum DevProbe type
);
474 ALCboolean
alc_loopback_init(BackendFuncs
*func_list
);
475 void alc_loopback_deinit(void);
476 void alc_loopback_probe(enum DevProbe type
);
481 DevFmtByte
= ALC_BYTE_SOFT
,
482 DevFmtUByte
= ALC_UNSIGNED_BYTE_SOFT
,
483 DevFmtShort
= ALC_SHORT_SOFT
,
484 DevFmtUShort
= ALC_UNSIGNED_SHORT_SOFT
,
485 DevFmtInt
= ALC_INT_SOFT
,
486 DevFmtUInt
= ALC_UNSIGNED_INT_SOFT
,
487 DevFmtFloat
= ALC_FLOAT_SOFT
,
489 DevFmtTypeDefault
= DevFmtFloat
491 enum DevFmtChannels
{
492 DevFmtMono
= ALC_MONO_SOFT
,
493 DevFmtStereo
= ALC_STEREO_SOFT
,
494 DevFmtQuad
= ALC_QUAD_SOFT
,
495 DevFmtX51
= ALC_5POINT1_SOFT
,
496 DevFmtX61
= ALC_6POINT1_SOFT
,
497 DevFmtX71
= ALC_7POINT1_SOFT
,
499 /* Similar to 5.1, except using the side channels instead of back */
500 DevFmtX51Side
= 0x80000000,
502 DevFmtChannelsDefault
= DevFmtStereo
505 ALuint
BytesFromDevFmt(enum DevFmtType type
);
506 ALuint
ChannelsFromDevFmt(enum DevFmtChannels chans
);
507 static __inline ALuint
FrameSizeFromDevFmt(enum DevFmtChannels chans
,
508 enum DevFmtType type
)
510 return ChannelsFromDevFmt(chans
) * BytesFromDevFmt(type
);
514 extern const struct EffectList
{
528 struct ALCdevice_struct
530 volatile RefCount ref
;
532 ALCboolean Connected
;
533 enum DeviceType Type
;
535 CRITICAL_SECTION Mutex
;
540 enum DevFmtChannels FmtChans
;
541 enum DevFmtType FmtType
;
545 volatile ALCenum LastError
;
547 // Maximum number of sources that can be created
548 ALuint MaxNoOfSources
;
549 // Maximum number of slots that can be created
550 ALuint AuxiliaryEffectSlotMax
;
552 ALCuint NumMonoSources
;
553 ALCuint NumStereoSources
;
556 // Map of Buffers for this device
559 // Map of Effects for this device
562 // Map of Filters for this device
565 /* HRTF filter tables */
566 const struct Hrtf
*Hrtf
;
568 // Stereo-to-binaural filter
575 // Dry path buffer mix
576 ALfloat DryBuffer
[BUFFERSIZE
][MAXCHANNELS
];
578 enum Channel DevChannels
[MAXCHANNELS
];
580 enum Channel Speaker2Chan
[MAXCHANNELS
];
581 ALfloat SpeakerAngle
[MAXCHANNELS
];
584 ALfloat ClickRemoval
[MAXCHANNELS
];
585 ALfloat PendingClicks
[MAXCHANNELS
];
587 /* Default effect slot */
588 struct ALeffectslot
*DefaultSlot
;
590 // Contexts created on this device
591 ALCcontext
*volatile ContextList
;
594 void *ExtraData
; // For the backend's use
596 ALCdevice
*volatile next
;
599 #define ALCdevice_OpenPlayback(a,b) ((a)->Funcs->OpenPlayback((a), (b)))
600 #define ALCdevice_ClosePlayback(a) ((a)->Funcs->ClosePlayback((a)))
601 #define ALCdevice_ResetPlayback(a) ((a)->Funcs->ResetPlayback((a)))
602 #define ALCdevice_StartPlayback(a) ((a)->Funcs->StartPlayback((a)))
603 #define ALCdevice_StopPlayback(a) ((a)->Funcs->StopPlayback((a)))
604 #define ALCdevice_OpenCapture(a,b) ((a)->Funcs->OpenCapture((a), (b)))
605 #define ALCdevice_CloseCapture(a) ((a)->Funcs->CloseCapture((a)))
606 #define ALCdevice_StartCapture(a) ((a)->Funcs->StartCapture((a)))
607 #define ALCdevice_StopCapture(a) ((a)->Funcs->StopCapture((a)))
608 #define ALCdevice_CaptureSamples(a,b,c) ((a)->Funcs->CaptureSamples((a), (b), (c)))
609 #define ALCdevice_AvailableSamples(a) ((a)->Funcs->AvailableSamples((a)))
611 // Frequency was requested by the app or config file
612 #define DEVICE_FREQUENCY_REQUEST (1<<1)
613 // Channel configuration was requested by the config file
614 #define DEVICE_CHANNELS_REQUEST (1<<2)
615 // Sample type was requested by the config file
616 #define DEVICE_SAMPLE_TYPE_REQUEST (1<<3)
618 // Specifies if the device is currently running
619 #define DEVICE_RUNNING (1<<31)
621 #define LookupBuffer(m, k) ((struct ALbuffer*)LookupUIntMapKey(&(m)->BufferMap, (k)))
622 #define LookupEffect(m, k) ((struct ALeffect*)LookupUIntMapKey(&(m)->EffectMap, (k)))
623 #define LookupFilter(m, k) ((struct ALfilter*)LookupUIntMapKey(&(m)->FilterMap, (k)))
624 #define RemoveBuffer(m, k) ((struct ALbuffer*)RemoveUIntMapKey(&(m)->BufferMap, (k)))
625 #define RemoveEffect(m, k) ((struct ALeffect*)RemoveUIntMapKey(&(m)->EffectMap, (k)))
626 #define RemoveFilter(m, k) ((struct ALfilter*)RemoveUIntMapKey(&(m)->FilterMap, (k)))
629 struct ALCcontext_struct
631 volatile RefCount ref
;
636 UIntMap EffectSlotMap
;
640 volatile ALenum UpdateSources
;
642 volatile enum DistanceModel DistanceModel
;
643 volatile ALboolean SourceDistanceModel
;
645 volatile ALfloat DopplerFactor
;
646 volatile ALfloat DopplerVelocity
;
647 volatile ALfloat SpeedOfSound
;
648 volatile ALenum DeferUpdates
;
650 struct ALsource
**ActiveSources
;
651 ALsizei ActiveSourceCount
;
652 ALsizei MaxActiveSources
;
654 struct ALeffectslot
**ActiveEffectSlots
;
655 ALsizei ActiveEffectSlotCount
;
656 ALsizei MaxActiveEffectSlots
;
659 const ALCchar
*ExtensionList
;
661 ALCcontext
*volatile next
;
664 #define LookupSource(m, k) ((struct ALsource*)LookupUIntMapKey(&(m)->SourceMap, (k)))
665 #define LookupEffectSlot(m, k) ((struct ALeffectslot*)LookupUIntMapKey(&(m)->EffectSlotMap, (k)))
666 #define RemoveSource(m, k) ((struct ALsource*)RemoveUIntMapKey(&(m)->SourceMap, (k)))
667 #define RemoveEffectSlot(m, k) ((struct ALeffectslot*)RemoveUIntMapKey(&(m)->EffectSlotMap, (k)))
669 ALCcontext
*GetContextRef(void);
671 void ALCcontext_IncRef(ALCcontext
*context
);
672 void ALCcontext_DecRef(ALCcontext
*context
);
674 void AppendAllDeviceList(const ALCchar
*name
);
675 void AppendCaptureDeviceList(const ALCchar
*name
);
677 static __inline
void LockDevice(ALCdevice
*device
)
678 { EnterCriticalSection(&device
->Mutex
); }
679 static __inline
void UnlockDevice(ALCdevice
*device
)
680 { LeaveCriticalSection(&device
->Mutex
); }
682 static __inline
void LockContext(ALCcontext
*context
)
683 { LockDevice(context
->Device
); }
684 static __inline
void UnlockContext(ALCcontext
*context
)
685 { UnlockDevice(context
->Device
); }
688 ALvoid
*StartThread(ALuint (*func
)(ALvoid
*), ALvoid
*ptr
);
689 ALuint
StopThread(ALvoid
*thread
);
691 typedef struct RingBuffer RingBuffer
;
692 RingBuffer
*CreateRingBuffer(ALsizei frame_size
, ALsizei length
);
693 void DestroyRingBuffer(RingBuffer
*ring
);
694 ALsizei
RingBufferSize(RingBuffer
*ring
);
695 void WriteRingBuffer(RingBuffer
*ring
, const ALubyte
*data
, ALsizei len
);
696 void ReadRingBuffer(RingBuffer
*ring
, ALubyte
*data
, ALsizei len
);
698 void ReadALConfig(void);
699 void FreeALConfig(void);
700 int ConfigValueExists(const char *blockName
, const char *keyName
);
701 const char *GetConfigValue(const char *blockName
, const char *keyName
, const char *def
);
702 int GetConfigValueBool(const char *blockName
, const char *keyName
, int def
);
703 int ConfigValueStr(const char *blockName
, const char *keyName
, const char **ret
);
704 int ConfigValueInt(const char *blockName
, const char *keyName
, int *ret
);
705 int ConfigValueUInt(const char *blockName
, const char *keyName
, unsigned int *ret
);
706 int ConfigValueFloat(const char *blockName
, const char *keyName
, float *ret
);
708 void SetRTPriority(void);
710 void SetDefaultChannelOrder(ALCdevice
*device
);
711 void SetDefaultWFXChannelOrder(ALCdevice
*device
);
713 const ALCchar
*DevFmtTypeString(enum DevFmtType type
);
714 const ALCchar
*DevFmtChannelsString(enum DevFmtChannels chans
);
716 #define HRIR_BITS (5)
717 #define HRIR_LENGTH (1<<HRIR_BITS)
718 #define HRIR_MASK (HRIR_LENGTH-1)
721 const struct Hrtf
*GetHrtf(ALCdevice
*device
);
722 ALfloat
CalcHrtfDelta(ALfloat oldGain
, ALfloat newGain
, const ALfloat olddir
[3], const ALfloat newdir
[3]);
723 void GetLerpedHrtfCoeffs(const struct Hrtf
*Hrtf
, ALfloat elevation
, ALfloat azimuth
, ALfloat gain
, ALfloat (*coeffs
)[2], ALuint
*delays
);
724 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
);
726 void al_print(const char *func
, const char *fmt
, ...) PRINTF_STYLE(2,3);
727 #define AL_PRINT(...) al_print(__FUNCTION__, __VA_ARGS__)
729 extern FILE *LogFile
;
737 extern enum LogLevel LogLevel
;
739 #define TRACEREF(...) do { \
740 if(LogLevel >= LogRef) \
741 AL_PRINT(__VA_ARGS__); \
744 #define TRACE(...) do { \
745 if(LogLevel >= LogTrace) \
746 AL_PRINT(__VA_ARGS__); \
749 #define WARN(...) do { \
750 if(LogLevel >= LogWarning) \
751 AL_PRINT(__VA_ARGS__); \
754 #define ERR(...) do { \
755 if(LogLevel >= LogError) \
756 AL_PRINT(__VA_ARGS__); \
760 extern ALint RTPrioLevel
;
763 * Starts a try block. Must not be nested within another try block within the
766 #define al_try do { \
771 * After a try or another catch block, runs the next block if the given value
774 #define al_catch(val) else if(_al_err == (val))
776 * After a try or catch block, runs the next block for any value thrown and not
779 #define al_catchany() else
780 /** Marks the end of the final catch (or the try) block. */
781 #define al_endtry } while(0)
784 * The given integer value is "thrown" so as to be caught by a catch block.
785 * Must be called in a try block within the same function. The value must not
788 #define al_throw(e) do { \
790 assert(_al_err != 0); \
791 goto _al_try_label; \
793 /** Sets an AL error on the given context, before throwing the error code. */
794 #define al_throwerr(ctx, err) do { \
795 alSetError((ctx), (err)); \
800 * Throws an AL_INVALID_VALUE error with the given ctx if the given condition
803 #define CHECK_VALUE(ctx, cond) do { \
805 al_throwerr((ctx), AL_INVALID_VALUE); \