Add a function to auto-call alureUpdate
[alure.git] / include / AL / alure.h
blobdd40e8af34efeb9bfe75474c7e5853fb92a3d843
1 #ifndef AL_ALURE_H
2 #define AL_ALURE_H
4 #if !defined(ALC_VERSION_0_1) || !defined(AL_VERSION_1_0)
5 #ifdef _WIN32
6 #include <al.h>
7 #include <alc.h>
8 #elif defined(__APPLE__)
9 #include <OpenAL/alc.h>
10 #include <OpenAL/al.h>
11 #else
12 #include <AL/al.h>
13 #include <AL/alc.h>
14 #endif
15 #endif
17 #if defined(__cplusplus)
18 extern "C" {
19 #endif
21 #ifndef ALURE_STATIC_LIBRARY
22 #if defined(_WIN32)
23 #if defined(ALURE_BUILD_LIBRARY)
24 #define ALURE_API __declspec(dllexport)
25 #else
26 #define ALURE_API __declspec(dllimport)
27 #endif
28 #else
29 #if defined(ALURE_BUILD_LIBRARY) && defined(HAVE_GCC_VISIBILITY)
30 #define ALURE_API __attribute__((visibility("default")))
31 #else
32 #define ALURE_API extern
33 #endif
34 #endif
35 #else
36 #define ALURE_API
37 #endif
39 #if defined(_WIN32)
40 #define ALURE_APIENTRY __cdecl
42 #include <sys/types.h>
43 typedef __int64 alureInt64;
44 typedef unsigned __int64 alureUInt64;
45 #else
46 #define ALURE_APIENTRY
48 #include <stdint.h>
49 typedef int64_t alureInt64;
50 typedef uint64_t alureUInt64;
51 #endif
53 typedef struct alureStream alureStream;
55 ALURE_API void ALURE_APIENTRY alureGetVersion(ALuint *major, ALuint *minor);
56 ALURE_API const ALchar* ALURE_APIENTRY alureGetErrorString(void);
58 ALURE_API const ALCchar** ALURE_APIENTRY alureGetDeviceNames(ALCboolean all, ALCsizei *count);
59 ALURE_API ALvoid ALURE_APIENTRY alureFreeDeviceNames(const ALCchar **names);
61 ALURE_API ALboolean ALURE_APIENTRY alureInitDevice(const ALCchar *name, const ALCint *attribs);
62 ALURE_API ALboolean ALURE_APIENTRY alureShutdownDevice(void);
64 ALURE_API ALenum ALURE_APIENTRY alureGetSampleFormat(ALuint channels, ALuint bits, ALuint floatbits);
66 ALURE_API ALboolean ALURE_APIENTRY alureSleep(ALfloat duration);
68 ALURE_API ALuint ALURE_APIENTRY alureCreateBufferFromFile(const ALchar *fname);
69 ALURE_API ALuint ALURE_APIENTRY alureCreateBufferFromMemory(const ALubyte *data, ALsizei length);
70 ALURE_API ALboolean ALURE_APIENTRY alureBufferDataFromFile(const ALchar *fname, ALuint buffer);
71 ALURE_API ALboolean ALURE_APIENTRY alureBufferDataFromMemory(const ALubyte *fdata, ALsizei length, ALuint buffer);
73 ALURE_API alureStream* ALURE_APIENTRY alureCreateStreamFromFile(const ALchar *fname, ALsizei chunkLength, ALsizei numBufs, ALuint *bufs);
74 ALURE_API alureStream* ALURE_APIENTRY alureCreateStreamFromMemory(const ALubyte *data, ALuint length, ALsizei chunkLength, ALsizei numBufs, ALuint *bufs);
75 ALURE_API alureStream* ALURE_APIENTRY alureCreateStreamFromStaticMemory(const ALubyte *data, ALuint length, ALsizei chunkLength, ALsizei numBufs, ALuint *bufs);
76 ALURE_API alureStream* ALURE_APIENTRY alureCreateStreamFromCallback(
77 ALuint (*callback)(void *userdata, ALubyte *data, ALuint bytes),
78 void *userdata, ALenum format, ALuint samplerate,
79 ALsizei chunkLength, ALsizei numBufs, ALuint *bufs);
80 ALURE_API ALboolean ALURE_APIENTRY alureGetStreamFormat(alureStream *stream,
81 ALenum *format, ALuint *frequency, ALuint *blockAlign);
82 ALURE_API ALsizei ALURE_APIENTRY alureBufferDataFromStream(alureStream *stream, ALsizei numBufs, ALuint *bufs);
83 ALURE_API ALboolean ALURE_APIENTRY alureRewindStream(alureStream *stream);
84 ALURE_API ALboolean ALURE_APIENTRY alureSetStreamOrder(alureStream *stream, ALuint order);
85 ALURE_API ALboolean ALURE_APIENTRY alureDestroyStream(alureStream *stream, ALsizei numBufs, ALuint *bufs);
87 ALURE_API void ALURE_APIENTRY alureUpdate(void);
88 ALURE_API ALboolean ALURE_APIENTRY alureUpdateInterval(ALfloat interval);
90 ALURE_API ALboolean ALURE_APIENTRY alurePlaySourceStream(ALuint source,
91 alureStream *stream, ALsizei numBufs, ALsizei loopcount,
92 void (*eos_callback)(void *userdata, ALuint source), void *userdata);
93 ALURE_API ALboolean ALURE_APIENTRY alurePlaySource(ALuint source,
94 void (*callback)(void *userdata, ALuint source), void *userdata);
95 ALURE_API ALboolean ALURE_APIENTRY alureStopSource(ALuint source, ALboolean run_callback);
96 ALURE_API ALboolean ALURE_APIENTRY alurePauseSource(ALuint source);
97 ALURE_API ALboolean ALURE_APIENTRY alureResumeSource(ALuint source);
98 ALURE_API alureUInt64 ALURE_APIENTRY alureGetSourceOffset(ALuint source);
100 ALURE_API ALboolean ALURE_APIENTRY alureInstallDecodeCallbacks(ALint index,
101 void* (*open_file)(const ALchar*),
102 void* (*open_mem)(const ALubyte*,ALuint),
103 ALboolean (*get_format)(void*,ALenum*,ALuint*,ALuint*),
104 ALuint (*decode)(void*,ALubyte*,ALuint),
105 ALboolean (*rewind)(void*),
106 void (*close)(void*));
107 ALURE_API ALboolean ALURE_APIENTRY alureSetIOCallbacks(
108 void* (*open)(const char*,ALuint),
109 void (*close)(void*),
110 ALsizei (*read)(void*,ALubyte*,ALuint),
111 ALsizei (*write)(void*,const ALubyte*,ALuint),
112 alureInt64 (*seek)(void*,alureInt64,int));
114 ALURE_API void* ALURE_APIENTRY alureGetProcAddress(const ALchar *funcname);
116 typedef void (ALURE_APIENTRY *LPALUREGETVERSION)(ALuint*,ALuint*);
117 typedef const ALchar* (ALURE_APIENTRY *LPALUREGETERRORSTRING)(void);
118 typedef const ALCchar** (ALURE_APIENTRY *LPALUREGETDEVICENAMES)(ALCboolean,ALCsizei*);
119 typedef ALvoid (ALURE_APIENTRY *LPALUREFREEDEVICENAMES)(const ALCchar**);
120 typedef ALboolean (ALURE_APIENTRY *LPALUREINITDEVICE)(const ALCchar*,const ALCint*);
121 typedef ALboolean (ALURE_APIENTRY *LPALURESHUTDOWNDEVICE)(void);
122 typedef ALenum (ALURE_APIENTRY *LPALUREGETSAMPLEFORMAT)(ALuint,ALuint,ALuint);
123 typedef ALboolean (ALURE_APIENTRY *LPALURESLEEP)(ALfloat);
124 typedef ALuint (ALURE_APIENTRY *LPALURECREATEBUFFERFROMFILE)(const ALchar*);
125 typedef ALuint (ALURE_APIENTRY *LPALURECREATEBUFFERFROMMEMORY)(const ALubyte*,ALsizei);
126 typedef ALboolean (ALURE_APIENTRY *LPALUREBUFFERDATAFROMFILE)(const ALchar *fname, ALuint buffer);
127 typedef ALboolean (ALURE_APIENTRY *LPALUREBUFFERDATAFROMMEMORY)(const ALubyte *fdata, ALsizei length, ALuint buffer);
128 typedef alureStream* (ALURE_APIENTRY *LPALURECREATESTREAMFROMFILE)(const ALchar*,ALsizei,ALsizei,ALuint*);
129 typedef alureStream* (ALURE_APIENTRY *LPALURECREATESTREAMFROMMEMORY)(const ALubyte*,ALuint,ALsizei,ALsizei,ALuint*);
130 typedef alureStream* (ALURE_APIENTRY *LPALURECREATESTREAMFROMSTATICMEMORY)(const ALubyte*,ALuint,ALsizei,ALsizei,ALuint*);
131 typedef alureStream* (ALURE_APIENTRY *LPALURECREATESTREAMFROMCALLBACK)(ALuint(*)(void*,ALubyte*,ALuint),void*,ALenum,ALuint,ALsizei,ALsizei,ALuint*);
132 typedef ALboolean (ALURE_APIENTRY *LPALUREGETSTREAMFORMAT)(alureStream*,ALenum*,ALuint*,ALuint*);
133 typedef ALsizei (ALURE_APIENTRY *LPALUREBUFFERDATAFROMSTREAM)(alureStream*,ALsizei,ALuint*);
134 typedef ALboolean (ALURE_APIENTRY *LPALUREREWINDSTREAM)(alureStream*);
135 typedef ALboolean (ALURE_APIENTRY *LPALURESETSTREAMORDER)(alureStream*,ALuint);
136 typedef ALboolean (ALURE_APIENTRY *LPALUREDESTROYSTREAM)(alureStream*,ALsizei,ALuint*);
137 typedef void (ALURE_APIENTRY *LPALUREUPDATE)(void);
138 typedef ALboolean (ALURE_APIENTRY *LPALUREUPDATEINTERVAL)(ALfloat);
139 typedef ALboolean (ALURE_APIENTRY *LPALUREPLAYSOURCESTREAM)(ALuint,alureStream*,ALsizei,ALsizei,void(*)(void*,ALuint),void*);
140 typedef ALboolean (ALURE_APIENTRY *LPALUREPLAYSOURCE)(ALuint,void(*)(void*,ALuint),void*);
141 typedef ALboolean (ALURE_APIENTRY *LPALURESTOPSOURCE)(ALuint,ALboolean);
142 typedef ALboolean (ALURE_APIENTRY *LPALUREPAUSESOURCE)(ALuint);
143 typedef ALboolean (ALURE_APIENTRY *LPALURERESUMESOURCE)(ALuint);
144 typedef alureUInt64 (ALURE_APIENTRY *LPALUREGETSOURCEOFFSET)(ALuint);
145 typedef ALboolean (ALURE_APIENTRY *LPALUREINSTALLDECODECALLBACKS)(ALint,void*(*)(const char*),void*(*)(const ALubyte*,ALuint),ALboolean(*)(void*,ALenum*,ALuint*,ALuint*),ALuint(*)(void*,ALubyte*,ALuint),ALboolean(*)(void*),void(*)(void*));
146 typedef ALboolean (ALURE_APIENTRY *LPALURESETIOCALLBACKS)(void*(*)(const char*,ALuint),void(*)(void*),ALsizei(*)(void*,ALubyte*,ALuint),ALsizei(*)(void*,const ALubyte*,ALuint),alureInt64(*)(void*,alureInt64,int));
147 typedef void* (ALURE_APIENTRY *LPALUREGETPROCADDRESS)(const ALchar*);
149 #if defined(__cplusplus)
150 } /* extern "C" */
151 #endif
153 #endif /* AL_ALURE_H */