al.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492
  1. #ifndef _AL_H_
  2. #define _AL_H_
  3. /**
  4. * OpenAL cross platform audio library
  5. * Copyright (C) 1999-2000 by authors.
  6. * This library is free software; you can redistribute it and/or
  7. * modify it under the terms of the GNU Library General Public
  8. * License as published by the Free Software Foundation; either
  9. * version 2 of the License, or (at your option) any later version.
  10. *
  11. * This library is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
  14. * Library General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU Library General Public
  17. * License along with this library; if not, write to the
  18. * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
  19. * Boston, MA 02111-1307, USA.
  20. * Or go to http://www.gnu.org/copyleft/lgpl.html
  21. */
  22. #include "altypes.h"
  23. #ifdef __cplusplus
  24. extern "C" {
  25. #endif
  26. #ifdef _WIN32
  27. #ifdef _OPENAL32LIB
  28. #define ALAPI __declspec(dllexport)
  29. #else
  30. #define ALAPI __declspec(dllimport)
  31. #endif
  32. #define ALAPIENTRY __cdecl
  33. #define AL_CALLBACK
  34. #else
  35. #ifdef TARGET_OS_MAC
  36. #if TARGET_OS_MAC
  37. #pragma export on
  38. #endif
  39. #endif
  40. #define ALAPI
  41. #define ALAPIENTRY __cdecl
  42. #define AL_CALLBACK
  43. #endif
  44. #define OPENAL
  45. #ifndef AL_NO_PROTOTYPES
  46. /**
  47. * OpenAL Maintenance Functions
  48. * Initialization and exiting.
  49. * State Management and Query.
  50. * Error Handling.
  51. * Extension Support.
  52. */
  53. /** State management. */
  54. ALAPI ALvoid ALAPIENTRY alEnable( ALenum capability );
  55. ALAPI ALvoid ALAPIENTRY alDisable( ALenum capability );
  56. ALAPI ALboolean ALAPIENTRY alIsEnabled( ALenum capability );
  57. /** Application preferences for driver performance choices. */
  58. ALAPI ALvoid ALAPIENTRY alHint( ALenum target, ALenum mode );
  59. /** State retrieval. */
  60. ALAPI ALboolean ALAPIENTRY alGetBoolean( ALenum param );
  61. ALAPI ALint ALAPIENTRY alGetInteger( ALenum param );
  62. ALAPI ALfloat ALAPIENTRY alGetFloat( ALenum param );
  63. ALAPI ALdouble ALAPIENTRY alGetDouble( ALenum param );
  64. ALAPI ALvoid ALAPIENTRY alGetBooleanv( ALenum param, ALboolean* data );
  65. ALAPI ALvoid ALAPIENTRY alGetIntegerv( ALenum param, ALint* data );
  66. ALAPI ALvoid ALAPIENTRY alGetFloatv( ALenum param, ALfloat* data );
  67. ALAPI ALvoid ALAPIENTRY alGetDoublev( ALenum param, ALdouble* data );
  68. ALAPI ALubyte* ALAPIENTRY alGetString( ALenum param );
  69. /**
  70. * Error support.
  71. * Obtain the most recent error generated in the AL state machine.
  72. */
  73. ALAPI ALenum ALAPIENTRY alGetError( ALvoid );
  74. /**
  75. * Extension support.
  76. * Obtain the address of a function (usually an extension)
  77. * with the name fname. All addresses are context-independent.
  78. */
  79. ALAPI ALboolean ALAPIENTRY alIsExtensionPresent( ALubyte* fname );
  80. /**
  81. * Extension support.
  82. * Obtain the address of a function (usually an extension)
  83. * with the name fname. All addresses are context-independent.
  84. */
  85. ALAPI ALvoid* ALAPIENTRY alGetProcAddress( ALubyte* fname );
  86. /**
  87. * Extension support.
  88. * Obtain the integer value of an enumeration (usually an extension) with the name ename.
  89. */
  90. ALAPI ALenum ALAPIENTRY alGetEnumValue( ALubyte* ename );
  91. /**
  92. * LISTENER
  93. * Listener is the sample position for a given context.
  94. * The multi-channel (usually stereo) output stream generated
  95. * by the mixer is parametrized by this Listener object:
  96. * its position and velocity relative to Sources, within
  97. * occluder and reflector geometry.
  98. */
  99. /**
  100. *
  101. * Listener Environment: default 0.
  102. */
  103. ALAPI ALvoid ALAPIENTRY alListeneri( ALenum param, ALint value );
  104. /**
  105. *
  106. * Listener Gain: default 1.0f.
  107. */
  108. ALAPI ALvoid ALAPIENTRY alListenerf( ALenum param, ALfloat value );
  109. /**
  110. *
  111. * Listener Position.
  112. * Listener Velocity.
  113. */
  114. ALAPI ALvoid ALAPIENTRY alListener3f( ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 );
  115. /**
  116. *
  117. * Listener Position: ALfloat[3]
  118. * Listener Velocity: ALfloat[3]
  119. * Listener Orientation: ALfloat[6] (forward and up vector).
  120. */
  121. ALAPI ALvoid ALAPIENTRY alListenerfv( ALenum param, ALfloat* values );
  122. ALAPI ALvoid ALAPIENTRY alGetListeneri( ALenum param, ALint* value );
  123. ALAPI ALvoid ALAPIENTRY alGetListenerf( ALenum param, ALfloat* value );
  124. ALAPI ALvoid ALAPIENTRY alGetListener3f( ALenum param, ALfloat* v1, ALfloat* v2, ALfloat* v3 );
  125. ALAPI ALvoid ALAPIENTRY alGetListenerfv( ALenum param, ALfloat* values );
  126. /**
  127. * SOURCE
  128. * Source objects are by default localized. Sources
  129. * take the PCM data provided in the specified Buffer,
  130. * apply Source-specific modifications, and then
  131. * submit them to be mixed according to spatial
  132. * arrangement etc.
  133. */
  134. /** Create Source objects. */
  135. ALAPI ALvoid ALAPIENTRY alGenSources( ALsizei n, ALuint* sources );
  136. /** Delete Source objects. */
  137. ALAPI ALvoid ALAPIENTRY alDeleteSources( ALsizei n, ALuint* sources );
  138. /** Verify a handle is a valid Source. */
  139. ALAPI ALboolean ALAPIENTRY alIsSource( ALuint id );
  140. /** Set an integer parameter for a Source object. */
  141. ALAPI ALvoid ALAPIENTRY alSourcei( ALuint source, ALenum param, ALint value );
  142. ALAPI ALvoid ALAPIENTRY alSourcef( ALuint source, ALenum param, ALfloat value );
  143. ALAPI ALvoid ALAPIENTRY alSource3f( ALuint source, ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 );
  144. ALAPI ALvoid ALAPIENTRY alSourcefv( ALuint source, ALenum param, ALfloat* values );
  145. /** Get an integer parameter for a Source object. */
  146. ALAPI ALvoid ALAPIENTRY alGetSourcei( ALuint source, ALenum param, ALint* value );
  147. ALAPI ALvoid ALAPIENTRY alGetSourcef( ALuint source, ALenum param, ALfloat* value );
  148. ALAPI ALvoid ALAPIENTRY alGetSource3f( ALuint source, ALenum param, ALfloat* v1, ALfloat* v2, ALfloat* v3 );
  149. ALAPI ALvoid ALAPIENTRY alGetSourcefv( ALuint source, ALenum param, ALfloat* values );
  150. ALAPI ALvoid ALAPIENTRY alSourcePlayv( ALsizei n, ALuint *sources );
  151. ALAPI ALvoid ALAPIENTRY alSourcePausev( ALsizei n, ALuint *sources );
  152. ALAPI ALvoid ALAPIENTRY alSourceStopv( ALsizei n, ALuint *sources );
  153. ALAPI ALvoid ALAPIENTRY alSourceRewindv(ALsizei n,ALuint *sources);
  154. /** Activate a source, start replay. */
  155. ALAPI ALvoid ALAPIENTRY alSourcePlay( ALuint source );
  156. /**
  157. * Pause a source,
  158. * temporarily remove it from the mixer list.
  159. */
  160. ALAPI ALvoid ALAPIENTRY alSourcePause( ALuint source );
  161. /**
  162. * Stop a source,
  163. * temporarily remove it from the mixer list,
  164. * and reset its internal state to pre-Play.
  165. * To remove a Source completely, it has to be
  166. * deleted following Stop, or before Play.
  167. */
  168. ALAPI ALvoid ALAPIENTRY alSourceStop( ALuint source );
  169. /**
  170. * Rewinds a source,
  171. * temporarily remove it from the mixer list,
  172. * and reset its internal state to pre-Play.
  173. */
  174. ALAPI ALvoid ALAPIENTRY alSourceRewind( ALuint source );
  175. /**
  176. * BUFFER
  177. * Buffer objects are storage space for sample data.
  178. * Buffers are referred to by Sources. There can be more than
  179. * one Source using the same Buffer data. If Buffers have
  180. * to be duplicated on a per-Source basis, the driver has to
  181. * take care of allocation, copying, and deallocation as well
  182. * as propagating buffer data changes.
  183. */
  184. /** Buffer object generation. */
  185. ALAPI ALvoid ALAPIENTRY alGenBuffers( ALsizei n, ALuint* buffers );
  186. ALAPI ALvoid ALAPIENTRY alDeleteBuffers( ALsizei n, ALuint* buffers );
  187. ALAPI ALboolean ALAPIENTRY alIsBuffer( ALuint buffer );
  188. /**
  189. * Specify the data to be filled into a buffer.
  190. */
  191. ALAPI ALvoid ALAPIENTRY alBufferData( ALuint buffer,
  192. ALenum format,
  193. ALvoid* data,
  194. ALsizei size,
  195. ALsizei freq );
  196. ALAPI ALvoid ALAPIENTRY alGetBufferi( ALuint buffer, ALenum param, ALint* value );
  197. ALAPI ALvoid ALAPIENTRY alGetBufferf( ALuint buffer, ALenum param, ALfloat* value );
  198. /**
  199. * Queue stuff
  200. */
  201. ALAPI ALvoid ALAPIENTRY alSourceQueueBuffers( ALuint source, ALsizei n, ALuint* buffers );
  202. ALAPI ALvoid ALAPIENTRY alSourceUnqueueBuffers( ALuint source, ALsizei n, ALuint* buffers );
  203. /**
  204. * Knobs and dials
  205. */
  206. ALAPI ALvoid ALAPIENTRY alDistanceModel( ALenum value );
  207. ALAPI ALvoid ALAPIENTRY alDopplerFactor( ALfloat value );
  208. ALAPI ALvoid ALAPIENTRY alDopplerVelocity( ALfloat value );
  209. #else /* AL_NO_PROTOTYPES */
  210. /**
  211. * OpenAL Maintenance Functions
  212. * Initialization and exiting.
  213. * State Management and Query.
  214. * Error Handling.
  215. * Extension Support.
  216. */
  217. /** State management. */
  218. ALAPI ALvoid ALAPIENTRY (*alEnable)( ALenum capability );
  219. ALAPI ALvoid ALAPIENTRY (*alDisable)( ALenum capability );
  220. ALAPI ALboolean ALAPIENTRY (*alIsEnabled)( ALenum capability );
  221. /** Application preferences for driver performance choices. */
  222. ALAPI ALvoid ALAPIENTRY (*alHint)( ALenum target, ALenum mode );
  223. /** State retrieval. */
  224. ALAPI ALboolean ALAPIENTRY (*alGetBoolean)( ALenum param );
  225. ALAPI ALint ALAPIENTRY (*alGetInteger)( ALenum param );
  226. ALAPI ALfloat ALAPIENTRY (*alGetFloat)( ALenum param );
  227. ALAPI ALdouble ALAPIENTRY (*alGetDouble)( ALenum param );
  228. ALAPI ALvoid ALAPIENTRY (*alGetBooleanv)( ALenum param, ALboolean* data );
  229. ALAPI ALvoid ALAPIENTRY (*alGetIntegerv)( ALenum param, ALint* data );
  230. ALAPI ALvoid ALAPIENTRY (*alGetFloatv)( ALenum param, ALfloat* data );
  231. ALAPI ALvoid ALAPIENTRY (*alGetDoublev)( ALenum param, ALdouble* data );
  232. ALAPI ALubyte* ALAPIENTRY (*alGetString)( ALenum param );
  233. /**
  234. * Error support.
  235. * Obtain the most recent error generated in the AL state machine.
  236. */
  237. ALAPI ALenum ALAPIENTRY (*alGetError)( ALvoid );
  238. /**
  239. * Extension support.
  240. * Obtain the address of a function (usually an extension)
  241. * with the name fname. All addresses are context-independent.
  242. */
  243. ALAPI ALboolean ALAPIENTRY (*alIsExtensionPresent)( ALubyte* fname );
  244. /**
  245. * Extension support.
  246. * Obtain the address of a function (usually an extension)
  247. * with the name fname. All addresses are context-independent.
  248. */
  249. ALAPI ALvoid* ALAPIENTRY (*alGetProcAddress)( ALubyte* fname );
  250. /**
  251. * Extension support.
  252. * Obtain the integer value of an enumeration (usually an extension) with the name ename.
  253. */
  254. ALAPI ALenum ALAPIENTRY (*alGetEnumValue)( ALubyte* ename );
  255. /**
  256. * LISTENER
  257. * Listener is the sample position for a given context.
  258. * The multi-channel (usually stereo) output stream generated
  259. * by the mixer is parametrized by this Listener object:
  260. * its position and velocity relative to Sources, within
  261. * occluder and reflector geometry.
  262. */
  263. /**
  264. *
  265. * Listener Environment: default 0.
  266. */
  267. ALAPI ALvoid ALAPIENTRY (*alListeneri)( ALenum param, ALint value );
  268. /**
  269. *
  270. * Listener Gain: default 1.0f.
  271. */
  272. ALAPI ALvoid ALAPIENTRY (*alListenerf)( ALenum param, ALfloat value );
  273. /**
  274. *
  275. * Listener Position.
  276. * Listener Velocity.
  277. */
  278. ALAPI ALvoid ALAPIENTRY (*alListener3f)( ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 );
  279. /**
  280. *
  281. * Listener Position: ALfloat[3]
  282. * Listener Velocity: ALfloat[3]
  283. * Listener Orientation: ALfloat[6] (forward and up vector).
  284. */
  285. ALAPI ALvoid ALAPIENTRY (*alListenerfv)( ALenum param, ALfloat* values );
  286. ALAPI ALvoid ALAPIENTRY (*alGetListeneri)( ALenum param, ALint* value );
  287. ALAPI ALvoid ALAPIENTRY (*alGetListenerf)( ALenum param, ALfloat* value );
  288. ALAPI ALvoid ALAPIENTRY (*alGetListener3f)( ALenum param, ALfloat* v1, ALfloat* v2, ALfloat* v3 );
  289. ALAPI ALvoid ALAPIENTRY (*alGetListenerfv)( ALenum param, ALfloat* values );
  290. /**
  291. * SOURCE
  292. * Source objects are by default localized. Sources
  293. * take the PCM data provided in the specified Buffer,
  294. * apply Source-specific modifications, and then
  295. * submit them to be mixed according to spatial
  296. * arrangement etc.
  297. */
  298. /** Create Source objects. */
  299. ALAPI ALvoid ALAPIENTRY (*alGenSources)( ALsizei n, ALuint* sources );
  300. /** Delete Source objects. */
  301. ALAPI ALvoid ALAPIENTRY (*alDeleteSources)( ALsizei n, ALuint* sources );
  302. /** Verify a handle is a valid Source. */
  303. ALAPI ALboolean ALAPIENTRY (*alIsSource)( ALuint id );
  304. /** Set an integer parameter for a Source object. */
  305. ALAPI ALvoid ALAPIENTRY (*alSourcei)( ALuint source, ALenum param, ALint value );
  306. ALAPI ALvoid ALAPIENTRY (*alSourcef)( ALuint source, ALenum param, ALfloat value );
  307. ALAPI ALvoid ALAPIENTRY (*alSource3f)( ALuint source, ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 );
  308. ALAPI ALvoid ALAPIENTRY (*alSourcefv)( ALuint source, ALenum param, ALfloat* values );
  309. /** Get an integer parameter for a Source object. */
  310. ALAPI ALvoid ALAPIENTRY (*alGetSourcei)( ALuint source, ALenum param, ALint* value );
  311. ALAPI ALvoid ALAPIENTRY (*alGetSourcef)( ALuint source, ALenum param, ALfloat* value );
  312. ALAPI ALvoid ALAPIENTRY (*alGetSourcefv)( ALuint source, ALenum param, ALfloat* values );
  313. ALAPI ALvoid ALAPIENTRY (*alSourcePlayv)( ALsizei n, ALuint *sources );
  314. ALAPI ALvoid ALAPIENTRY (*alSourceStopv)( ALsizei n, ALuint *sources );
  315. /** Activate a source, start replay. */
  316. ALAPI ALvoid ALAPIENTRY (*alSourcePlay)( ALuint source );
  317. /**
  318. * Pause a source,
  319. * temporarily remove it from the mixer list.
  320. */
  321. ALAPI ALvoid ALAPIENTRY (*alSourcePause)( ALuint source );
  322. /**
  323. * Stop a source,
  324. * temporarily remove it from the mixer list,
  325. * and reset its internal state to pre-Play.
  326. * To remove a Source completely, it has to be
  327. * deleted following Stop, or before Play.
  328. */
  329. ALAPI ALvoid ALAPIENTRY (*alSourceStop)( ALuint source );
  330. /**
  331. * BUFFER
  332. * Buffer objects are storage space for sample data.
  333. * Buffers are referred to by Sources. There can be more than
  334. * one Source using the same Buffer data. If Buffers have
  335. * to be duplicated on a per-Source basis, the driver has to
  336. * take care of allocation, copying, and deallocation as well
  337. * as propagating buffer data changes.
  338. */
  339. /** Buffer object generation. */
  340. ALAPI ALvoid ALAPIENTRY (*alGenBuffers)( ALsizei n, ALuint* buffers );
  341. ALAPI ALvoid ALAPIENTRY (*alDeleteBuffers)( ALsizei n, ALuint* buffers );
  342. ALAPI ALboolean ALAPIENTRY (*alIsBuffer)( ALuint buffer );
  343. /**
  344. * Specify the data to be filled into a buffer.
  345. */
  346. ALAPI ALvoid ALAPIENTRY (*alBufferData)( ALuint buffer,
  347. ALenum format,
  348. ALvoid* data,
  349. ALsizei size,
  350. ALsizei freq );
  351. ALAPI ALvoid ALAPIENTRY (*alGetBufferi)( ALuint buffer, ALenum param, ALint* value );
  352. ALAPI ALvoid ALAPIENTRY (*alGetBufferf)( ALuint buffer, ALenum param, ALfloat* value );
  353. /**
  354. * Queue stuff
  355. */
  356. ALAPI ALvoid ALAPIENTRY (*alSourceQueueBuffers)( ALuint source, ALsizei n, ALuint* buffers );
  357. ALAPI ALvoid ALAPIENTRY (*alSourceUnqueueBuffers)( ALuint source, ALsizei n, ALuint* buffers );
  358. /**
  359. * Knobs and dials
  360. */
  361. ALAPI ALvoid ALAPIENTRY (*alDistanceModel)( ALenum value );
  362. ALAPI ALvoid ALAPIENTRY (*alDopplerFactor)( ALfloat value );
  363. ALAPI ALvoid ALAPIENTRY (*alDopplerVelocity)( ALfloat value );
  364. #endif /* AL_NO_PROTOTYPES */
  365. #ifdef TARGET_OS_MAC
  366. #if TARGET_OS_MAC
  367. #pragma export off
  368. #endif
  369. #endif
  370. #ifdef __cplusplus
  371. }
  372. #endif
  373. #endif