alc.h 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295
  1. #ifndef AL_ALC_H
  2. #define AL_ALC_H
  3. /* NOLINTBEGIN */
  4. #ifdef __cplusplus
  5. extern "C" {
  6. #ifndef AL_DISABLE_NOEXCEPT
  7. #define ALC_API_NOEXCEPT noexcept
  8. #if __cplusplus >= 201703L
  9. #define ALC_API_NOEXCEPT17 noexcept
  10. #else
  11. #define ALC_API_NOEXCEPT17
  12. #endif
  13. #else /* AL_DISABLE_NOEXCEPT */
  14. #define ALC_API_NOEXCEPT
  15. #define ALC_API_NOEXCEPT17
  16. #endif
  17. #else /* __cplusplus */
  18. #define ALC_API_NOEXCEPT
  19. #define ALC_API_NOEXCEPT17
  20. #endif
  21. #ifndef ALC_API
  22. #if defined(AL_LIBTYPE_STATIC)
  23. #define ALC_API
  24. #elif defined(_WIN32)
  25. #define ALC_API __declspec(dllimport)
  26. #else
  27. #define ALC_API extern
  28. #endif
  29. #endif
  30. #ifdef _WIN32
  31. #define ALC_APIENTRY __cdecl
  32. #else
  33. #define ALC_APIENTRY
  34. #endif
  35. /* Deprecated macros. */
  36. #define ALCAPI ALC_API
  37. #define ALCAPIENTRY ALC_APIENTRY
  38. #define ALC_INVALID 0
  39. /** Supported ALC version? */
  40. #define ALC_VERSION_0_1 1
  41. /** Opaque device handle */
  42. typedef struct ALCdevice ALCdevice;
  43. /** Opaque context handle */
  44. typedef struct ALCcontext ALCcontext;
  45. /** 8-bit boolean */
  46. typedef char ALCboolean;
  47. /** character */
  48. typedef char ALCchar;
  49. /** signed 8-bit integer */
  50. typedef signed char ALCbyte;
  51. /** unsigned 8-bit integer */
  52. typedef unsigned char ALCubyte;
  53. /** signed 16-bit integer */
  54. typedef short ALCshort;
  55. /** unsigned 16-bit integer */
  56. typedef unsigned short ALCushort;
  57. /** signed 32-bit integer */
  58. typedef int ALCint;
  59. /** unsigned 32-bit integer */
  60. typedef unsigned int ALCuint;
  61. /** non-negative 32-bit integer size */
  62. typedef int ALCsizei;
  63. /** 32-bit enumeration value */
  64. typedef int ALCenum;
  65. /** 32-bit IEEE-754 floating-point */
  66. typedef float ALCfloat;
  67. /** 64-bit IEEE-754 floating-point */
  68. typedef double ALCdouble;
  69. /** void type (for opaque pointers only) */
  70. typedef void ALCvoid;
  71. /* Enumeration values begin at column 50. Do not use tabs. */
  72. /** Boolean False. */
  73. #define ALC_FALSE 0
  74. /** Boolean True. */
  75. #define ALC_TRUE 1
  76. /** Context attribute: <int> Hz. */
  77. #define ALC_FREQUENCY 0x1007
  78. /** Context attribute: <int> Hz. */
  79. #define ALC_REFRESH 0x1008
  80. /** Context attribute: AL_TRUE or AL_FALSE synchronous context? */
  81. #define ALC_SYNC 0x1009
  82. /** Context attribute: <int> requested Mono (3D) Sources. */
  83. #define ALC_MONO_SOURCES 0x1010
  84. /** Context attribute: <int> requested Stereo Sources. */
  85. #define ALC_STEREO_SOURCES 0x1011
  86. /** No error. */
  87. #define ALC_NO_ERROR 0
  88. /** Invalid device handle. */
  89. #define ALC_INVALID_DEVICE 0xA001
  90. /** Invalid context handle. */
  91. #define ALC_INVALID_CONTEXT 0xA002
  92. /** Invalid enumeration passed to an ALC call. */
  93. #define ALC_INVALID_ENUM 0xA003
  94. /** Invalid value passed to an ALC call. */
  95. #define ALC_INVALID_VALUE 0xA004
  96. /** Out of memory. */
  97. #define ALC_OUT_OF_MEMORY 0xA005
  98. /** Runtime ALC major version. */
  99. #define ALC_MAJOR_VERSION 0x1000
  100. /** Runtime ALC minor version. */
  101. #define ALC_MINOR_VERSION 0x1001
  102. /** Context attribute list size. */
  103. #define ALC_ATTRIBUTES_SIZE 0x1002
  104. /** Context attribute list properties. */
  105. #define ALC_ALL_ATTRIBUTES 0x1003
  106. /** String for the default device specifier. */
  107. #define ALC_DEFAULT_DEVICE_SPECIFIER 0x1004
  108. /**
  109. * Device specifier string.
  110. *
  111. * If device handle is NULL, it is instead a null-character separated list of
  112. * strings of known device specifiers (list ends with an empty string).
  113. */
  114. #define ALC_DEVICE_SPECIFIER 0x1005
  115. /** String for space-separated list of ALC extensions. */
  116. #define ALC_EXTENSIONS 0x1006
  117. /** Capture extension */
  118. #define ALC_EXT_CAPTURE 1
  119. /**
  120. * Capture device specifier string.
  121. *
  122. * If device handle is NULL, it is instead a null-character separated list of
  123. * strings of known capture device specifiers (list ends with an empty string).
  124. */
  125. #define ALC_CAPTURE_DEVICE_SPECIFIER 0x310
  126. /** String for the default capture device specifier. */
  127. #define ALC_CAPTURE_DEFAULT_DEVICE_SPECIFIER 0x311
  128. /** Number of sample frames available for capture. */
  129. #define ALC_CAPTURE_SAMPLES 0x312
  130. /** Enumerate All extension */
  131. #define ALC_ENUMERATE_ALL_EXT 1
  132. /** String for the default extended device specifier. */
  133. #define ALC_DEFAULT_ALL_DEVICES_SPECIFIER 0x1012
  134. /**
  135. * Device's extended specifier string.
  136. *
  137. * If device handle is NULL, it is instead a null-character separated list of
  138. * strings of known extended device specifiers (list ends with an empty string).
  139. */
  140. #define ALC_ALL_DEVICES_SPECIFIER 0x1013
  141. #ifndef ALC_NO_PROTOTYPES
  142. /* Context management. */
  143. /** Create and attach a context to the given device. */
  144. ALC_API ALCcontext* ALC_APIENTRY alcCreateContext(ALCdevice *device, const ALCint *attrlist) ALC_API_NOEXCEPT;
  145. /**
  146. * Makes the given context the active process-wide context. Passing NULL clears
  147. * the active context.
  148. */
  149. ALC_API ALCboolean ALC_APIENTRY alcMakeContextCurrent(ALCcontext *context) ALC_API_NOEXCEPT;
  150. /** Resumes processing updates for the given context. */
  151. ALC_API void ALC_APIENTRY alcProcessContext(ALCcontext *context) ALC_API_NOEXCEPT;
  152. /** Suspends updates for the given context. */
  153. ALC_API void ALC_APIENTRY alcSuspendContext(ALCcontext *context) ALC_API_NOEXCEPT;
  154. /** Remove a context from its device and destroys it. */
  155. ALC_API void ALC_APIENTRY alcDestroyContext(ALCcontext *context) ALC_API_NOEXCEPT;
  156. /** Returns the currently active context. */
  157. ALC_API ALCcontext* ALC_APIENTRY alcGetCurrentContext(void) ALC_API_NOEXCEPT;
  158. /** Returns the device that a particular context is attached to. */
  159. ALC_API ALCdevice* ALC_APIENTRY alcGetContextsDevice(ALCcontext *context) ALC_API_NOEXCEPT;
  160. /* Device management. */
  161. /** Opens the named playback device. */
  162. ALC_API ALCdevice* ALC_APIENTRY alcOpenDevice(const ALCchar *devicename) ALC_API_NOEXCEPT;
  163. /** Closes the given playback device. */
  164. ALC_API ALCboolean ALC_APIENTRY alcCloseDevice(ALCdevice *device) ALC_API_NOEXCEPT;
  165. /* Error support. */
  166. /** Obtain the most recent Device error. */
  167. ALC_API ALCenum ALC_APIENTRY alcGetError(ALCdevice *device) ALC_API_NOEXCEPT;
  168. /* Extension support. */
  169. /**
  170. * Query for the presence of an extension on the device. Pass a NULL device to
  171. * query a device-inspecific extension.
  172. */
  173. ALC_API ALCboolean ALC_APIENTRY alcIsExtensionPresent(ALCdevice *device, const ALCchar *extname) ALC_API_NOEXCEPT;
  174. /**
  175. * Retrieve the address of a function. Given a non-NULL device, the returned
  176. * function may be device-specific.
  177. */
  178. ALC_API ALCvoid* ALC_APIENTRY alcGetProcAddress(ALCdevice *device, const ALCchar *funcname) ALC_API_NOEXCEPT;
  179. /**
  180. * Retrieve the value of an enum. Given a non-NULL device, the returned value
  181. * may be device-specific.
  182. */
  183. ALC_API ALCenum ALC_APIENTRY alcGetEnumValue(ALCdevice *device, const ALCchar *enumname) ALC_API_NOEXCEPT;
  184. /* Query functions. */
  185. /** Returns information about the device, and error strings. */
  186. ALC_API const ALCchar* ALC_APIENTRY alcGetString(ALCdevice *device, ALCenum param) ALC_API_NOEXCEPT;
  187. /** Returns information about the device and the version of OpenAL. */
  188. ALC_API void ALC_APIENTRY alcGetIntegerv(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values) ALC_API_NOEXCEPT;
  189. /* Capture functions. */
  190. /**
  191. * Opens the named capture device with the given frequency, format, and buffer
  192. * size.
  193. */
  194. ALC_API ALCdevice* ALC_APIENTRY alcCaptureOpenDevice(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize) ALC_API_NOEXCEPT;
  195. /** Closes the given capture device. */
  196. ALC_API ALCboolean ALC_APIENTRY alcCaptureCloseDevice(ALCdevice *device) ALC_API_NOEXCEPT;
  197. /** Starts capturing samples into the device buffer. */
  198. ALC_API void ALC_APIENTRY alcCaptureStart(ALCdevice *device) ALC_API_NOEXCEPT;
  199. /** Stops capturing samples. Samples in the device buffer remain available. */
  200. ALC_API void ALC_APIENTRY alcCaptureStop(ALCdevice *device) ALC_API_NOEXCEPT;
  201. /** Reads samples from the device buffer. */
  202. ALC_API void ALC_APIENTRY alcCaptureSamples(ALCdevice *device, ALCvoid *buffer, ALCsizei samples) ALC_API_NOEXCEPT;
  203. #endif /* ALC_NO_PROTOTYPES */
  204. /* Pointer-to-function types, useful for storing dynamically loaded ALC entry
  205. * points.
  206. */
  207. typedef ALCcontext* (ALC_APIENTRY *LPALCCREATECONTEXT)(ALCdevice *device, const ALCint *attrlist) ALC_API_NOEXCEPT17;
  208. typedef ALCboolean (ALC_APIENTRY *LPALCMAKECONTEXTCURRENT)(ALCcontext *context) ALC_API_NOEXCEPT17;
  209. typedef void (ALC_APIENTRY *LPALCPROCESSCONTEXT)(ALCcontext *context) ALC_API_NOEXCEPT17;
  210. typedef void (ALC_APIENTRY *LPALCSUSPENDCONTEXT)(ALCcontext *context) ALC_API_NOEXCEPT17;
  211. typedef void (ALC_APIENTRY *LPALCDESTROYCONTEXT)(ALCcontext *context) ALC_API_NOEXCEPT17;
  212. typedef ALCcontext* (ALC_APIENTRY *LPALCGETCURRENTCONTEXT)(void) ALC_API_NOEXCEPT17;
  213. typedef ALCdevice* (ALC_APIENTRY *LPALCGETCONTEXTSDEVICE)(ALCcontext *context) ALC_API_NOEXCEPT17;
  214. typedef ALCdevice* (ALC_APIENTRY *LPALCOPENDEVICE)(const ALCchar *devicename) ALC_API_NOEXCEPT17;
  215. typedef ALCboolean (ALC_APIENTRY *LPALCCLOSEDEVICE)(ALCdevice *device) ALC_API_NOEXCEPT17;
  216. typedef ALCenum (ALC_APIENTRY *LPALCGETERROR)(ALCdevice *device) ALC_API_NOEXCEPT17;
  217. typedef ALCboolean (ALC_APIENTRY *LPALCISEXTENSIONPRESENT)(ALCdevice *device, const ALCchar *extname) ALC_API_NOEXCEPT17;
  218. typedef ALCvoid* (ALC_APIENTRY *LPALCGETPROCADDRESS)(ALCdevice *device, const ALCchar *funcname) ALC_API_NOEXCEPT17;
  219. typedef ALCenum (ALC_APIENTRY *LPALCGETENUMVALUE)(ALCdevice *device, const ALCchar *enumname) ALC_API_NOEXCEPT17;
  220. typedef const ALCchar* (ALC_APIENTRY *LPALCGETSTRING)(ALCdevice *device, ALCenum param) ALC_API_NOEXCEPT17;
  221. typedef void (ALC_APIENTRY *LPALCGETINTEGERV)(ALCdevice *device, ALCenum param, ALCsizei size, ALCint *values) ALC_API_NOEXCEPT17;
  222. typedef ALCdevice* (ALC_APIENTRY *LPALCCAPTUREOPENDEVICE)(const ALCchar *devicename, ALCuint frequency, ALCenum format, ALCsizei buffersize) ALC_API_NOEXCEPT17;
  223. typedef ALCboolean (ALC_APIENTRY *LPALCCAPTURECLOSEDEVICE)(ALCdevice *device) ALC_API_NOEXCEPT17;
  224. typedef void (ALC_APIENTRY *LPALCCAPTURESTART)(ALCdevice *device) ALC_API_NOEXCEPT17;
  225. typedef void (ALC_APIENTRY *LPALCCAPTURESTOP)(ALCdevice *device) ALC_API_NOEXCEPT17;
  226. typedef void (ALC_APIENTRY *LPALCCAPTURESAMPLES)(ALCdevice *device, ALCvoid *buffer, ALCsizei samples) ALC_API_NOEXCEPT17;
  227. #ifdef __cplusplus
  228. } /* extern "C" */
  229. #endif
  230. /* NOLINTEND */
  231. #endif /* AL_ALC_H */