al.h 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498
  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 _LIB
  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
  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. ALAPI ALvoid ALAPIENTRY alSetInteger( ALenum pname, ALint value );
  70. ALAPI ALvoid ALAPIENTRY alSetDouble( ALenum pname, ALdouble value );
  71. /**
  72. * Error support.
  73. * Obtain the most recent error generated in the AL state machine.
  74. */
  75. ALAPI ALenum ALAPIENTRY alGetError( void );
  76. /**
  77. * Extension support.
  78. * Obtain the address of a function (usually an extension)
  79. * with the name fname. All addresses are context-independent.
  80. */
  81. ALAPI ALboolean ALAPIENTRY alIsExtensionPresent( ALubyte* fname );
  82. /**
  83. * Extension support.
  84. * Obtain the address of a function (usually an extension)
  85. * with the name fname. All addresses are context-independent.
  86. */
  87. ALAPI ALvoid* ALAPIENTRY alGetProcAddress( ALubyte* fname );
  88. /**
  89. * Extension support.
  90. * Obtain the integer value of an enumeration (usually an extension) with the name ename.
  91. */
  92. ALAPI ALenum ALAPIENTRY alGetEnumValue( ALubyte* ename );
  93. /**
  94. * LISTENER
  95. * Listener is the sample position for a given context.
  96. * The multi-channel (usually stereo) output stream generated
  97. * by the mixer is parametrized by this Listener object:
  98. * its position and velocity relative to Sources, within
  99. * occluder and reflector geometry.
  100. */
  101. /**
  102. *
  103. * Listener Environment: default 0.
  104. */
  105. ALAPI ALvoid ALAPIENTRY alListeneri( ALenum param, ALint value );
  106. /**
  107. *
  108. * Listener Gain: default 1.0f.
  109. */
  110. ALAPI ALvoid ALAPIENTRY alListenerf( ALenum param, ALfloat value );
  111. /**
  112. *
  113. * Listener Position.
  114. * Listener Velocity.
  115. */
  116. ALAPI ALvoid ALAPIENTRY alListener3f( ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 );
  117. /**
  118. *
  119. * Listener Position: ALfloat[3]
  120. * Listener Velocity: ALfloat[3]
  121. * Listener Orientation: ALfloat[6] (forward and up vector).
  122. */
  123. ALAPI ALvoid ALAPIENTRY alListenerfv( ALenum param, ALfloat* values );
  124. ALAPI ALvoid ALAPIENTRY alGetListeneri( ALenum param, ALint* value );
  125. ALAPI ALvoid ALAPIENTRY alGetListenerf( ALenum param, ALfloat* value );
  126. ALAPI ALvoid ALAPIENTRY alGetListener3f( ALenum param, ALfloat* v1, ALfloat* v2, ALfloat* v3 );
  127. ALAPI ALvoid ALAPIENTRY alGetListenerfv( ALenum param, ALfloat* values );
  128. /**
  129. * SOURCE
  130. * Source objects are by default localized. Sources
  131. * take the PCM data provided in the specified Buffer,
  132. * apply Source-specific modifications, and then
  133. * submit them to be mixed according to spatial
  134. * arrangement etc.
  135. */
  136. /** Create Source objects. */
  137. ALAPI ALvoid ALAPIENTRY alGenSources( ALsizei n, ALuint* sources );
  138. /** Delete Source objects. */
  139. ALAPI ALvoid ALAPIENTRY alDeleteSources( ALsizei n, ALuint* sources );
  140. /** Verify a handle is a valid Source. */
  141. ALAPI ALboolean ALAPIENTRY alIsSource( ALuint id );
  142. /** Set an integer parameter for a Source object. */
  143. ALAPI ALvoid ALAPIENTRY alSourcei( ALuint source, ALenum param, ALint value );
  144. ALAPI ALvoid ALAPIENTRY alSourcef( ALuint source, ALenum param, ALfloat value );
  145. ALAPI ALvoid ALAPIENTRY alSource3f( ALuint source, ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 );
  146. ALAPI ALvoid ALAPIENTRY alSourcefv( ALuint source, ALenum param, ALfloat* values );
  147. /** Get an integer parameter for a Source object. */
  148. ALAPI ALvoid ALAPIENTRY alGetSourcei( ALuint source, ALenum param, ALint* value );
  149. ALAPI ALvoid ALAPIENTRY alGetSourcef( ALuint source, ALenum param, ALfloat* value );
  150. ALAPI ALvoid ALAPIENTRY alGetSource3f( ALuint source, ALenum param, ALfloat* v1, ALfloat* v2, ALfloat* v3 );
  151. ALAPI ALvoid ALAPIENTRY alGetSourcefv( ALuint source, ALenum param, ALfloat* values );
  152. ALAPI ALvoid ALAPIENTRY alSourcePlayv( ALsizei n, ALuint *sources );
  153. ALAPI ALvoid ALAPIENTRY alSourcePausev( ALsizei n, ALuint *sources );
  154. ALAPI ALvoid ALAPIENTRY alSourceStopv( ALsizei n, ALuint *sources );
  155. ALAPI ALvoid ALAPIENTRY alSourceRewindv(ALsizei n,ALuint *sources);
  156. /** Activate a source, start replay. */
  157. ALAPI ALvoid ALAPIENTRY alSourcePlay( ALuint source );
  158. /**
  159. * Pause a source,
  160. * temporarily remove it from the mixer list.
  161. */
  162. ALAPI ALvoid ALAPIENTRY alSourcePause( ALuint source );
  163. /**
  164. * Stop a source,
  165. * temporarily remove it from the mixer list,
  166. * and reset its internal state to pre-Play.
  167. * To remove a Source completely, it has to be
  168. * deleted following Stop, or before Play.
  169. */
  170. ALAPI ALvoid ALAPIENTRY alSourceStop( ALuint source );
  171. /**
  172. * Rewinds a source,
  173. * temporarily remove it from the mixer list,
  174. * and reset its internal state to pre-Play.
  175. */
  176. ALAPI ALvoid ALAPIENTRY alSourceRewind( ALuint source );
  177. /**
  178. * BUFFER
  179. * Buffer objects are storage space for sample data.
  180. * Buffers are referred to by Sources. There can be more than
  181. * one Source using the same Buffer data. If Buffers have
  182. * to be duplicated on a per-Source basis, the driver has to
  183. * take care of allocation, copying, and deallocation as well
  184. * as propagating buffer data changes.
  185. */
  186. /** Buffer object generation. */
  187. ALAPI ALvoid ALAPIENTRY alGenBuffers( ALsizei n, ALuint* buffers );
  188. ALAPI ALvoid ALAPIENTRY alDeleteBuffers( ALsizei n, ALuint* buffers );
  189. ALAPI ALboolean ALAPIENTRY alIsBuffer( ALuint buffer );
  190. /**
  191. * Specify the data to be filled into a buffer.
  192. */
  193. ALAPI ALvoid ALAPIENTRY alBufferData( ALuint buffer,
  194. ALenum format,
  195. ALvoid* data,
  196. ALsizei size,
  197. ALsizei freq );
  198. ALAPI ALvoid ALAPIENTRY alGetBufferi( ALuint buffer, ALenum param, ALint* value );
  199. ALAPI ALvoid ALAPIENTRY alGetBufferf( ALuint buffer, ALenum param, ALfloat* value );
  200. /**
  201. * Queue stuff
  202. */
  203. ALAPI ALvoid ALAPIENTRY alSourceQueueBuffers( ALuint source, ALsizei n, ALuint* buffers );
  204. ALAPI ALvoid ALAPIENTRY alSourceUnqueueBuffers( ALuint source, ALsizei n, ALuint* buffers );
  205. /**
  206. * Knobs and dials
  207. */
  208. ALAPI ALvoid ALAPIENTRY alDistanceModel( ALenum value );
  209. ALAPI ALvoid ALAPIENTRY alDopplerFactor( ALfloat value );
  210. ALAPI ALvoid ALAPIENTRY alDopplerVelocity( ALfloat value );
  211. #else /* AL_NO_PROTOTYPES */
  212. /**
  213. * OpenAL Maintenance Functions
  214. * Initialization and exiting.
  215. * State Management and Query.
  216. * Error Handling.
  217. * Extension Support.
  218. */
  219. /** State management. */
  220. ALAPI ALvoid ALAPIENTRY (*alEnable)( ALenum capability );
  221. ALAPI ALvoid ALAPIENTRY (*alDisable)( ALenum capability );
  222. ALAPI ALboolean ALAPIENTRY (*alIsEnabled)( ALenum capability );
  223. /** Application preferences for driver performance choices. */
  224. ALAPI ALvoid ALAPIENTRY (*alHint)( ALenum target, ALenum mode );
  225. /** State retrieval. */
  226. ALAPI ALboolean ALAPIENTRY (*alGetBoolean)( ALenum param );
  227. ALAPI ALint ALAPIENTRY (*alGetInteger)( ALenum param );
  228. ALAPI ALfloat ALAPIENTRY (*alGetFloat)( ALenum param );
  229. ALAPI ALdouble ALAPIENTRY (*alGetDouble)( ALenum param );
  230. ALAPI ALvoid ALAPIENTRY (*alGetBooleanv)( ALenum param, ALboolean* data );
  231. ALAPI ALvoid ALAPIENTRY (*alGetIntegerv)( ALenum param, ALint* data );
  232. ALAPI ALvoid ALAPIENTRY (*alGetFloatv)( ALenum param, ALfloat* data );
  233. ALAPI ALvoid ALAPIENTRY (*alGetDoublev)( ALenum param, ALdouble* data );
  234. ALAPI ALubyte* ALAPIENTRY (*alGetString)( ALenum param );
  235. ALAPI ALvoid ALAPIENTRY (*alSetInteger)( ALenum pname, ALint value );
  236. ALAPI ALvoid ALAPIENTRY (*alSetDouble)( ALenum pname, ALdouble value );
  237. /**
  238. * Error support.
  239. * Obtain the most recent error generated in the AL state machine.
  240. */
  241. ALAPI ALenum ALAPIENTRY (*alGetError)( ALvoid );
  242. /**
  243. * Extension support.
  244. * Obtain the address of a function (usually an extension)
  245. * with the name fname. All addresses are context-independent.
  246. */
  247. ALAPI ALboolean ALAPIENTRY (*alIsExtensionPresent)( ALubyte* fname );
  248. /**
  249. * Extension support.
  250. * Obtain the address of a function (usually an extension)
  251. * with the name fname. All addresses are context-independent.
  252. */
  253. ALAPI ALvoid* ALAPIENTRY (*alGetProcAddress)( ALubyte* fname );
  254. /**
  255. * Extension support.
  256. * Obtain the integer value of an enumeration (usually an extension) with the name ename.
  257. */
  258. ALAPI ALenum ALAPIENTRY (*alGetEnumValue)( ALubyte* ename );
  259. /**
  260. * LISTENER
  261. * Listener is the sample position for a given context.
  262. * The multi-channel (usually stereo) output stream generated
  263. * by the mixer is parametrized by this Listener object:
  264. * its position and velocity relative to Sources, within
  265. * occluder and reflector geometry.
  266. */
  267. /**
  268. *
  269. * Listener Environment: default 0.
  270. */
  271. ALAPI ALvoid ALAPIENTRY (*alListeneri)( ALenum param, ALint value );
  272. /**
  273. *
  274. * Listener Gain: default 1.0f.
  275. */
  276. ALAPI ALvoid ALAPIENTRY (*alListenerf)( ALenum param, ALfloat value );
  277. /**
  278. *
  279. * Listener Position.
  280. * Listener Velocity.
  281. */
  282. ALAPI ALvoid ALAPIENTRY (*alListener3f)( ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 );
  283. /**
  284. *
  285. * Listener Position: ALfloat[3]
  286. * Listener Velocity: ALfloat[3]
  287. * Listener Orientation: ALfloat[6] (forward and up vector).
  288. */
  289. ALAPI ALvoid ALAPIENTRY (*alListenerfv)( ALenum param, ALfloat* values );
  290. ALAPI ALvoid ALAPIENTRY (*alGetListeneri)( ALenum param, ALint* value );
  291. ALAPI ALvoid ALAPIENTRY (*alGetListenerf)( ALenum param, ALfloat* value );
  292. ALAPI ALvoid ALAPIENTRY (*alGetListener3f)( ALenum param, ALfloat* v1, ALfloat* v2, ALfloat* v3 );
  293. ALAPI ALvoid ALAPIENTRY (*alGetListenerfv)( ALenum param, ALfloat* values );
  294. /**
  295. * SOURCE
  296. * Source objects are by default localized. Sources
  297. * take the PCM data provided in the specified Buffer,
  298. * apply Source-specific modifications, and then
  299. * submit them to be mixed according to spatial
  300. * arrangement etc.
  301. */
  302. /** Create Source objects. */
  303. ALAPI ALvoid ALAPIENTRY (*alGenSources)( ALsizei n, ALuint* sources );
  304. /** Delete Source objects. */
  305. ALAPI ALvoid ALAPIENTRY (*alDeleteSources)( ALsizei n, ALuint* sources );
  306. /** Verify a handle is a valid Source. */
  307. ALAPI ALboolean ALAPIENTRY (*alIsSource)( ALuint id );
  308. /** Set an integer parameter for a Source object. */
  309. ALAPI ALvoid ALAPIENTRY (*alSourcei)( ALuint source, ALenum param, ALint value );
  310. ALAPI ALvoid ALAPIENTRY (*alSourcef)( ALuint source, ALenum param, ALfloat value );
  311. ALAPI ALvoid ALAPIENTRY (*alSource3f)( ALuint source, ALenum param, ALfloat v1, ALfloat v2, ALfloat v3 );
  312. ALAPI ALvoid ALAPIENTRY (*alSourcefv)( ALuint source, ALenum param, ALfloat* values );
  313. /** Get an integer parameter for a Source object. */
  314. ALAPI ALvoid ALAPIENTRY (*alGetSourcei)( ALuint source, ALenum param, ALint* value );
  315. ALAPI ALvoid ALAPIENTRY (*alGetSourcef)( ALuint source, ALenum param, ALfloat* value );
  316. ALAPI ALvoid ALAPIENTRY (*alGetSourcefv)( ALuint source, ALenum param, ALfloat* values );
  317. ALAPI ALvoid ALAPIENTRY (*alSourcePlayv)( ALsizei n, ALuint *sources );
  318. ALAPI ALvoid ALAPIENTRY (*alSourceStopv)( ALsizei n, ALuint *sources );
  319. /** Activate a source, start replay. */
  320. ALAPI ALvoid ALAPIENTRY (*alSourcePlay)( ALuint source );
  321. /**
  322. * Pause a source,
  323. * temporarily remove it from the mixer list.
  324. */
  325. ALAPI ALvoid ALAPIENTRY (*alSourcePause)( ALuint source );
  326. /**
  327. * Stop a source,
  328. * temporarily remove it from the mixer list,
  329. * and reset its internal state to pre-Play.
  330. * To remove a Source completely, it has to be
  331. * deleted following Stop, or before Play.
  332. */
  333. ALAPI ALvoid ALAPIENTRY (*alSourceStop)( ALuint source );
  334. /**
  335. * BUFFER
  336. * Buffer objects are storage space for sample data.
  337. * Buffers are referred to by Sources. There can be more than
  338. * one Source using the same Buffer data. If Buffers have
  339. * to be duplicated on a per-Source basis, the driver has to
  340. * take care of allocation, copying, and deallocation as well
  341. * as propagating buffer data changes.
  342. */
  343. /** Buffer object generation. */
  344. ALAPI ALvoid ALAPIENTRY (*alGenBuffers)( ALsizei n, ALuint* buffers );
  345. ALAPI ALvoid ALAPIENTRY (*alDeleteBuffers)( ALsizei n, ALuint* buffers );
  346. ALAPI ALboolean ALAPIENTRY (*alIsBuffer)( ALuint buffer );
  347. /**
  348. * Specify the data to be filled into a buffer.
  349. */
  350. ALAPI ALvoid ALAPIENTRY (*alBufferData)( ALuint buffer,
  351. ALenum format,
  352. ALvoid* data,
  353. ALsizei size,
  354. ALsizei freq );
  355. ALAPI ALvoid ALAPIENTRY (*alGetBufferi)( ALuint buffer, ALenum param, ALint* value );
  356. ALAPI ALvoid ALAPIENTRY (*alGetBufferf)( ALuint buffer, ALenum param, ALfloat* value );
  357. /**
  358. * Queue stuff
  359. */
  360. ALAPI ALvoid ALAPIENTRY (*alSourceQueueBuffers)( ALuint source, ALsizei n, ALuint* buffers );
  361. ALAPI ALvoid ALAPIENTRY (*alSourceUnqueueBuffers)( ALuint source, ALsizei n, ALuint* buffers );
  362. /**
  363. * Knobs and dials
  364. */
  365. ALAPI ALvoid ALAPIENTRY (*alDistanceModel)( ALenum value );
  366. ALAPI ALvoid ALAPIENTRY (*alDopplerFactor)( ALfloat value );
  367. ALAPI ALvoid ALAPIENTRY (*alDopplerVelocity)( ALfloat value );
  368. #endif /* AL_NO_PROTOTYPES */
  369. #ifdef TARGET_OS_MAC
  370. #if TARGET_OS_MAC
  371. #pragma export off
  372. #endif
  373. #endif
  374. #ifdef __cplusplus
  375. }
  376. #endif
  377. #endif