diff options
Diffstat (limited to 'src/AL/alc.h')
-rw-r--r-- | src/AL/alc.h | 327 |
1 files changed, 199 insertions, 128 deletions
diff --git a/src/AL/alc.h b/src/AL/alc.h index f3a41bce..294e8b33 100644 --- a/src/AL/alc.h +++ b/src/AL/alc.h @@ -1,166 +1,237 @@ -#ifndef ALC_CONTEXT_H_ -#define ALC_CONTEXT_H_ +#ifndef AL_ALC_H +#define AL_ALC_H -#include "altypes.h" -#include "alctypes.h" - -#ifdef __cplusplus +#if defined(__cplusplus) extern "C" { #endif -#define ALC_VERSION_0_1 1 - -#ifdef _WIN32 - typedef struct ALCdevice_struct ALCdevice; - typedef struct ALCcontext_struct ALCcontext; - #ifndef _XBOX - #ifdef _OPENAL32LIB - #define ALCAPI __declspec(dllexport) - #else - #define ALCAPI __declspec(dllimport) - #endif - #define ALCAPIENTRY __cdecl +#ifndef ALC_API + #if defined(AL_LIBTYPE_STATIC) + #define ALC_API + #elif defined(_WIN32) + #define ALC_API __declspec(dllimport) + #else + #define ALC_API extern #endif #endif -#ifdef TARGET_OS_MAC - #if TARGET_OS_MAC - #pragma export on - #endif +#if defined(_WIN32) + #define ALC_APIENTRY __cdecl +#else + #define ALC_APIENTRY #endif -#ifndef ALCAPI - #define ALCAPI -#endif -#ifndef ALCAPIENTRY - #define ALCAPIENTRY -#endif +/** Deprecated macro. */ +#define ALCAPI ALC_API +#define ALCAPIENTRY ALC_APIENTRY +#define ALC_INVALID 0 +/** Supported ALC version? */ +#define ALC_VERSION_0_1 1 -#ifndef ALC_NO_PROTOTYPES +/** Opaque device handle */ +typedef struct ALCdevice_struct ALCdevice; +/** Opaque context handle */ +typedef struct ALCcontext_struct ALCcontext; -/* - * Context Management - */ -ALCAPI ALCcontext * ALCAPIENTRY alcCreateContext( ALCdevice *device, const ALCint* attrlist ); +/** 8-bit boolean */ +typedef char ALCboolean; -ALCAPI ALCboolean ALCAPIENTRY alcMakeContextCurrent( ALCcontext *context ); +/** character */ +typedef char ALCchar; -ALCAPI void ALCAPIENTRY alcProcessContext( ALCcontext *context ); +/** signed 8-bit 2's complement integer */ +typedef signed char ALCbyte; -ALCAPI void ALCAPIENTRY alcSuspendContext( ALCcontext *context ); +/** unsigned 8-bit integer */ +typedef unsigned char ALCubyte; -ALCAPI void ALCAPIENTRY alcDestroyContext( ALCcontext *context ); +/** signed 16-bit 2's complement integer */ +typedef short ALCshort; -ALCAPI ALCcontext * ALCAPIENTRY alcGetCurrentContext( ALCvoid ); +/** unsigned 16-bit integer */ +typedef unsigned short ALCushort; -ALCAPI ALCdevice* ALCAPIENTRY alcGetContextsDevice( ALCcontext *context ); +/** signed 32-bit 2's complement integer */ +typedef int ALCint; +/** unsigned 32-bit integer */ +typedef unsigned int ALCuint; -/* - * Device Management - */ -ALCAPI ALCdevice * ALCAPIENTRY alcOpenDevice( const ALchar *devicename ); +/** non-negative 32-bit binary integer size */ +typedef int ALCsizei; -ALCAPI ALCboolean ALCAPIENTRY alcCloseDevice( ALCdevice *device ); +/** enumerated 32-bit value */ +typedef int ALCenum; +/** 32-bit IEEE754 floating-point */ +typedef float ALCfloat; -/* - * Error support. - * Obtain the most recent Context error - */ -ALCAPI ALCenum ALCAPIENTRY alcGetError( ALCdevice *device ); +/** 64-bit IEEE754 floating-point */ +typedef double ALCdouble; +/** void type (for opaque pointers only) */ +typedef void ALCvoid; -/* - * Extension support. - * Query for the presence of an extension, and obtain any appropriate - * function pointers and enum values. - */ -ALCAPI ALCboolean ALCAPIENTRY alcIsExtensionPresent( ALCdevice *device, const ALCchar *extname ); -ALCAPI void * ALCAPIENTRY alcGetProcAddress( ALCdevice *device, const ALCchar *funcname ); +/* Enumerant values begin at column 50. No tabs. */ + +/** Boolean False. */ +#define ALC_FALSE 0 + +/** Boolean True. */ +#define ALC_TRUE 1 + +/** Context attribute: <int> Hz. */ +#define ALC_FREQUENCY 0x1007 + +/** Context attribute: <int> Hz. */ +#define ALC_REFRESH 0x1008 + +/** Context attribute: AL_TRUE or AL_FALSE. */ +#define ALC_SYNC 0x1009 + +/** Context attribute: <int> requested Mono (3D) Sources. */ +#define ALC_MONO_SOURCES 0x1010 -ALCAPI ALCenum ALCAPIENTRY alcGetEnumValue( ALCdevice *device, const ALCchar *enumname ); +/** Context attribute: <int> requested Stereo Sources. */ +#define ALC_STEREO_SOURCES 0x1011 +/** No error. */ +#define ALC_NO_ERROR 0 -/* - * Query functions +/** Invalid device handle. */ +#define ALC_INVALID_DEVICE 0xA001 + +/** Invalid context handle. */ +#define ALC_INVALID_CONTEXT 0xA002 + +/** Invalid enum parameter passed to an ALC call. */ +#define ALC_INVALID_ENUM 0xA003 + +/** Invalid value parameter passed to an ALC call. */ +#define ALC_INVALID_VALUE 0xA004 + +/** Out of memory. */ +#define ALC_OUT_OF_MEMORY 0xA005 + + +/** Runtime ALC version. */ +#define ALC_MAJOR_VERSION 0x1000 +#define ALC_MINOR_VERSION 0x1001 + +/** Context attribute list properties. */ +#define ALC_ATTRIBUTES_SIZE 0x1002 +#define ALC_ALL_ATTRIBUTES 0x1003 + +/** String for the default device specifier. */ +#define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004 +/** + * String for the given device's specifier. + * + * If device handle is NULL, it is instead a null-char separated list of + * strings of known device specifiers (list ends with an empty string). + */ +#define ALC_DEVICE_SPECIFIER 0x1005 +/** String for space-separated list of ALC extensions. */ +#define ALC_EXTENSIONS 0x1006 + + +/** Capture extension */ +#define ALC_EXT_CAPTURE 1 +/** + * String for the given capture device's specifier. + * + * If device handle is NULL, it is instead a null-char separated list of + * strings of known capture device specifiers (list ends with an empty string). */ -ALCAPI const ALCchar * ALCAPIENTRY alcGetString( ALCdevice *device, ALCenum param ); +#define ALC_CAPTURE_DEVICE_SPECIFIER 0x310 +/** String for the default capture device specifier. */ +#define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311 +/** Number of sample frames available for capture. */ +#define ALC_CAPTURE_SAMPLES 0x312 + + +/** Enumerate All extension */ +#define ALC_ENUMERATE_ALL_EXT 1 +/** String for the default extended device specifier. */ +#define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012 +/** + * String for the given extended device's specifier. + * + * If device handle is NULL, it is instead a null-char separated list of + * strings of known extended device specifiers (list ends with an empty string). + */ +#define ALC_ALL_DEVICES_SPECIFIER 0x1013 + + +/** Context management. */ +ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCint* attrlist); +ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context); +ALC_API void ALC_APIENTRY alcProcessContext(ALCcontext *context); +ALC_API void ALC_APIENTRY alcSuspendContext(ALCcontext *context); +ALC_API void ALC_APIENTRY alcDestroyContext(ALCcontext *context); +ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void); +ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *context); -ALCAPI void ALCAPIENTRY alcGetIntegerv( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *data ); +/** Device management. */ +ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename); +ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device); -/* - * Capture functions +/** + * Error support. + * + * Obtain the most recent Device error. + */ +ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device); + +/** + * Extension support. + * + * Query for the presence of an extension, and obtain any appropriate + * function pointers and enum values. */ -ALCAPI ALCdevice* ALCAPIENTRY alcCaptureOpenDevice( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize ); - -ALCAPI ALCboolean ALCAPIENTRY alcCaptureCloseDevice( ALCdevice *device ); - -ALCAPI void ALCAPIENTRY alcCaptureStart( ALCdevice *device ); - -ALCAPI void ALCAPIENTRY alcCaptureStop( ALCdevice *device ); - -ALCAPI void ALCAPIENTRY alcCaptureSamples( ALCdevice *device, ALCvoid *buffer, ALCsizei samples ); - -#else /* ALC_NO_PROTOTYPES */ -/* -ALCAPI ALCcontext * (ALCAPIENTRY *alcCreateContext)( ALCdevice *device, const ALCint* attrlist ); -ALCAPI ALCboolean (ALCAPIENTRY *alcMakeContextCurrent)( ALCcontext *context ); -ALCAPI void (ALCAPIENTRY *alcProcessContext)( ALCcontext *context ); -ALCAPI void (ALCAPIENTRY *alcSuspendContext)( ALCcontext *context ); -ALCAPI void (ALCAPIENTRY *alcDestroyContext)( ALCcontext *context ); -ALCAPI ALCcontext * (ALCAPIENTRY *alcGetCurrentContext)( ALCvoid ); -ALCAPI ALCdevice * (ALCAPIENTRY *alcGetContextsDevice)( ALCcontext *context ); -ALCAPI ALCdevice * (ALCAPIENTRY *alcOpenDevice)( const ALCchar *devicename ); -ALCAPI ALCboolean (ALCAPIENTRY *alcCloseDevice)( ALCdevice *device ); -ALCAPI ALCenum (ALCAPIENTRY *alcGetError)( ALCdevice *device ); -ALCAPI ALCboolean (ALCAPIENTRY *alcIsExtensionPresent)( ALCdevice *device, const ALCchar *extname ); -ALCAPI void * (ALCAPIENTRY *alcGetProcAddress)( ALCdevice *device, const ALCchar *funcname ); -ALCAPI ALCenum (ALCAPIENTRY *alcGetEnumValue)( ALCdevice *device, const ALCchar *enumname ); -ALCAPI const ALCchar* (ALCAPIENTRY *alcGetString)( ALCdevice *device, ALCenum param ); -ALCAPI void (ALCAPIENTRY *alcGetIntegerv)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest ); -ALCAPI ALCdevice * (ALCAPIENTRY *alcCaptureOpenDevice)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize ); -ALCAPI ALCboolean (ALCAPIENTRY *alcCaptureCloseDevice)( ALCdevice *device ); -ALCAPI void (ALCAPIENTRY *alcCaptureStart)( ALCdevice *device ); -ALCAPI void (ALCAPIENTRY *alcCaptureStop)( ALCdevice *device ); -ALCAPI void (ALCAPIENTRY *alcCaptureSamples)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples ); -*/ -/* Type definitions */ -typedef ALCcontext * (ALCAPIENTRY *LPALCCREATECONTEXT) (ALCdevice *device, const ALCint *attrlist); -typedef ALCboolean (ALCAPIENTRY *LPALCMAKECONTEXTCURRENT)( ALCcontext *context ); -typedef void (ALCAPIENTRY *LPALCPROCESSCONTEXT)( ALCcontext *context ); -typedef void (ALCAPIENTRY *LPALCSUSPENDCONTEXT)( ALCcontext *context ); -typedef void (ALCAPIENTRY *LPALCDESTROYCONTEXT)( ALCcontext *context ); -typedef ALCcontext * (ALCAPIENTRY *LPALCGETCURRENTCONTEXT)( ALCvoid ); -typedef ALCdevice * (ALCAPIENTRY *LPALCGETCONTEXTSDEVICE)( ALCcontext *context ); -typedef ALCdevice * (ALCAPIENTRY *LPALCOPENDEVICE)( const ALCchar *devicename ); -typedef ALCboolean (ALCAPIENTRY *LPALCCLOSEDEVICE)( ALCdevice *device ); -typedef ALCenum (ALCAPIENTRY *LPALCGETERROR)( ALCdevice *device ); -typedef ALCboolean (ALCAPIENTRY *LPALCISEXTENSIONPRESENT)( ALCdevice *device, const ALCchar *extname ); -typedef void * (ALCAPIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname ); -typedef ALCenum (ALCAPIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname ); -typedef const ALCchar* (ALCAPIENTRY *LPALCGETSTRING)( ALCdevice *device, ALCenum param ); -typedef void (ALCAPIENTRY *LPALCGETINTEGERV)( ALCdevice *device, ALCenum param, ALCsizei size, ALCint *dest ); -typedef ALCdevice * (ALCAPIENTRY *LPALCCAPTUREOPENDEVICE)( const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize ); -typedef ALCboolean (ALCAPIENTRY *LPALCCAPTURECLOSEDEVICE)( ALCdevice *device ); -typedef void (ALCAPIENTRY *LPALCCAPTURESTART)( ALCdevice *device ); -typedef void (ALCAPIENTRY *LPALCCAPTURESTOP)( ALCdevice *device ); -typedef void (ALCAPIENTRY *LPALCCAPTURESAMPLES)( ALCdevice *device, ALCvoid *buffer, ALCsizei samples ); - -#endif /* ALC_NO_PROTOTYPES */ - -#ifdef TARGET_OS_MAC -#if TARGET_OS_MAC -#pragma export off -#endif /* TARGET_OS_MAC */ -#endif /* TARGET_OS_MAC */ - -#ifdef __cplusplus +ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname); +ALC_API void* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname); +ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumname); + +/** Query function. */ +ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *device, ALCenum param); +ALC_API void ALC_APIENTRY alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values); + +/** Capture function. */ +ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize); +ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device); +ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device); +ALC_API void ALC_APIENTRY alcCaptureStop(ALCdevice *device); +ALC_API void ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples); + +/** Pointer-to-function type, useful for dynamically getting ALC entry points. */ +typedef ALCcontext* (ALC_APIENTRY *LPALCCREATECONTEXT)(ALCdevice *device, const ALCint *attrlist); +typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)(ALCcontext *context); +typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)(ALCcontext *context); +typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)(ALCcontext *context); +typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)(ALCcontext *context); +typedef ALCcontext* (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)(void); +typedef ALCdevice* (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)(ALCcontext *context); +typedef ALCdevice* (ALC_APIENTRY *LPALCOPENDEVICE)(const ALCchar *devicename); +typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)(ALCdevice *device); +typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)(ALCdevice *device); +typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)(ALCdevice *device, const ALCchar *extname); +typedef void* (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname); +typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname); +typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)(ALCdevice *device, ALCenum param); +typedef void (ALC_APIENTRY *LPALCGETINTEGERV)(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values); +typedef ALCdevice* (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize); +typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)(ALCdevice *device); +typedef void (ALC_APIENTRY *LPALCCAPTURESTART)(ALCdevice *device); +typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device); +typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples); + +#if defined(__cplusplus) } #endif -#endif /* ALC_CONTEXT_H_ */ +#endif /* AL_ALC_H */ |