Uninline the timeGetTime wrapper
[openal-soft/android.git] / OpenAL32 / Include / alMain.h
blobe18fd12367367ae3967764e8d188ec144b88d224
1 #ifndef AL_MAIN_H
2 #define AL_MAIN_H
4 #include <string.h>
5 #include <stdio.h>
6 #include <stdarg.h>
8 #ifdef HAVE_FENV_H
9 #include <fenv.h>
10 #endif
12 #include "AL/al.h"
13 #include "AL/alc.h"
14 #include "AL/alext.h"
16 /* Sample types */
17 #define AL_BYTE 0x1400
18 #define AL_UNSIGNED_BYTE 0x1401
19 #define AL_SHORT 0x1402
20 #define AL_UNSIGNED_SHORT 0x1403
21 #define AL_INT 0x1404
22 #define AL_UNSIGNED_INT 0x1405
23 #define AL_FLOAT 0x1406
24 #define AL_DOUBLE 0x1407
25 #define AL_BYTE3 0x1408
26 #define AL_UNSIGNED_BYTE3 0x1409
27 #define AL_MULAW 0x1410
28 #define AL_IMA4 0x1411
30 /* Channel configurations */
31 #define AL_MONO 0x1500
32 #define AL_STEREO 0x1501
33 #define AL_REAR 0x1502
34 #define AL_QUAD 0x1503
35 #define AL_5POINT1 0x1504 /* (WFX order) */
36 #define AL_6POINT1 0x1505 /* (WFX order) */
37 #define AL_7POINT1 0x1506 /* (WFX order) */
39 /* Storage formats */
40 #define AL_MONO8 0x1100
41 #define AL_MONO16 0x1101
42 #define AL_MONO32F 0x10010
43 #define AL_STEREO8 0x1102
44 #define AL_STEREO16 0x1103
45 #define AL_STEREO32F 0x10011
46 #define AL_QUAD8 0x1204
47 #define AL_QUAD16 0x1205
48 #define AL_QUAD32F 0x1206
49 #define AL_REAR8 0x1207
50 #define AL_REAR16 0x1208
51 #define AL_REAR32F 0x1209
52 #define AL_5POINT1_8 0x120A
53 #define AL_5POINT1_16 0x120B
54 #define AL_5POINT1_32F 0x120C
55 #define AL_6POINT1_8 0x120D
56 #define AL_6POINT1_16 0x120E
57 #define AL_6POINT1_32F 0x120F
58 #define AL_7POINT1_8 0x1210
59 #define AL_7POINT1_16 0x1211
60 #define AL_7POINT1_32F 0x1212
62 #ifndef ALC_SOFT_device_loopback
63 #define ALC_SOFT_device_loopback 1
64 #define ALC_FORMAT_CHANNELS_SOFT 0x1990
65 #define ALC_FORMAT_TYPE_SOFT 0x1991
66 typedef ALCdevice* (ALC_APIENTRY*LPALCLOOPBACKOPENDEVICESOFT)(void);
67 typedef ALCboolean (ALC_APIENTRY*LPALCISRENDERFORMATSUPPORTEDSOFT)(ALCdevice *device, ALCsizei freq, ALenum channels, ALenum type);
68 typedef void (ALC_APIENTRY*LPALCRENDERSAMPLESSOFT)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
69 #ifdef AL_ALEXT_PROTOTYPES
70 ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(void);
71 ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device, ALCsizei freq, ALenum channels, ALenum type);
72 ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples);
73 #endif
74 #endif
76 #ifndef AL_SOFT_buffer_samples
77 #define AL_SOFT_buffer_samples 1
78 typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*);
79 typedef void (AL_APIENTRY*LPALBUFFERSUBSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,const ALvoid*);
80 typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*);
81 typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum);
82 #ifdef AL_ALEXT_PROTOTYPES
83 AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer,
84 ALuint samplerate, ALenum internalformat, ALsizei frames,
85 ALenum channels, ALenum type, const ALvoid *data);
86 AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer,
87 ALsizei offset, ALsizei frames,
88 ALenum channels, ALenum type, const ALvoid *data);
89 AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer,
90 ALsizei offset, ALsizei frames,
91 ALenum channels, ALenum type, ALvoid *data);
92 AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format);
93 #endif
94 #endif
96 #ifndef AL_EXT_sample_buffer_object
97 #define AL_EXT_sample_buffer_object 1
98 typedef ptrdiff_t ALintptrEXT;
99 typedef ptrdiff_t ALsizeiptrEXT;
100 #define AL_SAMPLE_SOURCE_EXT 0x1040
101 #define AL_SAMPLE_SINK_EXT 0x1041
102 #define AL_READ_ONLY_EXT 0x1042
103 #define AL_WRITE_ONLY_EXT 0x1043
104 #define AL_READ_WRITE_EXT 0x1044
105 #define AL_STREAM_WRITE_EXT 0x1045
106 #define AL_STREAM_READ_EXT 0x1046
107 #define AL_STREAM_COPY_EXT 0x1047
108 #define AL_STATIC_WRITE_EXT 0x1048
109 #define AL_STATIC_READ_EXT 0x1049
110 #define AL_STATIC_COPY_EXT 0x104A
111 #define AL_DYNAMIC_WRITE_EXT 0x104B
112 #define AL_DYNAMIC_READ_EXT 0x104C
113 #define AL_DYNAMIC_COPY_EXT 0x104D
114 typedef ALvoid (AL_APIENTRY*PFNALGENDATABUFFERSEXTPROC)(ALsizei n,ALuint *puiBuffers);
115 typedef ALvoid (AL_APIENTRY*PFNALDELETEDATABUFFERSEXTPROC)(ALsizei n, const ALuint *puiBuffers);
116 typedef ALboolean (AL_APIENTRY*PFNALISDATABUFFEREXTPROC)(ALuint uiBuffer);
117 typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERDATAEXTPROC)(ALuint buffer,const ALvoid *data,ALsizeiptrEXT size,ALenum usage);
118 typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERSUBDATAEXTPROC)(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, const ALvoid *);
119 typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERSUBDATAEXTPROC)(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, ALvoid *);
120 typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERFEXTPROC)(ALuint buffer, ALenum eParam, ALfloat flValue);
121 typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERFVEXTPROC)(ALuint buffer, ALenum eParam, const ALfloat* flValues);
122 typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERIEXTPROC)(ALuint buffer, ALenum eParam, ALint lValue);
123 typedef ALvoid (AL_APIENTRY*PFNALDATABUFFERIVEXTPROC)(ALuint buffer, ALenum eParam, const ALint* plValues);
124 typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERFEXTPROC)(ALuint buffer, ALenum eParam, ALfloat *pflValue);
125 typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERFVEXTPROC)(ALuint buffer, ALenum eParam, ALfloat* pflValues);
126 typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERIEXTPROC)(ALuint buffer, ALenum eParam, ALint *plValue);
127 typedef ALvoid (AL_APIENTRY*PFNALGETDATABUFFERIVEXTPROC)(ALuint buffer, ALenum eParam, ALint* plValues);
128 typedef ALvoid (AL_APIENTRY*PFNALSELECTDATABUFFEREXTPROC)(ALenum target, ALuint uiBuffer);
129 typedef ALvoid* (AL_APIENTRY*PFNALMAPDATABUFFEREXTPROC)(ALuint uiBuffer, ALintptrEXT start, ALsizeiptrEXT length, ALenum access);
130 typedef ALvoid (AL_APIENTRY*PFNALUNMAPDATABUFFEREXTPROC)(ALuint uiBuffer);
131 #ifdef AL_ALEXT_PROTOTYPES
132 AL_API ALvoid AL_APIENTRY alGenDatabuffersEXT(ALsizei n,ALuint *puiBuffers);
133 AL_API ALvoid AL_APIENTRY alDeleteDatabuffersEXT(ALsizei n, const ALuint *puiBuffers);
134 AL_API ALboolean AL_APIENTRY alIsDatabufferEXT(ALuint uiBuffer);
135 AL_API ALvoid AL_APIENTRY alDatabufferDataEXT(ALuint buffer,const ALvoid *data,ALsizeiptrEXT size,ALenum usage);
136 AL_API ALvoid AL_APIENTRY alDatabufferSubDataEXT(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, const ALvoid *data);
137 AL_API ALvoid AL_APIENTRY alGetDatabufferSubDataEXT(ALuint buffer, ALintptrEXT start, ALsizeiptrEXT length, ALvoid *data);
138 AL_API ALvoid AL_APIENTRY alDatabufferfEXT(ALuint buffer, ALenum eParam, ALfloat flValue);
139 AL_API ALvoid AL_APIENTRY alDatabufferfvEXT(ALuint buffer, ALenum eParam, const ALfloat* flValues);
140 AL_API ALvoid AL_APIENTRY alDatabufferiEXT(ALuint buffer, ALenum eParam, ALint lValue);
141 AL_API ALvoid AL_APIENTRY alDatabufferivEXT(ALuint buffer, ALenum eParam, const ALint* plValues);
142 AL_API ALvoid AL_APIENTRY alGetDatabufferfEXT(ALuint buffer, ALenum eParam, ALfloat *pflValue);
143 AL_API ALvoid AL_APIENTRY alGetDatabufferfvEXT(ALuint buffer, ALenum eParam, ALfloat* pflValues);
144 AL_API ALvoid AL_APIENTRY alGetDatabufferiEXT(ALuint buffer, ALenum eParam, ALint *plValue);
145 AL_API ALvoid AL_APIENTRY alGetDatabufferivEXT(ALuint buffer, ALenum eParam, ALint* plValues);
146 AL_API ALvoid AL_APIENTRY alSelectDatabufferEXT(ALenum target, ALuint uiBuffer);
147 AL_API ALvoid* AL_APIENTRY alMapDatabufferEXT(ALuint uiBuffer, ALintptrEXT start, ALsizeiptrEXT length, ALenum access);
148 AL_API ALvoid AL_APIENTRY alUnmapDatabufferEXT(ALuint uiBuffer);
149 #endif
150 #endif
153 #if defined(HAVE_STDINT_H)
154 #include <stdint.h>
155 typedef int64_t ALint64;
156 typedef uint64_t ALuint64;
157 #elif defined(HAVE___INT64)
158 typedef __int64 ALint64;
159 typedef unsigned __int64 ALuint64;
160 #elif (SIZEOF_LONG == 8)
161 typedef long ALint64;
162 typedef unsigned long ALuint64;
163 #elif (SIZEOF_LONG_LONG == 8)
164 typedef long long ALint64;
165 typedef unsigned long long ALuint64;
166 #endif
168 #ifdef HAVE_GCC_FORMAT
169 #define PRINTF_STYLE(x, y) __attribute__((format(printf, (x), (y))))
170 #else
171 #define PRINTF_STYLE(x, y)
172 #endif
174 #if defined(HAVE_RESTRICT)
175 #define RESTRICT restrict
176 #elif defined(HAVE___RESTRICT)
177 #define RESTRICT __restrict
178 #else
179 #define RESTRICT
180 #endif
182 #ifdef _WIN32
184 #ifndef _WIN32_WINNT
185 #define _WIN32_WINNT 0x0500
186 #endif
187 #include <windows.h>
189 typedef DWORD tls_type;
190 #define tls_create(x) (*(x) = TlsAlloc())
191 #define tls_delete(x) TlsFree((x))
192 #define tls_get(x) TlsGetValue((x))
193 #define tls_set(x, a) TlsSetValue((x), (a))
195 #define HAVE_DYNLOAD 1
196 void *LoadLib(const char *name);
197 void CloseLib(void *handle);
198 void *GetSymbol(void *handle, const char *name);
200 #else
202 #include <unistd.h>
203 #include <assert.h>
204 #include <pthread.h>
205 #ifdef HAVE_PTHREAD_NP_H
206 #include <pthread_np.h>
207 #endif
208 #include <sys/time.h>
209 #include <time.h>
210 #include <errno.h>
212 #define IsBadWritePtr(a,b) ((a) == NULL && (b) != 0)
214 typedef pthread_key_t tls_type;
215 #define tls_create(x) pthread_key_create((x), NULL)
216 #define tls_delete(x) pthread_key_delete((x))
217 #define tls_get(x) pthread_getspecific((x))
218 #define tls_set(x, a) pthread_setspecific((x), (a))
220 typedef pthread_mutex_t CRITICAL_SECTION;
221 void InitializeCriticalSection(CRITICAL_SECTION *cs);
222 void DeleteCriticalSection(CRITICAL_SECTION *cs);
223 void EnterCriticalSection(CRITICAL_SECTION *cs);
224 void LeaveCriticalSection(CRITICAL_SECTION *cs);
226 ALuint timeGetTime(void);
228 static __inline void Sleep(ALuint t)
230 struct timespec tv, rem;
231 tv.tv_nsec = (t*1000000)%1000000000;
232 tv.tv_sec = t/1000;
234 while(nanosleep(&tv, &rem) == -1 && errno == EINTR)
235 tv = rem;
238 #define min(x,y) (((x)<(y))?(x):(y))
239 #define max(x,y) (((x)>(y))?(x):(y))
241 #if defined(HAVE_DLFCN_H)
242 #define HAVE_DYNLOAD 1
243 void *LoadLib(const char *name);
244 void CloseLib(void *handle);
245 void *GetSymbol(void *handle, const char *name);
246 #endif
248 #endif
250 #include "alListener.h"
251 #include "alu.h"
253 #ifdef __cplusplus
254 extern "C" {
255 #endif
258 #define DEFAULT_OUTPUT_RATE (44100)
260 #define SPEEDOFSOUNDMETRESPERSEC (343.3f)
261 #define AIRABSORBGAINDBHF (-0.05f)
263 #define LOWPASSFREQCUTOFF (5000)
266 // Find the next power-of-2 for non-power-of-2 numbers.
267 static __inline ALuint NextPowerOf2(ALuint value)
269 ALuint powerOf2 = 1;
271 if(value)
273 value--;
274 while(value)
276 value >>= 1;
277 powerOf2 <<= 1;
280 return powerOf2;
284 typedef struct {
285 ALCboolean (*OpenPlayback)(ALCdevice*, const ALCchar*);
286 void (*ClosePlayback)(ALCdevice*);
287 ALCboolean (*ResetPlayback)(ALCdevice*);
288 void (*StopPlayback)(ALCdevice*);
290 ALCboolean (*OpenCapture)(ALCdevice*, const ALCchar*);
291 void (*CloseCapture)(ALCdevice*);
292 void (*StartCapture)(ALCdevice*);
293 void (*StopCapture)(ALCdevice*);
294 void (*CaptureSamples)(ALCdevice*, void*, ALCuint);
295 ALCuint (*AvailableSamples)(ALCdevice*);
296 } BackendFuncs;
298 enum {
299 DEVICE_PROBE,
300 ALL_DEVICE_PROBE,
301 CAPTURE_DEVICE_PROBE
304 void alc_alsa_init(BackendFuncs *func_list);
305 void alc_alsa_deinit(void);
306 void alc_alsa_probe(int type);
307 void alc_oss_init(BackendFuncs *func_list);
308 void alc_oss_deinit(void);
309 void alc_oss_probe(int type);
310 void alc_solaris_init(BackendFuncs *func_list);
311 void alc_solaris_deinit(void);
312 void alc_solaris_probe(int type);
313 void alcMMDevApiInit(BackendFuncs *func_list);
314 void alcMMDevApiDeinit(void);
315 void alcMMDevApiProbe(int type);
316 void alcDSoundInit(BackendFuncs *func_list);
317 void alcDSoundDeinit(void);
318 void alcDSoundProbe(int type);
319 void alcWinMMInit(BackendFuncs *FuncList);
320 void alcWinMMDeinit(void);
321 void alcWinMMProbe(int type);
322 void alc_pa_init(BackendFuncs *func_list);
323 void alc_pa_deinit(void);
324 void alc_pa_probe(int type);
325 void alc_wave_init(BackendFuncs *func_list);
326 void alc_wave_deinit(void);
327 void alc_wave_probe(int type);
328 void alc_pulse_init(BackendFuncs *func_list);
329 void alc_pulse_deinit(void);
330 void alc_pulse_probe(int type);
331 void alc_ca_init(BackendFuncs *func_list);
332 void alc_ca_deinit(void);
333 void alc_ca_probe(int type);
334 void alc_opensl_init(BackendFuncs *func_list);
335 void alc_opensl_deinit(void);
336 void alc_opensl_probe(int type);
337 void alc_null_init(BackendFuncs *func_list);
338 void alc_null_deinit(void);
339 void alc_null_probe(int type);
340 void alc_loopback_init(BackendFuncs *func_list);
341 void alc_loopback_deinit(void);
342 void alc_loopback_probe(int type);
345 typedef struct UIntMap {
346 struct {
347 ALuint key;
348 ALvoid *value;
349 } *array;
350 ALsizei size;
351 ALsizei maxsize;
352 } UIntMap;
354 void InitUIntMap(UIntMap *map);
355 void ResetUIntMap(UIntMap *map);
356 ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value);
357 void RemoveUIntMapKey(UIntMap *map, ALuint key);
358 ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key);
360 /* Device formats */
361 enum DevFmtType {
362 DevFmtByte = AL_BYTE,
363 DevFmtUByte = AL_UNSIGNED_BYTE,
364 DevFmtShort = AL_SHORT,
365 DevFmtUShort = AL_UNSIGNED_SHORT,
366 DevFmtFloat = AL_FLOAT
368 enum DevFmtChannels {
369 DevFmtMono = AL_MONO,
370 DevFmtStereo = AL_STEREO,
371 DevFmtQuad = AL_QUAD,
372 DevFmtX51 = AL_5POINT1,
373 DevFmtX61 = AL_6POINT1,
374 DevFmtX71 = AL_7POINT1,
376 /* Similar to 5.1, except using the side channels instead of back */
377 DevFmtX51Side = 0x80000000 | AL_5POINT1
380 ALuint BytesFromDevFmt(enum DevFmtType type);
381 ALuint ChannelsFromDevFmt(enum DevFmtChannels chans);
382 static __inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans,
383 enum DevFmtType type)
385 return ChannelsFromDevFmt(chans) * BytesFromDevFmt(type);
389 extern const struct EffectList {
390 const char *name;
391 int type;
392 const char *ename;
393 ALenum val;
394 } EffectList[];
397 struct ALCdevice_struct
399 ALCboolean Connected;
400 ALboolean IsCaptureDevice;
401 ALboolean IsLoopbackDevice;
403 ALuint Frequency;
404 ALuint UpdateSize;
405 ALuint NumUpdates;
406 enum DevFmtChannels FmtChans;
407 enum DevFmtType FmtType;
409 ALCchar *szDeviceName;
411 ALCenum LastError;
413 // Maximum number of sources that can be created
414 ALuint MaxNoOfSources;
415 // Maximum number of slots that can be created
416 ALuint AuxiliaryEffectSlotMax;
418 ALCuint NumMonoSources;
419 ALCuint NumStereoSources;
420 ALuint NumAuxSends;
422 // Map of Buffers for this device
423 UIntMap BufferMap;
425 // Map of Effects for this device
426 UIntMap EffectMap;
428 // Map of Filters for this device
429 UIntMap FilterMap;
431 // Map of Databuffers for this device
432 UIntMap DatabufferMap;
434 // Stereo-to-binaural filter
435 struct bs2b *Bs2b;
436 ALCint Bs2bLevel;
438 // Device flags
439 ALuint Flags;
441 // Dry path buffer mix
442 ALfloat DryBuffer[BUFFERSIZE][MAXCHANNELS];
444 ALuint DevChannels[MAXCHANNELS];
446 Channel Speaker2Chan[MAXCHANNELS];
447 ALfloat PanningLUT[LUT_NUM][MAXCHANNELS];
448 ALuint NumChan;
450 ALfloat ClickRemoval[MAXCHANNELS];
451 ALfloat PendingClicks[MAXCHANNELS];
453 // Contexts created on this device
454 ALCcontext **Contexts;
455 ALuint NumContexts;
457 BackendFuncs *Funcs;
458 void *ExtraData; // For the backend's use
460 ALCdevice *next;
463 #define ALCdevice_OpenPlayback(a,b) ((a)->Funcs->OpenPlayback((a), (b)))
464 #define ALCdevice_ClosePlayback(a) ((a)->Funcs->ClosePlayback((a)))
465 #define ALCdevice_ResetPlayback(a) ((a)->Funcs->ResetPlayback((a)))
466 #define ALCdevice_StopPlayback(a) ((a)->Funcs->StopPlayback((a)))
467 #define ALCdevice_OpenCapture(a,b) ((a)->Funcs->OpenCapture((a), (b)))
468 #define ALCdevice_CloseCapture(a) ((a)->Funcs->CloseCapture((a)))
469 #define ALCdevice_StartCapture(a) ((a)->Funcs->StartCapture((a)))
470 #define ALCdevice_StopCapture(a) ((a)->Funcs->StopCapture((a)))
471 #define ALCdevice_CaptureSamples(a,b,c) ((a)->Funcs->CaptureSamples((a), (b), (c)))
472 #define ALCdevice_AvailableSamples(a) ((a)->Funcs->AvailableSamples((a)))
474 // Duplicate stereo sources on the side/rear channels
475 #define DEVICE_DUPLICATE_STEREO (1<<0)
476 // Use HRTF filters for mixing sounds
477 #define DEVICE_USE_HRTF (1<<1)
478 // Frequency was requested by the app or config file
479 #define DEVICE_FREQUENCY_REQUEST (1<<2)
480 // Channel configuration was requested by the config file
481 #define DEVICE_CHANNELS_REQUEST (1<<3)
484 struct ALCcontext_struct
486 ALlistener Listener;
488 UIntMap SourceMap;
489 UIntMap EffectSlotMap;
491 struct ALdatabuffer *SampleSource;
492 struct ALdatabuffer *SampleSink;
494 ALenum LastError;
496 ALboolean Suspended;
498 ALenum DistanceModel;
499 ALboolean SourceDistanceModel;
501 ALfloat DopplerFactor;
502 ALfloat DopplerVelocity;
503 ALfloat flSpeedOfSound;
505 struct ALsource **ActiveSources;
506 ALsizei ActiveSourceCount;
507 ALsizei MaxActiveSources;
509 ALCdevice *Device;
510 const ALCchar *ExtensionList;
512 ALCcontext *next;
515 void AppendDeviceList(const ALCchar *name);
516 void AppendAllDeviceList(const ALCchar *name);
517 void AppendCaptureDeviceList(const ALCchar *name);
519 ALCvoid alcSetError(ALCdevice *device, ALenum errorCode);
521 ALCvoid SuspendContext(ALCcontext *context);
522 ALCvoid ProcessContext(ALCcontext *context);
524 ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr);
525 ALuint StopThread(ALvoid *thread);
527 ALCcontext *GetContextSuspended(void);
529 typedef struct RingBuffer RingBuffer;
530 RingBuffer *CreateRingBuffer(ALsizei frame_size, ALsizei length);
531 void DestroyRingBuffer(RingBuffer *ring);
532 ALsizei RingBufferSize(RingBuffer *ring);
533 void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len);
534 void ReadRingBuffer(RingBuffer *ring, ALubyte *data, ALsizei len);
536 void ReadALConfig(void);
537 void FreeALConfig(void);
538 int ConfigValueExists(const char *blockName, const char *keyName);
539 const char *GetConfigValue(const char *blockName, const char *keyName, const char *def);
540 int GetConfigValueInt(const char *blockName, const char *keyName, int def);
541 float GetConfigValueFloat(const char *blockName, const char *keyName, float def);
542 int GetConfigValueBool(const char *blockName, const char *keyName, int def);
544 void SetRTPriority(void);
546 void SetDefaultChannelOrder(ALCdevice *device);
547 void SetDefaultWFXChannelOrder(ALCdevice *device);
549 const ALCchar *DevFmtTypeString(enum DevFmtType type);
550 const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans);
552 ALboolean IsValidType(ALenum type);
553 ALboolean IsValidChannels(ALenum type);
555 #define HRIR_BITS (5)
556 #define HRIR_LENGTH (1<<HRIR_BITS)
557 #define HRIR_LENGTH_MASK (HRIR_LENGTH-1)
558 void InitHrtf(void);
559 void GetHrtfCoeffs(ALfloat elevation, ALfloat angle, const ALshort **left, const ALshort **right, ALuint *ldelay, ALuint *rdelay);
561 void al_print(const char *fname, unsigned int line, const char *fmt, ...)
562 PRINTF_STYLE(3,4);
563 #define AL_PRINT(...) al_print(__FILE__, __LINE__, __VA_ARGS__)
565 extern ALdouble ConeScale;
566 extern ALdouble ZScale;
568 #ifdef __cplusplus
570 #endif
572 #endif