12 #ifdef HAVE_FPU_CONTROL_H
13 #include <fpu_control.h>
20 #ifndef ALC_SOFT_device_loopback
21 #define ALC_SOFT_device_loopback 1
22 #define ALC_FORMAT_CHANNELS_SOFT 0x1990
23 #define ALC_FORMAT_TYPE_SOFT 0x1991
26 #define ALC_BYTE_SOFT 0x1400
27 #define ALC_UNSIGNED_BYTE_SOFT 0x1401
28 #define ALC_SHORT_SOFT 0x1402
29 #define ALC_UNSIGNED_SHORT_SOFT 0x1403
30 #define ALC_INT_SOFT 0x1404
31 #define ALC_UNSIGNED_INT_SOFT 0x1405
32 #define ALC_FLOAT_SOFT 0x1406
34 /* Channel configurations */
35 #define ALC_MONO_SOFT 0x1500
36 #define ALC_STEREO_SOFT 0x1501
37 #define ALC_QUAD_SOFT 0x1503
38 #define ALC_5POINT1_SOFT 0x1504 /* (WFX order) */
39 #define ALC_6POINT1_SOFT 0x1505 /* (WFX order) */
40 #define ALC_7POINT1_SOFT 0x1506 /* (WFX order) */
42 typedef ALCdevice
* (ALC_APIENTRY
*LPALCLOOPBACKOPENDEVICESOFT
)(void);
43 typedef ALCboolean (ALC_APIENTRY
*LPALCISRENDERFORMATSUPPORTEDSOFT
)(ALCdevice
*device
, ALCsizei freq
, ALCenum channels
, ALCenum type
);
44 typedef void (ALC_APIENTRY
*LPALCRENDERSAMPLESSOFT
)(ALCdevice
*device
, ALCvoid
*buffer
, ALCsizei samples
);
45 #ifdef AL_ALEXT_PROTOTYPES
46 ALC_API ALCdevice
* ALC_APIENTRY
alcLoopbackOpenDeviceSOFT(void);
47 ALC_API ALCboolean ALC_APIENTRY
alcIsRenderFormatSupportedSOFT(ALCdevice
*device
, ALCsizei freq
, ALCenum channels
, ALCenum type
);
48 ALC_API
void ALC_APIENTRY
alcRenderSamplesSOFT(ALCdevice
*device
, ALCvoid
*buffer
, ALCsizei samples
);
52 #ifndef AL_SOFT_non_virtual_channels
53 #define AL_SOFT_non_virtual_channels 1
54 #define AL_VIRTUAL_CHANNELS_SOFT 0x1033
57 #ifndef AL_SOFT_deferred_updates
58 #define AL_SOFT_deferred_updates 1
59 #define AL_DEFERRED_UPDATES_SOFT 0xC002
60 typedef ALvoid (AL_APIENTRY
*LPALDEFERUPDATESSOFT
)(void);
61 typedef ALvoid (AL_APIENTRY
*LPALPROCESSUPDATESSOFT
)(void);
62 #ifdef AL_ALEXT_PROTOTYPES
63 AL_API ALvoid AL_APIENTRY
alDeferUpdatesSOFT(void);
64 AL_API ALvoid AL_APIENTRY
alProcessUpdatesSOFT(void);
69 #if defined(HAVE_STDINT_H)
71 typedef int64_t ALint64
;
72 typedef uint64_t ALuint64
;
73 #elif defined(HAVE___INT64)
74 typedef __int64 ALint64
;
75 typedef unsigned __int64 ALuint64
;
76 #elif (SIZEOF_LONG == 8)
78 typedef unsigned long ALuint64
;
79 #elif (SIZEOF_LONG_LONG == 8)
80 typedef long long ALint64
;
81 typedef unsigned long long ALuint64
;
84 typedef ptrdiff_t ALintptrEXT
;
85 typedef ptrdiff_t ALsizeiptrEXT
;
87 #ifdef HAVE_GCC_FORMAT
88 #define PRINTF_STYLE(x, y) __attribute__((format(printf, (x), (y))))
90 #define PRINTF_STYLE(x, y)
93 #if defined(HAVE_RESTRICT)
94 #define RESTRICT restrict
95 #elif defined(HAVE___RESTRICT)
96 #define RESTRICT __restrict
106 typedef DWORD pthread_key_t
;
107 int pthread_key_create(pthread_key_t
*key
, void (*callback
)(void*));
108 int pthread_key_delete(pthread_key_t key
);
109 void *pthread_getspecific(pthread_key_t key
);
110 int pthread_setspecific(pthread_key_t key
, void *val
);
112 #define HAVE_DYNLOAD 1
113 void *LoadLib(const char *name
);
114 void CloseLib(void *handle
);
115 void *GetSymbol(void *handle
, const char *name
);
117 typedef LONG pthread_once_t
;
118 #define PTHREAD_ONCE_INIT 0
119 void pthread_once(pthread_once_t
*once
, void (*callback
)(void));
121 static __inline
int sched_yield(void)
122 { SwitchToThread(); return 0; }
129 #ifdef HAVE_PTHREAD_NP_H
130 #include <pthread_np.h>
132 #include <sys/time.h>
136 #define IsBadWritePtr(a,b) ((a) == NULL && (b) != 0)
138 typedef pthread_mutex_t CRITICAL_SECTION
;
139 void InitializeCriticalSection(CRITICAL_SECTION
*cs
);
140 void DeleteCriticalSection(CRITICAL_SECTION
*cs
);
141 void EnterCriticalSection(CRITICAL_SECTION
*cs
);
142 void LeaveCriticalSection(CRITICAL_SECTION
*cs
);
144 ALuint
timeGetTime(void);
145 void Sleep(ALuint t
);
147 #if defined(HAVE_DLFCN_H)
148 #define HAVE_DYNLOAD 1
149 void *LoadLib(const char *name
);
150 void CloseLib(void *handle
);
151 void *GetSymbol(void *handle
, const char *name
);
156 typedef void *volatile XchgPtr
;
158 #if defined(__GNUC__) && (__GNUC__ > 4 || (__GNUC__ == 4 && __GNUC_MINOR__ >= 1))
159 typedef ALuint RefCount
;
160 static __inline RefCount
IncrementRef(volatile RefCount
*ptr
)
161 { return __sync_add_and_fetch(ptr
, 1); }
162 static __inline RefCount
DecrementRef(volatile RefCount
*ptr
)
163 { return __sync_sub_and_fetch(ptr
, 1); }
165 static __inline
int ExchangeInt(volatile int *ptr
, int newval
)
167 return __sync_lock_test_and_set(ptr
, newval
);
169 static __inline
void *ExchangePtr(XchgPtr
*ptr
, void *newval
)
171 return __sync_lock_test_and_set(ptr
, newval
);
173 static __inline ALboolean
CompExchangeInt(volatile int *ptr
, int oldval
, int newval
)
175 return __sync_bool_compare_and_swap(ptr
, oldval
, newval
);
177 static __inline ALboolean
CompExchangePtr(XchgPtr
*ptr
, void *oldval
, void *newval
)
179 return __sync_bool_compare_and_swap(ptr
, oldval
, newval
);
182 #elif defined(__GNUC__) && (defined(__i386__) || defined(__x86_64__))
184 static __inline
int xaddl(volatile int *dest
, int incr
)
187 __asm__
__volatile__("lock; xaddl %0,(%1)"
189 : "r" (dest
), "0" (incr
)
194 typedef int RefCount
;
195 static __inline RefCount
IncrementRef(volatile RefCount
*ptr
)
196 { return xaddl(ptr
, 1)+1; }
197 static __inline RefCount
DecrementRef(volatile RefCount
*ptr
)
198 { return xaddl(ptr
, -1)-1; }
200 static __inline
int ExchangeInt(volatile int *dest
, int newval
)
203 __asm__
__volatile__("lock; xchgl %0,(%1)"
205 : "r" (dest
), "0" (newval
)
210 static __inline ALboolean
CompExchangeInt(volatile int *dest
, int oldval
, int newval
)
213 __asm__
__volatile__("lock; cmpxchgl %2,(%1)"
215 : "r" (dest
), "r" (newval
), "0" (oldval
)
217 return ret
== oldval
;
220 static __inline
void *ExchangePtr(XchgPtr
*dest
, void *newval
)
223 __asm__
__volatile__(
225 "lock; xchgl %0,(%1)"
227 "lock; xchgq %0,(%1)"
230 : "r" (dest
), "0" (newval
)
236 static __inline ALboolean
CompExchangePtr(XchgPtr
*dest
, void *oldval
, void *newval
)
239 __asm__
__volatile__(
241 "lock; cmpxchgl %2,(%1)"
243 "lock; cmpxchgq %2,(%1)"
246 : "r" (dest
), "r" (newval
), "0" (oldval
)
249 return ret
== oldval
;
252 #elif defined(_WIN32)
254 typedef LONG RefCount
;
255 static __inline RefCount
IncrementRef(volatile RefCount
*ptr
)
256 { return InterlockedIncrement(ptr
); }
257 static __inline RefCount
DecrementRef(volatile RefCount
*ptr
)
258 { return InterlockedDecrement(ptr
); }
260 extern ALbyte LONG_size_does_not_match_int
[(sizeof(LONG
)==sizeof(int))?1:-1];
262 static __inline
int ExchangeInt(volatile int *ptr
, int newval
)
268 return InterlockedExchange(u
.l
, newval
);
270 static __inline
void *ExchangePtr(XchgPtr
*ptr
, void *newval
)
272 return InterlockedExchangePointer(ptr
, newval
);
274 static __inline ALboolean
CompExchangeInt(volatile int *ptr
, int oldval
, int newval
)
280 return InterlockedCompareExchange(u
.l
, newval
, oldval
) == oldval
;
282 static __inline ALboolean
CompExchangePtr(XchgPtr
*ptr
, void *oldval
, void *newval
)
284 return InterlockedCompareExchangePointer(ptr
, newval
, oldval
) == oldval
;
287 #elif defined(__APPLE__)
289 #include <libkern/OSAtomic.h>
291 typedef int32_t RefCount
;
292 static __inline RefCount
IncrementRef(volatile RefCount
*ptr
)
293 { return OSAtomicIncrement32Barrier(ptr
); }
294 static __inline RefCount
DecrementRef(volatile RefCount
*ptr
)
295 { return OSAtomicDecrement32Barrier(ptr
); }
297 static __inline
int ExchangeInt(volatile int *ptr
, int newval
)
299 /* Really? No regular old atomic swap? */
303 } while(!OSAtomicCompareAndSwap32Barrier(oldval
, newval
, ptr
));
306 static __inline
void *ExchangePtr(XchgPtr
*ptr
, void *newval
)
311 } while(!OSAtomicCompareAndSwapPtrBarrier(oldval
, newval
, ptr
));
314 static __inline ALboolean
CompExchangeInt(volatile int *ptr
, int oldval
, int newval
)
316 return OSAtomicCompareAndSwap32Barrier(oldval
, newval
, ptr
);
318 static __inline ALboolean
CompExchangePtr(XchgPtr
*ptr
, void *oldval
, void *newval
)
320 return OSAtomicCompareAndSwapPtrBarrier(oldval
, newval
, ptr
);
324 #error "No atomic functions available on this platform!"
325 typedef ALuint RefCount
;
330 volatile RefCount read_count
;
331 volatile RefCount write_count
;
332 volatile ALenum read_lock
;
333 volatile ALenum read_entry_lock
;
334 volatile ALenum write_lock
;
337 void RWLockInit(RWLock
*lock
);
338 void ReadLock(RWLock
*lock
);
339 void ReadUnlock(RWLock
*lock
);
340 void WriteLock(RWLock
*lock
);
341 void WriteUnlock(RWLock
*lock
);
344 typedef struct UIntMap
{
354 extern UIntMap TlsDestructor
;
356 void InitUIntMap(UIntMap
*map
, ALsizei limit
);
357 void ResetUIntMap(UIntMap
*map
);
358 ALenum
InsertUIntMapEntry(UIntMap
*map
, ALuint key
, ALvoid
*value
);
359 ALvoid
*RemoveUIntMapKey(UIntMap
*map
, ALuint key
);
360 ALvoid
*LookupUIntMapKey(UIntMap
*map
, ALuint key
);
362 static __inline
void LockUIntMapRead(UIntMap
*map
)
363 { ReadLock(&map
->lock
); }
364 static __inline
void UnlockUIntMapRead(UIntMap
*map
)
365 { ReadUnlock(&map
->lock
); }
366 static __inline
void LockUIntMapWrite(UIntMap
*map
)
367 { WriteLock(&map
->lock
); }
368 static __inline
void UnlockUIntMapWrite(UIntMap
*map
)
369 { WriteUnlock(&map
->lock
); }
371 #include "alListener.h"
379 #define DEFAULT_OUTPUT_RATE (44100)
381 #define SPEEDOFSOUNDMETRESPERSEC (343.3f)
382 #define AIRABSORBGAINHF (0.99426f) /* -0.05dB */
384 #define LOWPASSFREQREF (5000)
390 // Find the next power-of-2 for non-power-of-2 numbers.
391 static __inline ALuint
NextPowerOf2(ALuint value
)
407 /* Fast float-to-int conversion. Assumes the FPU is already in round-to-zero
409 static __inline ALint
fastf2i(ALfloat f
)
412 #if defined(_MSC_VER) && !defined(_WIN64)
415 #elif defined(__GNUC__) && defined(__i386__)
416 __asm__
__volatile__("flds %1\n\t"
426 /* Fast float-to-uint conversion. Assumes the FPU is already in round-to-zero
428 static __inline ALuint
fastf2u(ALfloat f
)
429 { return fastf2i(f
); }
439 ALCenum (*OpenPlayback
)(ALCdevice
*, const ALCchar
*);
440 void (*ClosePlayback
)(ALCdevice
*);
441 ALCboolean (*ResetPlayback
)(ALCdevice
*);
442 void (*StopPlayback
)(ALCdevice
*);
444 ALCenum (*OpenCapture
)(ALCdevice
*, const ALCchar
*);
445 void (*CloseCapture
)(ALCdevice
*);
446 void (*StartCapture
)(ALCdevice
*);
447 void (*StopCapture
)(ALCdevice
*);
448 ALCenum (*CaptureSamples
)(ALCdevice
*, void*, ALCuint
);
449 ALCuint (*AvailableSamples
)(ALCdevice
*);
454 ALCboolean (*Init
)(BackendFuncs
*);
455 void (*Deinit
)(void);
456 void (*Probe
)(enum DevProbe
);
460 ALCboolean
alc_alsa_init(BackendFuncs
*func_list
);
461 void alc_alsa_deinit(void);
462 void alc_alsa_probe(enum DevProbe type
);
463 ALCboolean
alc_oss_init(BackendFuncs
*func_list
);
464 void alc_oss_deinit(void);
465 void alc_oss_probe(enum DevProbe type
);
466 ALCboolean
alc_solaris_init(BackendFuncs
*func_list
);
467 void alc_solaris_deinit(void);
468 void alc_solaris_probe(enum DevProbe type
);
469 ALCboolean
alc_sndio_init(BackendFuncs
*func_list
);
470 void alc_sndio_deinit(void);
471 void alc_sndio_probe(enum DevProbe type
);
472 ALCboolean
alcMMDevApiInit(BackendFuncs
*func_list
);
473 void alcMMDevApiDeinit(void);
474 void alcMMDevApiProbe(enum DevProbe type
);
475 ALCboolean
alcDSoundInit(BackendFuncs
*func_list
);
476 void alcDSoundDeinit(void);
477 void alcDSoundProbe(enum DevProbe type
);
478 ALCboolean
alcWinMMInit(BackendFuncs
*FuncList
);
479 void alcWinMMDeinit(void);
480 void alcWinMMProbe(enum DevProbe type
);
481 ALCboolean
alc_pa_init(BackendFuncs
*func_list
);
482 void alc_pa_deinit(void);
483 void alc_pa_probe(enum DevProbe type
);
484 ALCboolean
alc_wave_init(BackendFuncs
*func_list
);
485 void alc_wave_deinit(void);
486 void alc_wave_probe(enum DevProbe type
);
487 ALCboolean
alc_pulse_init(BackendFuncs
*func_list
);
488 void alc_pulse_deinit(void);
489 void alc_pulse_probe(enum DevProbe type
);
490 ALCboolean
alc_ca_init(BackendFuncs
*func_list
);
491 void alc_ca_deinit(void);
492 void alc_ca_probe(enum DevProbe type
);
493 ALCboolean
alc_opensl_init(BackendFuncs
*func_list
);
494 void alc_opensl_deinit(void);
495 void alc_opensl_probe(enum DevProbe type
);
496 ALCboolean
alc_null_init(BackendFuncs
*func_list
);
497 void alc_null_deinit(void);
498 void alc_null_probe(enum DevProbe type
);
499 ALCboolean
alc_loopback_init(BackendFuncs
*func_list
);
500 void alc_loopback_deinit(void);
501 void alc_loopback_probe(enum DevProbe type
);
502 void alc_android_init(BackendFuncs
*func_list
);
503 void alc_android_deinit(void);
504 void alc_android_probe(int type
);
508 DevFmtByte
= ALC_BYTE_SOFT
,
509 DevFmtUByte
= ALC_UNSIGNED_BYTE_SOFT
,
510 DevFmtShort
= ALC_SHORT_SOFT
,
511 DevFmtUShort
= ALC_UNSIGNED_SHORT_SOFT
,
512 DevFmtFloat
= ALC_FLOAT_SOFT
514 enum DevFmtChannels
{
515 DevFmtMono
= ALC_MONO_SOFT
,
516 DevFmtStereo
= ALC_STEREO_SOFT
,
517 DevFmtQuad
= ALC_QUAD_SOFT
,
518 DevFmtX51
= ALC_5POINT1_SOFT
,
519 DevFmtX61
= ALC_6POINT1_SOFT
,
520 DevFmtX71
= ALC_7POINT1_SOFT
,
522 /* Similar to 5.1, except using the side channels instead of back */
523 DevFmtX51Side
= 0x80000000 | ALC_5POINT1_SOFT
526 ALuint
BytesFromDevFmt(enum DevFmtType type
);
527 ALuint
ChannelsFromDevFmt(enum DevFmtChannels chans
);
528 static __inline ALuint
FrameSizeFromDevFmt(enum DevFmtChannels chans
,
529 enum DevFmtType type
)
531 return ChannelsFromDevFmt(chans
) * BytesFromDevFmt(type
);
535 extern const struct EffectList
{
543 struct ALCdevice_struct
545 volatile RefCount ref
;
547 ALCboolean Connected
;
548 ALboolean IsCaptureDevice
;
549 ALboolean IsLoopbackDevice
;
551 CRITICAL_SECTION Mutex
;
556 enum DevFmtChannels FmtChans
;
557 enum DevFmtType FmtType
;
559 ALCchar
*szDeviceName
;
561 volatile ALCenum LastError
;
563 // Maximum number of sources that can be created
564 ALuint MaxNoOfSources
;
565 // Maximum number of slots that can be created
566 ALuint AuxiliaryEffectSlotMax
;
568 ALCuint NumMonoSources
;
569 ALCuint NumStereoSources
;
572 // Map of Buffers for this device
575 // Map of Effects for this device
578 // Map of Filters for this device
581 /* HRTF filter tables */
582 const struct Hrtf
*Hrtf
;
584 // Stereo-to-binaural filter
591 // Dry path buffer mix
592 ALfloat DryBuffer
[BUFFERSIZE
][MAXCHANNELS
];
594 enum Channel DevChannels
[MAXCHANNELS
];
596 enum Channel Speaker2Chan
[MAXCHANNELS
];
597 ALfloat PanningLUT
[LUT_NUM
][MAXCHANNELS
];
600 ALfloat ClickRemoval
[MAXCHANNELS
];
601 ALfloat PendingClicks
[MAXCHANNELS
];
603 /* Default effect slot */
604 struct ALeffectslot
*DefaultSlot
;
606 // Contexts created on this device
607 ALCcontext
*volatile ContextList
;
610 void *ExtraData
; // For the backend's use
612 ALCdevice
*volatile next
;
615 #define ALCdevice_OpenPlayback(a,b) ((a)->Funcs->OpenPlayback((a), (b)))
616 #define ALCdevice_ClosePlayback(a) ((a)->Funcs->ClosePlayback((a)))
617 #define ALCdevice_ResetPlayback(a) ((a)->Funcs->ResetPlayback((a)))
618 #define ALCdevice_StopPlayback(a) ((a)->Funcs->StopPlayback((a)))
619 #define ALCdevice_OpenCapture(a,b) ((a)->Funcs->OpenCapture((a), (b)))
620 #define ALCdevice_CloseCapture(a) ((a)->Funcs->CloseCapture((a)))
621 #define ALCdevice_StartCapture(a) ((a)->Funcs->StartCapture((a)))
622 #define ALCdevice_StopCapture(a) ((a)->Funcs->StopCapture((a)))
623 #define ALCdevice_CaptureSamples(a,b,c) ((a)->Funcs->CaptureSamples((a), (b), (c)))
624 #define ALCdevice_AvailableSamples(a) ((a)->Funcs->AvailableSamples((a)))
626 // Duplicate stereo sources on the side/rear channels
627 #define DEVICE_DUPLICATE_STEREO (1<<0)
628 // Frequency was requested by the app or config file
629 #define DEVICE_FREQUENCY_REQUEST (1<<1)
630 // Channel configuration was requested by the config file
631 #define DEVICE_CHANNELS_REQUEST (1<<2)
633 // Specifies if the device is currently running
634 #define DEVICE_RUNNING (1<<31)
636 #define LookupBuffer(m, k) ((struct ALbuffer*)LookupUIntMapKey(&(m)->BufferMap, (k)))
637 #define LookupEffect(m, k) ((struct ALeffect*)LookupUIntMapKey(&(m)->EffectMap, (k)))
638 #define LookupFilter(m, k) ((struct ALfilter*)LookupUIntMapKey(&(m)->FilterMap, (k)))
639 #define RemoveBuffer(m, k) ((struct ALbuffer*)RemoveUIntMapKey(&(m)->BufferMap, (k)))
640 #define RemoveEffect(m, k) ((struct ALeffect*)RemoveUIntMapKey(&(m)->EffectMap, (k)))
641 #define RemoveFilter(m, k) ((struct ALfilter*)RemoveUIntMapKey(&(m)->FilterMap, (k)))
644 struct ALCcontext_struct
646 volatile RefCount ref
;
651 UIntMap EffectSlotMap
;
655 volatile ALenum UpdateSources
;
657 volatile enum DistanceModel DistanceModel
;
658 volatile ALboolean SourceDistanceModel
;
660 volatile ALfloat DopplerFactor
;
661 volatile ALfloat DopplerVelocity
;
662 volatile ALfloat flSpeedOfSound
;
663 volatile ALenum DeferUpdates
;
665 struct ALsource
**ActiveSources
;
666 ALsizei ActiveSourceCount
;
667 ALsizei MaxActiveSources
;
669 struct ALeffectslot
**ActiveEffectSlots
;
670 ALsizei ActiveEffectSlotCount
;
671 ALsizei MaxActiveEffectSlots
;
674 const ALCchar
*ExtensionList
;
676 ALCcontext
*volatile next
;
679 #define LookupSource(m, k) ((struct ALsource*)LookupUIntMapKey(&(m)->SourceMap, (k)))
680 #define LookupEffectSlot(m, k) ((struct ALeffectslot*)LookupUIntMapKey(&(m)->EffectSlotMap, (k)))
681 #define RemoveSource(m, k) ((struct ALsource*)RemoveUIntMapKey(&(m)->SourceMap, (k)))
682 #define RemoveEffectSlot(m, k) ((struct ALeffectslot*)RemoveUIntMapKey(&(m)->EffectSlotMap, (k)))
684 ALCcontext
*GetContextRef(void);
686 void ALCcontext_IncRef(ALCcontext
*context
);
687 void ALCcontext_DecRef(ALCcontext
*context
);
689 void AppendDeviceList(const ALCchar
*name
);
690 void AppendAllDeviceList(const ALCchar
*name
);
691 void AppendCaptureDeviceList(const ALCchar
*name
);
693 static __inline
void LockDevice(ALCdevice
*device
)
694 { EnterCriticalSection(&device
->Mutex
); }
695 static __inline
void UnlockDevice(ALCdevice
*device
)
696 { LeaveCriticalSection(&device
->Mutex
); }
698 static __inline
void LockContext(ALCcontext
*context
)
699 { LockDevice(context
->Device
); }
700 static __inline
void UnlockContext(ALCcontext
*context
)
701 { UnlockDevice(context
->Device
); }
704 ALvoid
*StartThread(ALuint (*func
)(ALvoid
*), ALvoid
*ptr
);
705 ALuint
StopThread(ALvoid
*thread
);
707 typedef struct RingBuffer RingBuffer
;
708 RingBuffer
*CreateRingBuffer(ALsizei frame_size
, ALsizei length
);
709 void DestroyRingBuffer(RingBuffer
*ring
);
710 ALsizei
RingBufferSize(RingBuffer
*ring
);
711 void WriteRingBuffer(RingBuffer
*ring
, const ALubyte
*data
, ALsizei len
);
712 void ReadRingBuffer(RingBuffer
*ring
, ALubyte
*data
, ALsizei len
);
714 void ReadALConfig(void);
715 void FreeALConfig(void);
716 int ConfigValueExists(const char *blockName
, const char *keyName
);
717 const char *GetConfigValue(const char *blockName
, const char *keyName
, const char *def
);
718 int GetConfigValueBool(const char *blockName
, const char *keyName
, int def
);
719 int ConfigValueStr(const char *blockName
, const char *keyName
, const char **ret
);
720 int ConfigValueInt(const char *blockName
, const char *keyName
, int *ret
);
721 int ConfigValueUInt(const char *blockName
, const char *keyName
, unsigned int *ret
);
722 int ConfigValueFloat(const char *blockName
, const char *keyName
, float *ret
);
724 void SetRTPriority(void);
726 void SetDefaultChannelOrder(ALCdevice
*device
);
727 void SetDefaultWFXChannelOrder(ALCdevice
*device
);
729 const ALCchar
*DevFmtTypeString(enum DevFmtType type
);
730 const ALCchar
*DevFmtChannelsString(enum DevFmtChannels chans
);
732 #define HRIR_BITS (5)
733 #define HRIR_LENGTH (1<<HRIR_BITS)
734 #define HRIR_MASK (HRIR_LENGTH-1)
737 const struct Hrtf
*GetHrtf(ALCdevice
*device
);
738 ALfloat
CalcHrtfDelta(ALfloat oldGain
, ALfloat newGain
, const ALfloat olddir
[3], const ALfloat newdir
[3]);
739 void GetLerpedHrtfCoeffs(const struct Hrtf
*Hrtf
, ALfloat elevation
, ALfloat azimuth
, ALfloat gain
, ALfloat (*coeffs
)[2], ALuint
*delays
);
740 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
);
742 void al_print(const char *func
, const char *fmt
, ...) PRINTF_STYLE(2,3);
743 #define AL_PRINT(...) al_print(__FUNCTION__, __VA_ARGS__)
745 extern FILE *LogFile
;
753 extern enum LogLevel LogLevel
;
755 #define TRACEREF(...) do { \
756 if(LogLevel >= LogRef) \
757 AL_PRINT(__VA_ARGS__); \
760 #define TRACE(...) do { \
761 if(LogLevel >= LogTrace) \
762 AL_PRINT(__VA_ARGS__); \
765 #define WARN(...) do { \
766 if(LogLevel >= LogWarning) \
767 AL_PRINT(__VA_ARGS__); \
770 #define ERR(...) do { \
771 if(LogLevel >= LogError) \
772 AL_PRINT(__VA_ARGS__); \
776 extern ALint RTPrioLevel
;