Mercurial > audio-send
diff OpenAL32/Include/alMain.h @ 0:f9476ff7637e
initial forking of open-al to create multiple listeners
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 25 Oct 2011 13:02:31 -0700 |
parents | |
children | 96298d83959c |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/OpenAL32/Include/alMain.h Tue Oct 25 13:02:31 2011 -0700 1.3 @@ -0,0 +1,598 @@ 1.4 +#ifndef AL_MAIN_H 1.5 +#define AL_MAIN_H 1.6 + 1.7 +#include <string.h> 1.8 +#include <stdio.h> 1.9 +#include <stdarg.h> 1.10 + 1.11 +#ifdef HAVE_FENV_H 1.12 +#include <fenv.h> 1.13 +#endif 1.14 + 1.15 +#include "AL/al.h" 1.16 +#include "AL/alc.h" 1.17 +#include "AL/alext.h" 1.18 + 1.19 +#ifndef ALC_SOFT_device_loopback 1.20 +#define ALC_SOFT_device_loopback 1 1.21 +#define ALC_FORMAT_CHANNELS_SOFT 0x1990 1.22 +#define ALC_FORMAT_TYPE_SOFT 0x1991 1.23 + 1.24 +/* Sample types */ 1.25 +#define ALC_BYTE 0x1400 1.26 +#define ALC_UNSIGNED_BYTE 0x1401 1.27 +#define ALC_SHORT 0x1402 1.28 +#define ALC_UNSIGNED_SHORT 0x1403 1.29 +#define ALC_INT 0x1404 1.30 +#define ALC_UNSIGNED_INT 0x1405 1.31 +#define ALC_FLOAT 0x1406 1.32 + 1.33 +/* Channel configurations */ 1.34 +#define ALC_MONO 0x1500 1.35 +#define ALC_STEREO 0x1501 1.36 +#define ALC_QUAD 0x1503 1.37 +#define ALC_5POINT1 0x1504 /* (WFX order) */ 1.38 +#define ALC_6POINT1 0x1505 /* (WFX order) */ 1.39 +#define ALC_7POINT1 0x1506 /* (WFX order) */ 1.40 + 1.41 +typedef ALCdevice* (ALC_APIENTRY*LPALCLOOPBACKOPENDEVICESOFT)(void); 1.42 +typedef ALCboolean (ALC_APIENTRY*LPALCISRENDERFORMATSUPPORTEDSOFT)(ALCdevice *device, ALCsizei freq, ALCenum channels, ALCenum type); 1.43 +typedef void (ALC_APIENTRY*LPALCRENDERSAMPLESSOFT)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples); 1.44 +#ifdef AL_ALEXT_PROTOTYPES 1.45 +ALC_API ALCdevice* ALC_APIENTRY alcLoopbackOpenDeviceSOFT(void); 1.46 +ALC_API ALCboolean ALC_APIENTRY alcIsRenderFormatSupportedSOFT(ALCdevice *device, ALCsizei freq, ALCenum channels, ALCenum type); 1.47 +ALC_API void ALC_APIENTRY alcRenderSamplesSOFT(ALCdevice *device, ALCvoid *buffer, ALCsizei samples); 1.48 +#endif 1.49 +#endif 1.50 + 1.51 +#ifndef AL_SOFT_buffer_samples 1.52 +#define AL_SOFT_buffer_samples 1 1.53 +/* Sample types */ 1.54 +#define AL_BYTE 0x1400 1.55 +#define AL_UNSIGNED_BYTE 0x1401 1.56 +#define AL_SHORT 0x1402 1.57 +#define AL_UNSIGNED_SHORT 0x1403 1.58 +#define AL_INT 0x1404 1.59 +#define AL_UNSIGNED_INT 0x1405 1.60 +#define AL_FLOAT 0x1406 1.61 +#define AL_DOUBLE 0x1407 1.62 +#define AL_BYTE3 0x1408 1.63 +#define AL_UNSIGNED_BYTE3 0x1409 1.64 +#define AL_MULAW 0x1410 1.65 +#define AL_IMA4 0x1411 1.66 + 1.67 +/* Channel configurations */ 1.68 +#define AL_MONO 0x1500 1.69 +#define AL_STEREO 0x1501 1.70 +#define AL_REAR 0x1502 1.71 +#define AL_QUAD 0x1503 1.72 +#define AL_5POINT1 0x1504 /* (WFX order) */ 1.73 +#define AL_6POINT1 0x1505 /* (WFX order) */ 1.74 +#define AL_7POINT1 0x1506 /* (WFX order) */ 1.75 + 1.76 +/* Storage formats */ 1.77 +#define AL_MONO8 0x1100 1.78 +#define AL_MONO16 0x1101 1.79 +#define AL_MONO32F 0x10010 1.80 +#define AL_STEREO8 0x1102 1.81 +#define AL_STEREO16 0x1103 1.82 +#define AL_STEREO32F 0x10011 1.83 +#define AL_QUAD8 0x1204 1.84 +#define AL_QUAD16 0x1205 1.85 +#define AL_QUAD32F 0x1206 1.86 +#define AL_REAR8 0x1207 1.87 +#define AL_REAR16 0x1208 1.88 +#define AL_REAR32F 0x1209 1.89 +#define AL_5POINT1_8 0x120A 1.90 +#define AL_5POINT1_16 0x120B 1.91 +#define AL_5POINT1_32F 0x120C 1.92 +#define AL_6POINT1_8 0x120D 1.93 +#define AL_6POINT1_16 0x120E 1.94 +#define AL_6POINT1_32F 0x120F 1.95 +#define AL_7POINT1_8 0x1210 1.96 +#define AL_7POINT1_16 0x1211 1.97 +#define AL_7POINT1_32F 0x1212 1.98 + 1.99 +typedef void (AL_APIENTRY*LPALBUFFERSAMPLESSOFT)(ALuint,ALuint,ALenum,ALsizei,ALenum,ALenum,const ALvoid*); 1.100 +typedef void (AL_APIENTRY*LPALBUFFERSUBSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,const ALvoid*); 1.101 +typedef void (AL_APIENTRY*LPALGETBUFFERSAMPLESSOFT)(ALuint,ALsizei,ALsizei,ALenum,ALenum,ALvoid*); 1.102 +typedef ALboolean (AL_APIENTRY*LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum); 1.103 +#ifdef AL_ALEXT_PROTOTYPES 1.104 +AL_API void AL_APIENTRY alBufferSamplesSOFT(ALuint buffer, 1.105 + ALuint samplerate, ALenum internalformat, ALsizei frames, 1.106 + ALenum channels, ALenum type, const ALvoid *data); 1.107 +AL_API void AL_APIENTRY alBufferSubSamplesSOFT(ALuint buffer, 1.108 + ALsizei offset, ALsizei frames, 1.109 + ALenum channels, ALenum type, const ALvoid *data); 1.110 +AL_API void AL_APIENTRY alGetBufferSamplesSOFT(ALuint buffer, 1.111 + ALsizei offset, ALsizei frames, 1.112 + ALenum channels, ALenum type, ALvoid *data); 1.113 +AL_API ALboolean AL_APIENTRY alIsBufferFormatSupportedSOFT(ALenum format); 1.114 +#endif 1.115 +#endif 1.116 + 1.117 +#ifndef AL_SOFT_non_virtual_channels 1.118 +#define AL_SOFT_non_virtual_channels 1 1.119 +#define AL_VIRTUAL_CHANNELS_SOFT 0x1033 1.120 +#endif 1.121 + 1.122 +#ifndef AL_SOFT_deferred_updates 1.123 +#define AL_SOFT_deferred_updates 1 1.124 +#define AL_DEFERRED_UPDATES_SOFT 0xC002 1.125 +typedef ALvoid (AL_APIENTRY*LPALDEFERUPDATESSOFT)(void); 1.126 +typedef ALvoid (AL_APIENTRY*LPALPROCESSUPDATESSOFT)(void); 1.127 +#ifdef AL_ALEXT_PROTOTYPES 1.128 +AL_API ALvoid AL_APIENTRY alDeferUpdatesSOFT(void); 1.129 +AL_API ALvoid AL_APIENTRY alProcessUpdatesSOFT(void); 1.130 +#endif 1.131 +#endif 1.132 + 1.133 + 1.134 +#if defined(HAVE_STDINT_H) 1.135 +#include <stdint.h> 1.136 +typedef int64_t ALint64; 1.137 +typedef uint64_t ALuint64; 1.138 +#elif defined(HAVE___INT64) 1.139 +typedef __int64 ALint64; 1.140 +typedef unsigned __int64 ALuint64; 1.141 +#elif (SIZEOF_LONG == 8) 1.142 +typedef long ALint64; 1.143 +typedef unsigned long ALuint64; 1.144 +#elif (SIZEOF_LONG_LONG == 8) 1.145 +typedef long long ALint64; 1.146 +typedef unsigned long long ALuint64; 1.147 +#endif 1.148 + 1.149 +typedef ptrdiff_t ALintptrEXT; 1.150 +typedef ptrdiff_t ALsizeiptrEXT; 1.151 + 1.152 +#ifdef HAVE_GCC_FORMAT 1.153 +#define PRINTF_STYLE(x, y) __attribute__((format(printf, (x), (y)))) 1.154 +#else 1.155 +#define PRINTF_STYLE(x, y) 1.156 +#endif 1.157 + 1.158 +#if defined(HAVE_RESTRICT) 1.159 +#define RESTRICT restrict 1.160 +#elif defined(HAVE___RESTRICT) 1.161 +#define RESTRICT __restrict 1.162 +#else 1.163 +#define RESTRICT 1.164 +#endif 1.165 + 1.166 +#ifdef _WIN32 1.167 + 1.168 +#ifndef _WIN32_WINNT 1.169 +#define _WIN32_WINNT 0x0500 1.170 +#endif 1.171 +#include <windows.h> 1.172 + 1.173 +typedef DWORD tls_type; 1.174 +#define tls_create(x) (*(x) = TlsAlloc()) 1.175 +#define tls_delete(x) TlsFree((x)) 1.176 +#define tls_get(x) TlsGetValue((x)) 1.177 +#define tls_set(x, a) TlsSetValue((x), (a)) 1.178 + 1.179 +#define HAVE_DYNLOAD 1 1.180 +void *LoadLib(const char *name); 1.181 +void CloseLib(void *handle); 1.182 +void *GetSymbol(void *handle, const char *name); 1.183 + 1.184 +typedef LONG pthread_once_t; 1.185 +#define PTHREAD_ONCE_INIT 0 1.186 +void pthread_once(pthread_once_t *once, void (*callback)(void)); 1.187 + 1.188 +#else 1.189 + 1.190 +#include <unistd.h> 1.191 +#include <assert.h> 1.192 +#include <pthread.h> 1.193 +#ifdef HAVE_PTHREAD_NP_H 1.194 +#include <pthread_np.h> 1.195 +#endif 1.196 +#include <sys/time.h> 1.197 +#include <time.h> 1.198 +#include <errno.h> 1.199 + 1.200 +#define IsBadWritePtr(a,b) ((a) == NULL && (b) != 0) 1.201 + 1.202 +typedef pthread_key_t tls_type; 1.203 +#define tls_create(x) pthread_key_create((x), NULL) 1.204 +#define tls_delete(x) pthread_key_delete((x)) 1.205 +#define tls_get(x) pthread_getspecific((x)) 1.206 +#define tls_set(x, a) pthread_setspecific((x), (a)) 1.207 + 1.208 +typedef pthread_mutex_t CRITICAL_SECTION; 1.209 +void InitializeCriticalSection(CRITICAL_SECTION *cs); 1.210 +void DeleteCriticalSection(CRITICAL_SECTION *cs); 1.211 +void EnterCriticalSection(CRITICAL_SECTION *cs); 1.212 +void LeaveCriticalSection(CRITICAL_SECTION *cs); 1.213 + 1.214 +ALuint timeGetTime(void); 1.215 + 1.216 +static __inline void Sleep(ALuint t) 1.217 +{ 1.218 + struct timespec tv, rem; 1.219 + tv.tv_nsec = (t*1000000)%1000000000; 1.220 + tv.tv_sec = t/1000; 1.221 + 1.222 + while(nanosleep(&tv, &rem) == -1 && errno == EINTR) 1.223 + tv = rem; 1.224 +} 1.225 + 1.226 +#if defined(HAVE_DLFCN_H) 1.227 +#define HAVE_DYNLOAD 1 1.228 +void *LoadLib(const char *name); 1.229 +void CloseLib(void *handle); 1.230 +void *GetSymbol(void *handle, const char *name); 1.231 +#endif 1.232 + 1.233 +#endif 1.234 + 1.235 +#include "alListener.h" 1.236 +#include "alu.h" 1.237 + 1.238 +#ifdef __cplusplus 1.239 +extern "C" { 1.240 +#endif 1.241 + 1.242 + 1.243 +#define DEFAULT_OUTPUT_RATE (44100) 1.244 + 1.245 +#define SPEEDOFSOUNDMETRESPERSEC (343.3f) 1.246 +#define AIRABSORBGAINHF (0.99426) /* -0.05dB */ 1.247 + 1.248 +#define LOWPASSFREQCUTOFF (5000) 1.249 + 1.250 + 1.251 +// Find the next power-of-2 for non-power-of-2 numbers. 1.252 +static __inline ALuint NextPowerOf2(ALuint value) 1.253 +{ 1.254 + ALuint powerOf2 = 1; 1.255 + 1.256 + if(value) 1.257 + { 1.258 + value--; 1.259 + while(value) 1.260 + { 1.261 + value >>= 1; 1.262 + powerOf2 <<= 1; 1.263 + } 1.264 + } 1.265 + return powerOf2; 1.266 +} 1.267 + 1.268 + 1.269 +enum DevProbe { 1.270 + DEVICE_PROBE, 1.271 + ALL_DEVICE_PROBE, 1.272 + CAPTURE_DEVICE_PROBE 1.273 +}; 1.274 + 1.275 +typedef struct { 1.276 + ALCboolean (*OpenPlayback)(ALCdevice*, const ALCchar*); 1.277 + void (*ClosePlayback)(ALCdevice*); 1.278 + ALCboolean (*ResetPlayback)(ALCdevice*); 1.279 + void (*StopPlayback)(ALCdevice*); 1.280 + 1.281 + ALCboolean (*OpenCapture)(ALCdevice*, const ALCchar*); 1.282 + void (*CloseCapture)(ALCdevice*); 1.283 + void (*StartCapture)(ALCdevice*); 1.284 + void (*StopCapture)(ALCdevice*); 1.285 + void (*CaptureSamples)(ALCdevice*, void*, ALCuint); 1.286 + ALCuint (*AvailableSamples)(ALCdevice*); 1.287 +} BackendFuncs; 1.288 + 1.289 +struct BackendInfo { 1.290 + const char *name; 1.291 + ALCboolean (*Init)(BackendFuncs*); 1.292 + void (*Deinit)(void); 1.293 + void (*Probe)(enum DevProbe); 1.294 + BackendFuncs Funcs; 1.295 +}; 1.296 + 1.297 +ALCboolean alc_alsa_init(BackendFuncs *func_list); 1.298 +void alc_alsa_deinit(void); 1.299 +void alc_alsa_probe(enum DevProbe type); 1.300 +ALCboolean alc_oss_init(BackendFuncs *func_list); 1.301 +void alc_oss_deinit(void); 1.302 +void alc_oss_probe(enum DevProbe type); 1.303 +ALCboolean alc_solaris_init(BackendFuncs *func_list); 1.304 +void alc_solaris_deinit(void); 1.305 +void alc_solaris_probe(enum DevProbe type); 1.306 +ALCboolean alc_sndio_init(BackendFuncs *func_list); 1.307 +void alc_sndio_deinit(void); 1.308 +void alc_sndio_probe(enum DevProbe type); 1.309 +ALCboolean alcMMDevApiInit(BackendFuncs *func_list); 1.310 +void alcMMDevApiDeinit(void); 1.311 +void alcMMDevApiProbe(enum DevProbe type); 1.312 +ALCboolean alcDSoundInit(BackendFuncs *func_list); 1.313 +void alcDSoundDeinit(void); 1.314 +void alcDSoundProbe(enum DevProbe type); 1.315 +ALCboolean alcWinMMInit(BackendFuncs *FuncList); 1.316 +void alcWinMMDeinit(void); 1.317 +void alcWinMMProbe(enum DevProbe type); 1.318 +ALCboolean alc_pa_init(BackendFuncs *func_list); 1.319 +void alc_pa_deinit(void); 1.320 +void alc_pa_probe(enum DevProbe type); 1.321 +ALCboolean alc_wave_init(BackendFuncs *func_list); 1.322 +void alc_wave_deinit(void); 1.323 +void alc_wave_probe(enum DevProbe type); 1.324 +ALCboolean alc_pulse_init(BackendFuncs *func_list); 1.325 +void alc_pulse_deinit(void); 1.326 +void alc_pulse_probe(enum DevProbe type); 1.327 +ALCboolean alc_ca_init(BackendFuncs *func_list); 1.328 +void alc_ca_deinit(void); 1.329 +void alc_ca_probe(enum DevProbe type); 1.330 +ALCboolean alc_opensl_init(BackendFuncs *func_list); 1.331 +void alc_opensl_deinit(void); 1.332 +void alc_opensl_probe(enum DevProbe type); 1.333 +ALCboolean alc_null_init(BackendFuncs *func_list); 1.334 +void alc_null_deinit(void); 1.335 +void alc_null_probe(enum DevProbe type); 1.336 +ALCboolean alc_loopback_init(BackendFuncs *func_list); 1.337 +void alc_loopback_deinit(void); 1.338 +void alc_loopback_probe(enum DevProbe type); 1.339 + 1.340 +//RLM: aurellem send device insertion 1.341 +ALCboolean alc_send_init(BackendFuncs *func_list); 1.342 +void alc_send_deinit(void); 1.343 +void alc_send_probe(enum DevProbe type); 1.344 + 1.345 + 1.346 +typedef struct UIntMap { 1.347 + struct { 1.348 + ALuint key; 1.349 + ALvoid *value; 1.350 + } *array; 1.351 + ALsizei size; 1.352 + ALsizei maxsize; 1.353 +} UIntMap; 1.354 + 1.355 +void InitUIntMap(UIntMap *map); 1.356 +void ResetUIntMap(UIntMap *map); 1.357 +ALenum InsertUIntMapEntry(UIntMap *map, ALuint key, ALvoid *value); 1.358 +void RemoveUIntMapKey(UIntMap *map, ALuint key); 1.359 +ALvoid *LookupUIntMapKey(UIntMap *map, ALuint key); 1.360 + 1.361 +/* Device formats */ 1.362 +enum DevFmtType { 1.363 + DevFmtByte = AL_BYTE, 1.364 + DevFmtUByte = AL_UNSIGNED_BYTE, 1.365 + DevFmtShort = AL_SHORT, 1.366 + DevFmtUShort = AL_UNSIGNED_SHORT, 1.367 + DevFmtFloat = AL_FLOAT 1.368 +}; 1.369 +enum DevFmtChannels { 1.370 + DevFmtMono = AL_MONO, 1.371 + DevFmtStereo = AL_STEREO, 1.372 + DevFmtQuad = AL_QUAD, 1.373 + DevFmtX51 = AL_5POINT1, 1.374 + DevFmtX61 = AL_6POINT1, 1.375 + DevFmtX71 = AL_7POINT1, 1.376 + 1.377 + /* Similar to 5.1, except using the side channels instead of back */ 1.378 + DevFmtX51Side = 0x80000000 | AL_5POINT1 1.379 +}; 1.380 + 1.381 +ALuint BytesFromDevFmt(enum DevFmtType type); 1.382 +ALuint ChannelsFromDevFmt(enum DevFmtChannels chans); 1.383 +static __inline ALuint FrameSizeFromDevFmt(enum DevFmtChannels chans, 1.384 + enum DevFmtType type) 1.385 +{ 1.386 + return ChannelsFromDevFmt(chans) * BytesFromDevFmt(type); 1.387 +} 1.388 + 1.389 + 1.390 +extern const struct EffectList { 1.391 + const char *name; 1.392 + int type; 1.393 + const char *ename; 1.394 + ALenum val; 1.395 +} EffectList[]; 1.396 + 1.397 + 1.398 +struct ALCdevice_struct 1.399 +{ 1.400 + ALCboolean Connected; 1.401 + ALboolean IsCaptureDevice; 1.402 + ALboolean IsLoopbackDevice; 1.403 + 1.404 + CRITICAL_SECTION Mutex; 1.405 + 1.406 + ALuint Frequency; 1.407 + ALuint UpdateSize; 1.408 + ALuint NumUpdates; 1.409 + enum DevFmtChannels FmtChans; 1.410 + enum DevFmtType FmtType; 1.411 + 1.412 + ALCchar *szDeviceName; 1.413 + 1.414 + ALCenum LastError; 1.415 + 1.416 + // Maximum number of sources that can be created 1.417 + ALuint MaxNoOfSources; 1.418 + // Maximum number of slots that can be created 1.419 + ALuint AuxiliaryEffectSlotMax; 1.420 + 1.421 + ALCuint NumMonoSources; 1.422 + ALCuint NumStereoSources; 1.423 + ALuint NumAuxSends; 1.424 + 1.425 + // Map of Buffers for this device 1.426 + UIntMap BufferMap; 1.427 + 1.428 + // Map of Effects for this device 1.429 + UIntMap EffectMap; 1.430 + 1.431 + // Map of Filters for this device 1.432 + UIntMap FilterMap; 1.433 + 1.434 + // Stereo-to-binaural filter 1.435 + struct bs2b *Bs2b; 1.436 + ALCint Bs2bLevel; 1.437 + 1.438 + // Device flags 1.439 + ALuint Flags; 1.440 + 1.441 + // Dry path buffer mix 1.442 + ALfloat DryBuffer[BUFFERSIZE][MAXCHANNELS]; 1.443 + 1.444 + enum Channel DevChannels[MAXCHANNELS]; 1.445 + 1.446 + enum Channel Speaker2Chan[MAXCHANNELS]; 1.447 + ALfloat PanningLUT[LUT_NUM][MAXCHANNELS]; 1.448 + ALuint NumChan; 1.449 + 1.450 + ALfloat ClickRemoval[MAXCHANNELS]; 1.451 + ALfloat PendingClicks[MAXCHANNELS]; 1.452 + 1.453 + // Contexts created on this device 1.454 + ALCcontext **Contexts; 1.455 + ALuint NumContexts; 1.456 + 1.457 + BackendFuncs *Funcs; 1.458 + void *ExtraData; // For the backend's use 1.459 + 1.460 + ALCdevice *next; 1.461 +}; 1.462 + 1.463 +#define ALCdevice_OpenPlayback(a,b) ((a)->Funcs->OpenPlayback((a), (b))) 1.464 +#define ALCdevice_ClosePlayback(a) ((a)->Funcs->ClosePlayback((a))) 1.465 +#define ALCdevice_ResetPlayback(a) ((a)->Funcs->ResetPlayback((a))) 1.466 +#define ALCdevice_StopPlayback(a) ((a)->Funcs->StopPlayback((a))) 1.467 +#define ALCdevice_OpenCapture(a,b) ((a)->Funcs->OpenCapture((a), (b))) 1.468 +#define ALCdevice_CloseCapture(a) ((a)->Funcs->CloseCapture((a))) 1.469 +#define ALCdevice_StartCapture(a) ((a)->Funcs->StartCapture((a))) 1.470 +#define ALCdevice_StopCapture(a) ((a)->Funcs->StopCapture((a))) 1.471 +#define ALCdevice_CaptureSamples(a,b,c) ((a)->Funcs->CaptureSamples((a), (b), (c))) 1.472 +#define ALCdevice_AvailableSamples(a) ((a)->Funcs->AvailableSamples((a))) 1.473 + 1.474 +// Duplicate stereo sources on the side/rear channels 1.475 +#define DEVICE_DUPLICATE_STEREO (1<<0) 1.476 +// Use HRTF filters for mixing sounds 1.477 +#define DEVICE_USE_HRTF (1<<1) 1.478 +// Frequency was requested by the app or config file 1.479 +#define DEVICE_FREQUENCY_REQUEST (1<<2) 1.480 +// Channel configuration was requested by the config file 1.481 +#define DEVICE_CHANNELS_REQUEST (1<<3) 1.482 + 1.483 +// Specifies if the device is currently running 1.484 +#define DEVICE_RUNNING (1<<31) 1.485 + 1.486 +struct ALCcontext_struct 1.487 +{ 1.488 + ALlistener Listener; 1.489 + 1.490 + UIntMap SourceMap; 1.491 + UIntMap EffectSlotMap; 1.492 + 1.493 + ALenum LastError; 1.494 + 1.495 + ALboolean UpdateSources; 1.496 + 1.497 + enum DistanceModel DistanceModel; 1.498 + ALboolean SourceDistanceModel; 1.499 + 1.500 + ALfloat DopplerFactor; 1.501 + ALfloat DopplerVelocity; 1.502 + ALfloat flSpeedOfSound; 1.503 + ALboolean DeferUpdates; 1.504 + 1.505 + struct ALsource **ActiveSources; 1.506 + ALsizei ActiveSourceCount; 1.507 + ALsizei MaxActiveSources; 1.508 + 1.509 + ALCdevice *Device; 1.510 + const ALCchar *ExtensionList; 1.511 + 1.512 + ALCcontext *next; 1.513 +}; 1.514 + 1.515 +void AppendDeviceList(const ALCchar *name); 1.516 +void AppendAllDeviceList(const ALCchar *name); 1.517 +void AppendCaptureDeviceList(const ALCchar *name); 1.518 + 1.519 +ALCvoid alcSetError(ALCdevice *device, ALenum errorCode); 1.520 + 1.521 +ALCvoid LockDevice(ALCdevice *device); 1.522 +ALCvoid UnlockDevice(ALCdevice *device); 1.523 +ALCvoid LockContext(ALCcontext *context); 1.524 +ALCvoid UnlockContext(ALCcontext *context); 1.525 + 1.526 +ALvoid *StartThread(ALuint (*func)(ALvoid*), ALvoid *ptr); 1.527 +ALuint StopThread(ALvoid *thread); 1.528 + 1.529 +ALCcontext *GetLockedContext(void); 1.530 + 1.531 +typedef struct RingBuffer RingBuffer; 1.532 +RingBuffer *CreateRingBuffer(ALsizei frame_size, ALsizei length); 1.533 +void DestroyRingBuffer(RingBuffer *ring); 1.534 +ALsizei RingBufferSize(RingBuffer *ring); 1.535 +void WriteRingBuffer(RingBuffer *ring, const ALubyte *data, ALsizei len); 1.536 +void ReadRingBuffer(RingBuffer *ring, ALubyte *data, ALsizei len); 1.537 + 1.538 +void ReadALConfig(void); 1.539 +void FreeALConfig(void); 1.540 +int ConfigValueExists(const char *blockName, const char *keyName); 1.541 +const char *GetConfigValue(const char *blockName, const char *keyName, const char *def); 1.542 +int GetConfigValueInt(const char *blockName, const char *keyName, int def); 1.543 +float GetConfigValueFloat(const char *blockName, const char *keyName, float def); 1.544 +int GetConfigValueBool(const char *blockName, const char *keyName, int def); 1.545 + 1.546 +void SetRTPriority(void); 1.547 + 1.548 +void SetDefaultChannelOrder(ALCdevice *device); 1.549 +void SetDefaultWFXChannelOrder(ALCdevice *device); 1.550 + 1.551 +const ALCchar *DevFmtTypeString(enum DevFmtType type); 1.552 +const ALCchar *DevFmtChannelsString(enum DevFmtChannels chans); 1.553 + 1.554 +#define HRIR_BITS (5) 1.555 +#define HRIR_LENGTH (1<<HRIR_BITS) 1.556 +#define HRIR_MASK (HRIR_LENGTH-1) 1.557 +void InitHrtf(void); 1.558 +ALCboolean IsHrtfCompatible(ALCdevice *device); 1.559 +ALfloat CalcHrtfDelta(ALfloat oldGain, ALfloat newGain, const ALfloat olddir[3], const ALfloat newdir[3]); 1.560 +void GetLerpedHrtfCoeffs(ALfloat elevation, ALfloat azimuth, ALfloat gain, ALfloat (*coeffs)[2], ALuint *delays); 1.561 +ALuint GetMovingHrtfCoeffs(ALfloat elevation, ALfloat azimuth, ALfloat gain, ALfloat delta, ALint counter, ALfloat (*coeffs)[2], ALuint *delays, ALfloat (*coeffStep)[2], ALint *delayStep); 1.562 + 1.563 +void al_print(const char *fname, unsigned int line, const char *fmt, ...) 1.564 + PRINTF_STYLE(3,4); 1.565 +#define AL_PRINT(...) al_print(__FILE__, __LINE__, __VA_ARGS__) 1.566 + 1.567 +extern FILE *LogFile; 1.568 +enum LogLevel { 1.569 + NoLog, 1.570 + LogError, 1.571 + LogWarning, 1.572 + LogTrace 1.573 +}; 1.574 +extern enum LogLevel LogLevel; 1.575 + 1.576 +#define TRACE(...) do { \ 1.577 + if(LogLevel >= LogTrace) \ 1.578 + AL_PRINT(__VA_ARGS__); \ 1.579 +} while(0) 1.580 + 1.581 +#define WARN(...) do { \ 1.582 + if(LogLevel >= LogWarning) \ 1.583 + AL_PRINT(__VA_ARGS__); \ 1.584 +} while(0) 1.585 + 1.586 +#define ERR(...) do { \ 1.587 + if(LogLevel >= LogError) \ 1.588 + AL_PRINT(__VA_ARGS__); \ 1.589 +} while(0) 1.590 + 1.591 + 1.592 +extern ALdouble ConeScale; 1.593 +extern ALdouble ZScale; 1.594 + 1.595 +extern ALint RTPrioLevel; 1.596 + 1.597 +#ifdef __cplusplus 1.598 +} 1.599 +#endif 1.600 + 1.601 +#endif