alc.h 11 KB

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