From 26b9cf5a0ca15a80690060daf5f3cbf0576ade28 Mon Sep 17 00:00:00 2001 From: icculus Date: Sat, 26 Nov 2005 07:59:00 +0000 Subject: SDL and OpenAL headers. git-svn-id: svn://svn.icculus.org/quake3/trunk@374 edf5b092-35ff-0310-97b2-ce42778d08ea --- code/AL/al.h | 587 ++++++++++++++++++++++++++++++++++++++++++++++++++++ code/AL/alc.h | 110 ++++++++++ code/AL/alctypes.h | 88 ++++++++ code/AL/altypes.h | 441 +++++++++++++++++++++++++++++++++++++++ code/AL/alu.h | 55 +++++ code/AL/alut.h | 94 +++++++++ code/AL/aluttypes.h | 6 + code/AL/alutypes.h | 5 + 8 files changed, 1386 insertions(+) create mode 100644 code/AL/al.h create mode 100644 code/AL/alc.h create mode 100644 code/AL/alctypes.h create mode 100644 code/AL/altypes.h create mode 100644 code/AL/alu.h create mode 100644 code/AL/alut.h create mode 100644 code/AL/aluttypes.h create mode 100644 code/AL/alutypes.h (limited to 'code/AL') diff --git a/code/AL/al.h b/code/AL/al.h new file mode 100644 index 0000000..522cc5f --- /dev/null +++ b/code/AL/al.h @@ -0,0 +1,587 @@ +#ifndef __al_h_ +#define __al_h_ + +/** + * OpenAL cross platform audio library + * Copyright (C) 1999-2000 by authors. + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Library General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Library General Public License for more details. + * + * You should have received a copy of the GNU Library General Public + * License along with this library; if not, write to the + * Free Software Foundation, Inc., 59 Temple Place - Suite 330, + * Boston, MA 02111-1307, USA. + * Or go to http://www.gnu.org/copyleft/lgpl.html + */ +#include "altypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#ifdef _WIN32 +#define ALAPI __declspec(dllexport) +#define ALAPIENTRY __cdecl +#define AL_CALLBACK +#else /* _WIN32 */ + +#ifdef TARGET_OS_MAC +#if TARGET_OS_MAC +#pragma export on +#endif /* TARGET_OS_MAC */ +#endif /* TARGET_OS_MAC */ + +#ifndef ALAPI +#define ALAPI +#endif + +#ifndef ALAPIENTRY +#define ALAPIENTRY +#endif + +#ifndef CALLBACK +#define AL_CALLBACK +#endif + +#endif /* _WIN32 */ + +#ifndef AL_NO_PROTOTYPES + +/** + * OpenAL Maintenance Functions + * State Management and Query. + * Error Handling. + * Extension Support. + */ + + +/** Renderer State management. */ +ALAPI void ALAPIENTRY alEnable( ALenum capability ); + +ALAPI void ALAPIENTRY alDisable( ALenum capability ); + +ALAPI ALboolean ALAPIENTRY alIsEnabled( ALenum capability ); + +/** Application preferences for driver performance choices. */ +ALAPI void ALAPIENTRY alHint( ALenum target, ALenum mode ); + +/** State retrieval. */ +ALAPI void ALAPIENTRY alGetBooleanv( ALenum param, ALboolean* data ); + +/** State retrieval. */ +ALAPI void ALAPIENTRY alGetIntegerv( ALenum param, ALint* data ); + +/** State retrieval. */ +ALAPI void ALAPIENTRY alGetFloatv( ALenum param, ALfloat* data ); + +/** State retrieval. */ +ALAPI void ALAPIENTRY alGetDoublev( ALenum param, ALdouble* data ); + +/** State retrieval. */ +ALAPI const ALubyte* ALAPIENTRY alGetString( ALenum param ); + + +/** State retrieval.through return value ( for compatibility ) */ +ALAPI ALboolean ALAPIENTRY alGetBoolean( ALenum param ); +ALAPI ALint ALAPIENTRY alGetInteger( ALenum param ); +ALAPI ALfloat ALAPIENTRY alGetFloat( ALenum param ); +ALAPI ALdouble ALAPIENTRY alGetDouble( ALenum param ); + +/** + * Error support. + * Obtain the most recent error generated in the AL state machine. + */ +ALAPI ALenum ALAPIENTRY alGetError( ALvoid ); + +/** + * Extension support. + * Obtain the address of a function (usually an extension) + * with the name fname. All addresses are context-independent. + */ +ALAPI ALboolean ALAPIENTRY alIsExtensionPresent( const ALubyte* fname ); + + +/** + * Extension support. + * Obtain the address of a function (usually an extension) + * with the name fname. All addresses are context-independent. + */ +ALAPI void* ALAPIENTRY alGetProcAddress( const ALubyte* fname ); + + +/** + * Extension support. + * Obtain the integer value of an enumeration (usually an extension) with the name ename. + */ +ALAPI ALenum ALAPIENTRY alGetEnumValue( const ALubyte* ename ); + + + + + + +/** + * LISTENER + * Listener is the sample position for a given context. + * The multi-channel (usually stereo) output stream generated + * by the mixer is parametrized by this Listener object: + * its position and velocity relative to Sources, within + * occluder and reflector geometry. + */ + + + +/** + * + * Listener Gain: default 1.0f. + */ +ALAPI void ALAPIENTRY alListenerf( ALenum pname, ALfloat param ); + +ALAPI void ALAPIENTRY alListeneri( ALenum pname, ALint param ); + +/** + * + * Listener Position: ALfloat[3] + * Listener Velocity: ALfloat[3] + */ +ALAPI void ALAPIENTRY alListener3f( ALenum pname, + ALfloat f1, ALfloat f2, ALfloat f3 ); + +/** + * + * Listener Position: ALfloat[3] + * Listener Velocity: ALfloat[3] + * Listener Orientation: ALfloat[6] (forward and up vector). + */ +ALAPI void ALAPIENTRY alListenerfv( ALenum pname, ALfloat* param ); + +/* + * Retrieve listener information. + */ +ALAPI void ALAPIENTRY alGetListeneri( ALenum pname, ALint* value ); +ALAPI void ALAPIENTRY alGetListenerf( ALenum pname, ALfloat* value ); + +ALAPI void ALAPIENTRY alGetListeneriv( ALenum pname, ALint* value ); +ALAPI void ALAPIENTRY alGetListenerfv( ALenum pname, ALfloat* values ); + +ALAPI void ALAPIENTRY alGetListener3f( ALenum pname, + ALfloat *f1, ALfloat *f2, ALfloat *f3 ); + +/** + * SOURCE + * Source objects are by default localized. Sources + * take the PCM data provided in the specified Buffer, + * apply Source-specific modifications, and then + * submit them to be mixed according to spatial + * arrangement etc. + */ + + + +/** Create Source objects. */ +ALAPI void ALAPIENTRY alGenSources( ALsizei n, ALuint* sources ); + +/** Delete Source objects. */ +ALAPI void ALAPIENTRY alDeleteSources( ALsizei n, ALuint* sources ); + +/** Verify a handle is a valid Source. */ +ALAPI ALboolean ALAPIENTRY alIsSource( ALuint sid ); + + +/** Set an integer parameter for a Source object. */ +ALAPI void ALAPIENTRY alSourcei( ALuint sid, ALenum param, ALint value ); +ALAPI void ALAPIENTRY alSourcef( ALuint sid, ALenum param, ALfloat value ); +ALAPI void ALAPIENTRY alSource3f( ALuint sid, ALenum param, + ALfloat f1, ALfloat f2, ALfloat f3 ); +ALAPI void ALAPIENTRY alSourcefv( ALuint sid, ALenum param, ALfloat* values ); + +/** Get an integer parameter for a Source object. */ +ALAPI void ALAPIENTRY alGetSourcei( ALuint sid, ALenum pname, ALint* value ); +ALAPI void ALAPIENTRY alGetSourceiv( ALuint sid, ALenum pname, ALint* values ); +ALAPI void ALAPIENTRY alGetSourcef( ALuint sid, ALenum pname, ALfloat* value ); +ALAPI void ALAPIENTRY alGetSourcefv( ALuint sid, ALenum pname, ALfloat* values ); + +/* deprecated, included for Win compatibility */ +ALAPI void ALAPIENTRY alGetSource3f( ALuint sid, ALenum pname, ALfloat* value1, + ALfloat* value2, ALfloat* value3); + +ALAPI void ALAPIENTRY alSourcePlayv( ALsizei ns, ALuint *ids ); +ALAPI void ALAPIENTRY alSourceStopv( ALsizei ns, ALuint *ids ); +ALAPI void ALAPIENTRY alSourceRewindv( ALsizei ns, ALuint *ids ); +ALAPI void ALAPIENTRY alSourcePausev( ALsizei ns, ALuint *ids ); + +/** Activate a source, start replay. */ +ALAPI void ALAPIENTRY alSourcePlay( ALuint sid ); + +/** + * Pause a source, + * temporarily remove it from the mixer list. + */ +ALAPI void ALAPIENTRY alSourcePause( ALuint sid ); + +/** + * Rewind a source, + * set the source to play at the beginning. + */ +ALAPI void ALAPIENTRY alSourceRewind( ALuint sid ); + +/** + * Stop a source, + * temporarily remove it from the mixer list, + * and reset its internal state to pre-Play. + * To remove a Source completely, it has to be + * deleted following Stop, or before Play. + */ +ALAPI void ALAPIENTRY alSourceStop( ALuint sid ); + +/** + * BUFFER + * Buffer objects are storage space for sample data. + * Buffers are referred to by Sources. There can be more than + * one Source using the same Buffer data. If Buffers have + * to be duplicated on a per-Source basis, the driver has to + * take care of allocation, copying, and deallocation as well + * as propagating buffer data changes. + */ + + + + +/** Buffer object generation. */ +ALAPI void ALAPIENTRY alGenBuffers( ALsizei n, ALuint* buffers ); + +ALAPI void ALAPIENTRY alDeleteBuffers( ALsizei n, ALuint* buffers ); + + +ALAPI ALboolean ALAPIENTRY alIsBuffer( ALuint buffer ); + +/** + * Specify the data to be filled into a buffer. + */ +ALAPI void ALAPIENTRY alBufferData( ALuint buffer, + ALenum format, + ALvoid* data, + ALsizei size, + ALsizei freq ); + +ALAPI void ALAPIENTRY alGetBufferi( ALuint buffer, ALenum param, ALint* value ); +ALAPI void ALAPIENTRY alGetBufferf( ALuint buffer, ALenum param, ALfloat* value ); +ALAPI void ALAPIENTRY alGetBufferiv( ALuint buffer, ALenum param, ALint *v); +ALAPI void ALAPIENTRY alGetBufferfv( ALuint buffer, ALenum param, ALfloat *v); + + + +/** + * Frequency Domain Filters are band filters. + * Attenuation in Media (distance based) + * Reflection Material + * Occlusion Material (separating surface) + * + * Temporal Domain Filters: + * Early Reflections + * Late Reverb + * + */ + + + + +/** + * EXTENSION: IASIG Level 2 Environment. + * Environment object generation. + * This is an EXTension that describes the Environment/Reverb + * properties according to IASIG Level 2 specifications. + */ + + + + + +/** + * Allocate n environment ids and store them in the array environs. + * Returns the number of environments actually allocated. + */ +ALAPI ALsizei ALAPIENTRY alGenEnvironmentIASIG( ALsizei n, ALuint* environs ); + +ALAPI void ALAPIENTRY alDeleteEnvironmentIASIG( ALsizei n, ALuint* environs ); + +ALAPI ALboolean ALAPIENTRY alIsEnvironmentIASIG( ALuint environ ); + +ALAPI void ALAPIENTRY alEnvironmentiIASIG( ALuint eid, ALenum param, ALint value ); + +ALAPI void ALAPIENTRY alEnvironmentfIASIG( ALuint eid, ALenum param, ALfloat value ); + + + +/** + * Queue stuff + */ +ALAPI void ALAPIENTRY alSourceQueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids ); +ALAPI void ALAPIENTRY alSourceUnqueueBuffers( ALuint sid, ALsizei numEntries, ALuint *bids ); +ALAPI void ALAPIENTRY alQueuei( ALuint sid, ALenum param, ALint value ); + +/** + * Knobs and dials + */ +ALAPI void ALAPIENTRY alDopplerFactor( ALfloat value ); +ALAPI void ALAPIENTRY alDopplerVelocity( ALfloat value ); +ALAPI void ALAPIENTRY alDistanceModel( ALenum distanceModel ); + +#else /* AL_NO_PROTOTYPES */ + + +/** OpenAL Maintenance Functions */ + + void (*alEnable)( ALenum capability ); + void (*alDisable)( ALenum capability ); + ALboolean (*alIsEnabled)( ALenum capability ); + void (*alHint)( ALenum target, ALenum mode ); + ALboolean (*alGetBoolean)( ALenum param ); + ALint (*alGetInteger)( ALenum param ); + ALfloat (*alGetFloat)( ALenum param ); + ALdouble (*alGetDouble)( ALenum param ); + void (*alGetBooleanv)( ALenum param, + ALboolean* data ); + void (*alGetIntegerv)( ALenum param, + ALint* data ); + void (*alGetFloatv)( ALenum param, + ALfloat* data ); + void (*alGetDoublev)( ALenum param, + ALdouble* data ); + const ALubyte* (*GetString)( ALenum param ); + ALenum (*alGetError)( ALvoid ); + + /** + * Extension support. + * Query existance of extension + */ + ALboolean (*alIsExtensionPresent)(const ALubyte* fname ); + + /** + * Extension support. + * Obtain the address of a function (usually an extension) + * with the name fname. All addresses are context-independent. + */ + void* (*alGetProcAddress)( const ALubyte* fname ); + + + /** + * Extension support. + * Obtain the integer value of an enumeration (usually an extension) with the name ename. + */ + ALenum (*alGetEnumValue)( const ALubyte* ename ); + +/** + * LISTENER + * Listener is the sample position for a given context. + * The multi-channel (usually stereo) output stream generated + * by the mixer is parametrized by this Listener object: + * its position and velocity relative to Sources, within + * occluder and reflector geometry. + */ + /** + * + * Listener Gain: default 1.0f. + */ + void (*alListenerf)( ALenum pname, ALfloat param ); + + /** + * + * Listener Position: ALfloat[3] + * Listener Velocity: ALfloat[3] + * Listener Orientation: ALfloat[6] (forward and up vector). + */ + void (*alListenerfv)( ALenum pname, ALfloat* param ); + + /* + * Retrieve listener information. + */ + void (*alGetListeneri)( ALenum pname, ALint* value ); + void (*alGetListenerf)( ALenum pname, ALfloat* value ); + + void (*alGetListeneriv)( ALenum pname, ALint* values ); + void (*alGetListenerfv)( ALenum pname, ALfloat* values ); + +/** + * SOURCE + * Source objects are by default localized. Sources + * take the PCM data provided in the specified Buffer, + * apply Source-specific modifications, and then + * submit them to be mixed according to spatial + * arrangement etc. + */ + + /** Create Source objects. */ + void (*alGenSources)( ALsizei n, ALuint* sources ); + + /** Delete Source objects. */ + void (*alDeleteSources)( ALsizei n, ALuint* sources ); + + /** Verify a handle is a valid Source. */ + ALboolean (*alIsSource)( ALuint sid ); + + /** Set an integer parameter for a Source object. */ + void (*alSourcei)( ALuint sid, ALenum param, ALint value); + + /** Set a float parameter for a Source object. */ + void (*alSourcef)( ALuint sid, ALenum param, ALfloat value); + + /** Set a 3 float parameter for a Source object. */ + void (*alSource3f)( ALuint sid, ALenum param, + ALfloat f1, ALfloat f2, ALfloat f3 ); + + /** Set a float vector parameter for a Source object. */ + void (*alSourcefv)( ALuint sid, ALenum param, + ALfloat* values ); + + /** Get an integer scalar parameter for a Source object. */ + void (*alGetSourcei)( ALuint sid, + ALenum pname, ALint* value ); + + /** Get an integer parameter for a Source object. */ + void (*alGetSourceiv)( ALuint sid, + ALenum pname, ALint* values ); + + /** Get a float scalar parameter for a Source object. */ + void (*alGetSourcef)( ALuint sid, + ALenum pname, ALfloat* value ); + + /** Get three float scalar parameter for a Source object. */ + void (*alGetSource3f)( ALuint sid, ALenum pname, + ALfloat* value1, + ALfloat* value2, + ALfloat* value3); + + /** Get a float vector parameter for a Source object. */ + void (*alGetSourcefv)( ALuint sid, + ALenum pname, ALfloat* values ); + + + /** Activate a source, start replay. */ + void (*alSourcePlay)( ALuint sid ); + + /** + * Pause a source, + * temporarily remove it from the mixer list. + */ + void (*alSourcePause)( ALuint sid ); + + /** + * Stop a source, + * temporarily remove it from the mixer list, + * and reset its internal state to pre-Play. + * To remove a Source completely, it has to be + * deleted following Stop, or before Play. + */ + void (*alSourceStop)( ALuint sid ); + + /** + * Rewind a souce. Stopped paused and playing sources, + * resets the offset into the PCM data and sets state to + * AL_INITIAL. + */ + void (*alSourceRewind)( ALuint sid ); + + /** + * vector forms of those functions we all love + */ + void (*alSourcePlayv)( ALsizei ns, ALuint *ids ); + void (*alSourceStopv)( ALsizei ns, ALuint *ids ); + void (*alSourceRewindv)( ALsizei ns, ALuint *ids ); + void (*alSourcePausev)( ALsizei ns, ALuint *ids ); + +/** + * BUFFER + * Buffer objects are storage space for sample data. + * Buffers are referred to by Sources. There can be more than + * one Source using the same Buffer data. If Buffers have + * to be duplicated on a per-Source basis, the driver has to + * take care of allocation, copying, and deallocation as well + * as propagating buffer data changes. + */ + + /** Buffer object generation. */ + void (*alGenBuffers)( ALsizei n, ALuint* buffers ); + void (*alDeleteBuffers)( ALsizei n, ALuint* buffers ); + ALboolean (*alIsBuffer)( ALuint buffer ); + + /** + * Specify the data to be filled into a buffer. + */ + void (*alBufferData)( ALuint buffer, + ALenum format, + ALvoid* data, + ALsizei size, + ALsizei freq ); + + void (*alGetBufferi)( ALuint buffer, + ALenum param, ALint* value ); + void (*alGetBufferf)( ALuint buffer, + ALenum param, ALfloat* value ); + void (*alGetBufferiv)( ALuint buffer, + ALenum param, ALint* value ); + void (*alGetBufferfv)( ALuint buffer, + ALenum param, ALfloat* value ); + +/** + * EXTENSION: IASIG Level 2 Environment. + * Environment object generation. + * This is an EXTension that describes the Environment/Reverb + * properties according to IASIG Level 2 specifications. + */ + /** + * Allocate n environment ids and store them in the array environs. + * Returns the number of environments actually allocated. + */ + ALsizei (*alGenEnvironmentIASIG)( ALsizei n, ALuint* environs ); + void (*alDeleteEnvironmentIASIG)(ALsizei n, + ALuint* environs); + ALboolean (*alIsEnvironmentIASIG)( ALuint environ ); + void (*alEnvironmentiIASIG)( ALuint eid, + ALenum param, ALint value ); + void (*alEnvironmentfIASIG)( ALuint eid, + ALenum param, ALuint value ); + /** + * Queue stuff + */ + void (*alQueuei)(ALuint sid, ALenum param, ALint value ); + void (*alSourceUnqueueBuffers)(ALuint sid, ALsizei numEntries, ALuint *bids ); + void (*alSourceQueueBuffers)(ALuint sid, ALsizei numEntries, ALuint *bids ); + + void (*alDopplerFactor)( ALfloat value ); + void (*alDopplerVelocity)( ALfloat value ); + void (*alDistanceModel)( ALenum distanceModel ); + +/** + * Frequency Domain Filters are band filters. + * Attenuation in Media (distance based) + * Reflection Material + * Occlusion Material (separating surface) + * + * Temporal Domain Filters: + * Early Reflections + * Late Reverb + * + */ + +#endif /* AL_NO_PROTOTYPES */ + +#ifdef TARGET_OS_MAC +#if TARGET_OS_MAC +#pragma export off +#endif /* TARGET_OS_MAC */ +#endif /* TARGET_OS_MAC */ + + +#ifdef __cplusplus +} /* extern "C" */ +#endif + +#endif /* __al_h_ */ diff --git a/code/AL/alc.h b/code/AL/alc.h new file mode 100644 index 0000000..371ee1c --- /dev/null +++ b/code/AL/alc.h @@ -0,0 +1,110 @@ +#ifndef ALC_CONTEXT_H_ +#define ALC_CONTEXT_H_ + +#include "altypes.h" +#include "alctypes.h" + +#ifdef __cplusplus +extern "C" { +#endif + +#define ALC_VERSION_0_1 1 + +#ifdef _WIN32 + #ifdef _OPENAL32LIB + #define ALCAPI __declspec(dllexport) + #else + #define ALCAPI __declspec(dllimport) + #endif + + typedef struct ALCdevice_struct ALCdevice; + typedef struct ALCcontext_struct ALCcontext; + + #define ALCAPIENTRY __cdecl +#else + #ifdef TARGET_OS_MAC + #if TARGET_OS_MAC + #pragma export on + #endif + #endif + + #define ALCAPI + #define ALCAPIENTRY +#endif + +#ifndef AL_NO_PROTOTYPES + +ALCAPI ALCcontext * ALCAPIENTRY alcCreateContext( ALCdevice *dev, + ALint* attrlist ); + +/** + * There is no current context, as we can mix + * several active contexts. But al* calls + * only affect the current context. + */ +ALCAPI ALCenum ALCAPIENTRY alcMakeContextCurrent( ALCcontext *alcHandle ); + +/** + * Perform processing on a synced context, non-op on a asynchronous + * context. + */ +ALCAPI ALCcontext * ALCAPIENTRY alcProcessContext( ALCcontext *alcHandle ); + +/** + * Suspend processing on an asynchronous context, non-op on a + * synced context. + */ +ALCAPI void ALCAPIENTRY alcSuspendContext( ALCcontext *alcHandle ); + +ALCAPI ALCenum ALCAPIENTRY alcDestroyContext( ALCcontext *alcHandle ); + +ALCAPI ALCenum ALCAPIENTRY alcGetError( ALCdevice *dev ); + +ALCAPI ALCcontext * ALCAPIENTRY alcGetCurrentContext( ALvoid ); + +ALCAPI ALCdevice *alcOpenDevice( const ALubyte *tokstr ); +ALCAPI void alcCloseDevice( ALCdevice *dev ); + +ALCAPI ALboolean ALCAPIENTRY alcIsExtensionPresent(ALCdevice *device, ALubyte *extName); +ALCAPI ALvoid * ALCAPIENTRY alcGetProcAddress(ALCdevice *device, ALubyte *funcName); +ALCAPI ALenum ALCAPIENTRY alcGetEnumValue(ALCdevice *device, ALubyte *enumName); + +ALCAPI ALCdevice* ALCAPIENTRY alcGetContextsDevice(ALCcontext *context); + + +/** + * Query functions + */ +const ALubyte * alcGetString( ALCdevice *deviceHandle, ALenum token ); +void alcGetIntegerv( ALCdevice *deviceHandle, ALenum token , ALsizei size , ALint *dest ); + +#else + ALCcontext * (*alcCreateContext)( ALCdevice *dev, ALint* attrlist ); + ALCenum (*alcMakeContextCurrent)( ALCcontext *alcHandle ); + ALCcontext * (*alcProcessContext)( ALCcontext *alcHandle ); + void (*alcSuspendContext)( ALCcontext *alcHandle ); + ALCenum (*alcDestroyContext)( ALCcontext *alcHandle ); + ALCenum (*alcGetError)( ALCdevice *dev ); + ALCcontext * (*alcGetCurrentContext)( ALvoid ); + ALCdevice * (*alcOpenDevice)( const ALubyte *tokstr ); + void (*alcCloseDevice)( ALCdevice *dev ); + ALboolean (*alcIsExtensionPresent)( ALCdevice *device, ALubyte *extName ); + ALvoid * (*alcGetProcAddress)(ALCdevice *device, ALubyte *funcName ); + ALenum (*alcGetEnumValue)(ALCdevice *device, ALubyte *enumName); + ALCdevice* (*alcGetContextsDevice)(ALCcontext *context); + const ALubyte* (*alcGetString)( ALCdevice *deviceHandle, ALenum token ); + void (*alcGetIntegerv)( ALCdevice *deviceHandle, ALenum token , ALsizei size , ALint *dest ); + +#endif /* AL_NO_PROTOTYPES */ + +#ifdef TARGET_OS_MAC +#if TARGET_OS_MAC +#pragma export off +#endif /* TARGET_OS_MAC */ +#endif /* TARGET_OS_MAC */ + +#ifdef __cplusplus +} +#endif + +#endif /* ALC_CONTEXT_H_ */ diff --git a/code/AL/alctypes.h b/code/AL/alctypes.h new file mode 100644 index 0000000..39d428c --- /dev/null +++ b/code/AL/alctypes.h @@ -0,0 +1,88 @@ +#ifndef _ALCTYPES_H_ +#define _ALCTYPES_H_ + +#if !defined(_WIN32) +struct _AL_device; +typedef struct _AL_device ALCdevice; + +typedef void ALCcontext; +#endif /* _WIN32 */ + +typedef int ALCenum; + +/* Enumerant values begin at column 50. No tabs. */ + +/* bad value */ +#define ALC_INVALID 0 + +/** + * followed by Hz + */ +#define ALC_FREQUENCY 0x100 + +/** + * followed by Hz + */ +#define ALC_REFRESH 0x101 + +/** + * followed by AL_TRUE, AL_FALSE + */ +#define ALC_SYNC 0x102 + +/** + * errors + */ + +/** + * No error + */ +#define ALC_NO_ERROR 0 + +/** + * No device + */ +#define ALC_INVALID_DEVICE 0x200 + +/** + * invalid context ID + */ +#define ALC_INVALID_CONTEXT 0x201 + +/** + * bad enum + */ +#define ALC_INVALID_ENUM 0x202 + +/** + * bad value + */ +#define ALC_INVALID_VALUE 0x203 + +/** + * Out of memory. + */ +#define ALC_OUT_OF_MEMORY 0x204 + + + +/** + * The Specifier string for default device + */ +#define ALC_DEFAULT_DEVICE_SPECIFIER 0x300 +#define ALC_DEVICE_SPECIFIER 0x301 +#define ALC_EXTENSIONS 0x302 + +#define ALC_MAJOR_VERSION 0x303 +#define ALC_MINOR_VERSION 0x304 + +#define ALC_ATTRIBUTES_SIZE 0x305 +#define ALC_ALL_ATTRIBUTES 0x306 + +/** + * Not sure if the following are conformant + */ +#define ALC_FALSE 0 +#define ALC_TRUE (!(ALC_FALSE)) + +#endif /* _ALCTYPES_H */ diff --git a/code/AL/altypes.h b/code/AL/altypes.h new file mode 100644 index 0000000..c42e13b --- /dev/null +++ b/code/AL/altypes.h @@ -0,0 +1,441 @@ +#ifndef _AL_TYPES_H_ +#define _AL_TYPES_H_ + +/** OpenAL bool type. */ +typedef char ALboolean; + +/** OpenAL 8bit signed byte. */ +typedef signed char ALbyte; + +/** OpenAL 8bit unsigned byte. */ +typedef unsigned char ALubyte; + +/** OpenAL 16bit signed short integer type. */ +typedef short ALshort; + +/** OpenAL 16bit unsigned short integer type. */ +typedef unsigned short ALushort; + +/** OpenAL 32bit unsigned integer type. */ +typedef unsigned int ALuint; + +/** OpenAL 32bit signed integer type. */ +typedef int ALint; + +/** OpenAL 32bit floating point type. */ +typedef float ALfloat; + +/** OpenAL 64bit double point type. */ +typedef double ALdouble; + +/** OpenAL 32bit type. */ +typedef signed int ALsizei; + +/** OpenAL void type (for params, not returns). */ +#ifdef __GNUC__ +typedef void ALvoid; +#else +#define ALvoid void +#endif /* __GNUC__ */ + +/** OpenAL enumerations. */ +typedef int ALenum; + +/** OpenAL bitfields. */ +typedef unsigned int ALbitfield; + +/** OpenAL clamped float. */ +typedef ALfloat ALclampf; + +/** Openal clamped double. */ +typedef ALdouble ALclampd; + +/* Enumerant values begin at column 50. No tabs. */ + +/* bad value */ +#define AL_INVALID -1 + +#define AL_NONE 0 + +/* Boolean False. */ +#define AL_FALSE 0 + +/** Boolean True. */ +#define AL_TRUE 1 + +/** + * Indicate the type of AL_SOURCE. + * Sources can be spatialized + */ +#define AL_SOURCE_TYPE 0x0200 + +/** Indicate Source has relative coordinates. */ +#define AL_SOURCE_RELATIVE 0x0202 + +/** + * Directional source, inner cone angle, in degrees. + * Range: [0-360] + * Default: 360 + */ +#define AL_CONE_INNER_ANGLE 0x1001 + +/** + * Directional source, outer cone angle, in degrees. + * Range: [0-360] + * Default: 360 + */ +#define AL_CONE_OUTER_ANGLE 0x1002 + +/** + * Specify the pitch to be applied, either at source, + * or on mixer results, at listener. + * Range: [0.5-2.0] + * Default: 1.0 + */ +#define AL_PITCH 0x1003 + +/** + * Specify the current location in three dimensional space. + * OpenAL, like OpenGL, uses a right handed coordinate system, + * where in a frontal default view X (thumb) points right, + * Y points up (index finger), and Z points towards the + * viewer/camera (middle finger). + * To switch from a left handed coordinate system, flip the + * sign on the Z coordinate. + * Listener position is always in the world coordinate system. + */ +#define AL_POSITION 0x1004 + +/** Specify the current direction. */ +#define AL_DIRECTION 0x1005 + +/** Specify the current velocity in three dimensional space. */ +#define AL_VELOCITY 0x1006 + +/** + * Indicate whether source is looping. + * Type: ALboolean? + * Range: [AL_TRUE, AL_FALSE] + * Default: FALSE. + */ +#define AL_LOOPING 0x1007 + +/** + * Indicate whether source is meant to be streaming. + * Type: ALboolean? + * Range: [AL_TRUE, AL_FALSE] + * Default: FALSE. + */ +#define AL_STREAMING 0x1008 + +/** + * Indicate the buffer to provide sound samples. + * Type: ALuint. + * Range: any valid Buffer id. + */ +#define AL_BUFFER 0x1009 + +/** + * Indicate the gain (volume amplification) applied. + * Type: ALfloat. + * Range: ]0.0- ] + * A value of 1.0 means un-attenuated/unchanged. + * Each division by 2 equals an attenuation of -6dB. + * Each multiplicaton with 2 equals an amplification of +6dB. + * A value of 0.0 is meaningless with respect to a logarithmic + * scale; it is interpreted as zero volume - the channel + * is effectively disabled. + */ +#define AL_GAIN 0x100A + +/* byte offset into source (in canon format). -1 if source + * is not playing. Don't set this, get this. + * + * Type: ALint + * Range: -1 - +inf + */ +#define AL_BYTE_LOKI 0x100C + +/* + * Indicate minimum source attenuation + * Type: ALfloat + * Range: [0.0 - 1.0] + * + * Logarthmic + */ +#define AL_MIN_GAIN 0x100D + +/** + * Indicate maximum source attenuation + * Type: ALfloat + * Range: [0.0 - 1.0] + * + * Logarthmic + */ +#define AL_MAX_GAIN 0x100E + +/** + * Indicate listener orientation. + * + * at/up + */ +#define AL_ORIENTATION 0x100F + +/** + * Source state information. + */ +#define AL_SOURCE_STATE 0x1010 +#define AL_INITIAL 0x1011 +#define AL_PLAYING 0x1012 +#define AL_PAUSED 0x1013 +#define AL_STOPPED 0x1014 + +/** + * Buffer Queue params + */ +#define AL_BUFFERS_QUEUED 0x1015 +#define AL_BUFFERS_PROCESSED 0x1016 + +/** + * Buffer states + */ +#define AL_PENDING 0x1017 +#define AL_PROCESSED 0x1018 + + +/** Sound samples: format specifier. */ +#define AL_FORMAT_MONO8 0x1100 +#define AL_FORMAT_MONO16 0x1101 +#define AL_FORMAT_STEREO8 0x1102 +#define AL_FORMAT_STEREO16 0x1103 + +/** + * source specific reference distance + * Type: ALfloat + * Range: 0.0 - +inf + * + * At 0.0, no distance attenuation occurs. Default is + * 1.0. + */ +#define AL_REFERENCE_DISTANCE 0x1020 + +/** + * source specific rolloff factor + * Type: ALfloat + * Range: 0.0 - +inf + * + */ +#define AL_ROLLOFF_FACTOR 0x1021 + +/** + * Directional source, outer cone gain. + * + * Default: 0.0 + * Range: [0.0 - 1.0] + * Logarithmic + */ +#define AL_CONE_OUTER_GAIN 0x1022 + +/** + * Indicate distance above which sources are not + * attenuated using the inverse clamped distance model. + * + * Default: +inf + * Type: ALfloat + * Range: 0.0 - +inf + */ +#define AL_MAX_DISTANCE 0x1023 + +/** + * Sound samples: frequency, in units of Hertz [Hz]. + * This is the number of samples per second. Half of the + * sample frequency marks the maximum significant + * frequency component. + */ +#define AL_FREQUENCY 0x2001 +#define AL_BITS 0x2002 +#define AL_CHANNELS 0x2003 +#define AL_SIZE 0x2004 + +/** + * Buffer state. + * + * Not supported for public use (yet). + */ +#define AL_UNUSED 0x2010 +#define AL_QUEUED 0x2011 +#define AL_CURRENT 0x2012 + +/** Errors: No Error. */ +#define AL_NO_ERROR AL_FALSE + +/** + * Invalid Name paramater passed to AL call. + */ +#define AL_INVALID_NAME 0xA001 + +/** + * Invalid parameter passed to AL call. + */ +#define AL_ILLEGAL_ENUM 0xA002 + +/** + * Invalid enum parameter value. + */ +#define AL_INVALID_VALUE 0xA003 + +/** + * Illegal call. + */ +#define AL_ILLEGAL_COMMAND 0xA004 + +/** + * No mojo. + */ +#define AL_OUT_OF_MEMORY 0xA005 + + +/** Context strings: Vendor Name. */ +#define AL_VENDOR 0xB001 +#define AL_VERSION 0xB002 +#define AL_RENDERER 0xB003 +#define AL_EXTENSIONS 0xB004 + +/** Global tweakage. */ + +/** + * Doppler scale. Default 1.0 + */ +#define AL_DOPPLER_FACTOR 0xC000 + +/** + * Tweaks speed of propagation. + */ +#define AL_DOPPLER_VELOCITY 0xC001 + +/** + * Distance scaling + */ +#define AL_DISTANCE_SCALE 0xC002 + +/** + * Distance models + * + * used in conjunction with DistanceModel + * + * implicit: NONE, which disances distance attenuation. + */ +#define AL_DISTANCE_MODEL 0xD000 +#define AL_INVERSE_DISTANCE 0xD001 +#define AL_INVERSE_DISTANCE_CLAMPED 0xD002 + + +/** + * enables + */ + +/* #define AL_SOME_ENABLE 0xE000 */ + +/** IASIG Level 2 Environment. */ + +/** + * Parameter: IASIG ROOM blah + * Type: intgeger + * Range: [-10000, 0] + * Default: -10000 + */ +#define AL_ENV_ROOM_IASIG 0x3001 + +/** + * Parameter: IASIG ROOM_HIGH_FREQUENCY + * Type: integer + * Range: [-10000, 0] + * Default: 0 + */ +#define AL_ENV_ROOM_HIGH_FREQUENCY_IASIG 0x3002 + +/** + * Parameter: IASIG ROOM_ROLLOFF_FACTOR + * Type: float + * Range: [0.0, 10.0] + * Default: 0.0 + */ +#define AL_ENV_ROOM_ROLLOFF_FACTOR_IASIG 0x3003 + +/** + * Parameter: IASIG DECAY_TIME + * Type: float + * Range: [0.1, 20.0] + * Default: 1.0 + */ +#define AL_ENV_DECAY_TIME_IASIG 0x3004 + +/** + * Parameter: IASIG DECAY_HIGH_FREQUENCY_RATIO + * Type: float + * Range: [0.1, 2.0] + * Default: 0.5 + */ +#define AL_ENV_DECAY_HIGH_FREQUENCY_RATIO_IASIG 0x3005 + +/** + * Parameter: IASIG REFLECTIONS + * Type: integer + * Range: [-10000, 1000] + * Default: -10000 + */ +#define AL_ENV_REFLECTIONS_IASIG 0x3006 + +/** + * Parameter: IASIG REFLECTIONS_DELAY + * Type: float + * Range: [0.0, 0.3] + * Default: 0.02 + */ +#define AL_ENV_REFLECTIONS_DELAY_IASIG 0x3006 + +/** + * Parameter: IASIG REVERB + * Type: integer + * Range: [-10000,2000] + * Default: -10000 + */ +#define AL_ENV_REVERB_IASIG 0x3007 + +/** + * Parameter: IASIG REVERB_DELAY + * Type: float + * Range: [0.0, 0.1] + * Default: 0.04 + */ +#define AL_ENV_REVERB_DELAY_IASIG 0x3008 + +/** + * Parameter: IASIG DIFFUSION + * Type: float + * Range: [0.0, 100.0] + * Default: 100.0 + */ +#define AL_ENV_DIFFUSION_IASIG 0x3009 + +/** + * Parameter: IASIG DENSITY + * Type: float + * Range: [0.0, 100.0] + * Default: 100.0 + */ +#define AL_ENV_DENSITY_IASIG 0x300A + + /** + * Parameter: IASIG HIGH_FREQUENCY_REFERENCE + * Type: float + * Range: [20.0, 20000.0] + * Default: 5000.0 + */ +#define AL_ENV_HIGH_FREQUENCY_REFERENCE_IASIG 0x300B + + +#define AL_INVALID_ENUM 0xA002 +#define AL_INVALID_OPERATION 0xA004 + +#endif diff --git a/code/AL/alu.h b/code/AL/alu.h new file mode 100644 index 0000000..c60eb03 --- /dev/null +++ b/code/AL/alu.h @@ -0,0 +1,55 @@ +#ifndef __alu_h_ +#define __alu_h_ + +#ifdef _WIN32 +#define ALAPI __declspec(dllexport) +#define ALAPIENTRY __cdecl +#else /* _WIN32 */ + +#ifdef TARGET_OS_MAC +#if TARGET_OS_MAC +#pragma export on +#endif /* TARGET_OS_MAC */ +#endif /* TARGET_OS_MAC */ + +#define ALAPI +#define ALAPIENTRY +#define AL_CALLBACK +#endif /* _WIN32 */ + +#if defined(__MACH__) && defined(__APPLE__) +#include +#include +#else +#include +#include +#endif + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef AL_NO_PROTOTYPES + + + +#else + + + + + +#endif /* AL_NO_PROTOTYPES */ + +#ifdef TARGET_OS_MAC +#if TARGET_OS_MAC +#pragma export off +#endif /* TARGET_OS_MAC */ +#endif /* TARGET_OS_MAC */ + +#ifdef __cplusplus +} +#endif + +#endif /* __alu_h_ */ + diff --git a/code/AL/alut.h b/code/AL/alut.h new file mode 100644 index 0000000..a6fbc17 --- /dev/null +++ b/code/AL/alut.h @@ -0,0 +1,94 @@ +#ifndef _ALUT_H_ +#define _ALUT_H_ + +#include "altypes.h" +#include "aluttypes.h" + +#ifdef _WIN32 +#define ALAPI __declspec(dllexport) +#define ALAPIENTRY __cdecl +#define AL_CALLBACK +#else /* _WIN32 */ + +#ifdef TARGET_OS_MAC +#if TARGET_OS_MAC +#pragma export on +#endif /* TARGET_OS_MAC */ +#endif /* TARGET_OS_MAC */ + +#ifndef ALAPI +#define ALAPI +#endif + +#ifndef ALAPIENTRY +#define ALAPIENTRY +#endif + +#ifndef AL_CALLBACK +#define AL_CALLBACK +#endif + +#endif /* _WIN32 */ + +#ifdef __cplusplus +extern "C" { +#endif + +#ifndef AL_NO_PROTOTYPES + +ALAPI void ALAPIENTRY alutInit(ALint *argc, ALbyte **argv); +ALAPI void ALAPIENTRY alutExit(ALvoid); + +ALAPI ALboolean ALAPIENTRY alutLoadWAV( const char *fname, + ALvoid **wave, + ALsizei *format, + ALsizei *size, + ALsizei *bits, + ALsizei *freq ); + +ALAPI void ALAPIENTRY alutLoadWAVFile(ALbyte *file, + ALenum *format, + ALvoid **data, + ALsizei *size, + ALsizei *freq, + ALboolean *loop); +ALAPI void ALAPIENTRY alutLoadWAVMemory(ALbyte *memory, + ALenum *format, + ALvoid **data, + ALsizei *size, + ALsizei *freq, + ALboolean *loop); +ALAPI void ALAPIENTRY alutUnloadWAV(ALenum format, + ALvoid *data, + ALsizei size, + ALsizei freq); + +#else + void (*alutInit)(int *argc, char *argv[]); + void (*alutExit)(ALvoid); + + ALboolean (*alutLoadWAV)( const char *fname, + ALvoid **wave, + ALsizei *format, + ALsizei *size, + ALsizei *bits, + ALsizei *freq ); + + void (*alutLoadWAVFile(ALbyte *file,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop); + void (*alutLoadWAVMemory)(ALbyte *memory,ALenum *format,ALvoid **data,ALsizei *size,ALsizei *freq,ALboolean *loop); + void (*alutUnloadWAV)(ALenum format,ALvoid *data,ALsizei size,ALsizei freq); + + +#endif /* AL_NO_PROTOTYPES */ + +#ifdef TARGET_OS_MAC +#if TARGET_OS_MAC +#pragma export off +#endif /* TARGET_OS_MAC */ +#endif /* TARGET_OS_MAC */ + +#ifdef __cplusplus +} +#endif + +#endif diff --git a/code/AL/aluttypes.h b/code/AL/aluttypes.h new file mode 100644 index 0000000..4b118d9 --- /dev/null +++ b/code/AL/aluttypes.h @@ -0,0 +1,6 @@ +#ifndef _ALUTTYPES_H_ +#define _ALUTTYPES_H_ + +#define AL_PROVIDES_ALUT 1 + +#endif /* _ALUTTYPES_H_ */ diff --git a/code/AL/alutypes.h b/code/AL/alutypes.h new file mode 100644 index 0000000..82356c6 --- /dev/null +++ b/code/AL/alutypes.h @@ -0,0 +1,5 @@ +#ifndef _ALUTYPES_H_ +#define _ALUTYPES_H_ + + +#endif /* _ALUTYPES_H_ */ -- cgit v1.2.3