Use a macro to signify building a static lib
[alure.git] / include / AL / alure.h
blob04107b42d52687ef233d9de9aed189715ebd8ef2
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 ALboolean ALURE_APIENTRY alurePlaySourceStream(ALuint source,
88 alureStream *stream, ALsizei numBufs, ALsizei loopcount,
89 void (*eos_callback)(void *userdata, ALuint source), void *userdata);
90 ALURE_API ALboolean ALURE_APIENTRY alurePlaySource(ALuint source,
91 void (*callback)(void *userdata, ALuint source), void *userdata);
92 ALURE_API ALboolean ALURE_APIENTRY alureStopSource(ALuint source, ALboolean run_callback);
93 ALURE_API ALboolean ALURE_APIENTRY alurePauseSource(ALuint source);
94 ALURE_API ALboolean ALURE_APIENTRY alureResumeSource(ALuint source);
95 ALURE_API alureUInt64 ALURE_APIENTRY alureGetSourceOffset(ALuint source);
97 ALURE_API ALboolean ALURE_APIENTRY alureInstallDecodeCallbacks(ALint index,
98 void* (*open_file)(const ALchar*),
99 void* (*open_mem)(const ALubyte*,ALuint),
100 ALboolean (*get_format)(void*,ALenum*,ALuint*,ALuint*),
101 ALuint (*decode)(void*,ALubyte*,ALuint),
102 ALboolean (*rewind)(void*),
103 void (*close)(void*));
104 ALURE_API ALboolean ALURE_APIENTRY alureSetIOCallbacks(
105 void* (*open)(const char*,ALuint),
106 void (*close)(void*),
107 ALsizei (*read)(void*,ALubyte*,ALuint),
108 ALsizei (*write)(void*,const ALubyte*,ALuint),
109 alureInt64 (*seek)(void*,alureInt64,int));
111 ALURE_API void* ALURE_APIENTRY alureGetProcAddress(const ALchar *funcname);
113 typedef void (ALURE_APIENTRY *LPALUREGETVERSION)(ALuint*,ALuint*);
114 typedef const ALchar* (ALURE_APIENTRY *LPALUREGETERRORSTRING)(void);
115 typedef const ALCchar** (ALURE_APIENTRY *LPALUREGETDEVICENAMES)(ALCboolean,ALCsizei*);
116 typedef ALvoid (ALURE_APIENTRY *LPALUREFREEDEVICENAMES)(const ALCchar**);
117 typedef ALboolean (ALURE_APIENTRY *LPALUREINITDEVICE)(const ALCchar*,const ALCint*);
118 typedef ALboolean (ALURE_APIENTRY *LPALURESHUTDOWNDEVICE)(void);
119 typedef ALenum (ALURE_APIENTRY *LPALUREGETSAMPLEFORMAT)(ALuint,ALuint,ALuint);
120 typedef ALboolean (ALURE_APIENTRY *LPALURESLEEP)(ALfloat);
121 typedef ALuint (ALURE_APIENTRY *LPALURECREATEBUFFERFROMFILE)(const ALchar*);
122 typedef ALuint (ALURE_APIENTRY *LPALURECREATEBUFFERFROMMEMORY)(const ALubyte*,ALsizei);
123 typedef ALboolean (ALURE_APIENTRY *LPALUREBUFFERDATAFROMFILE)(const ALchar *fname, ALuint buffer);
124 typedef ALboolean (ALURE_APIENTRY *LPALUREBUFFERDATAFROMMEMORY)(const ALubyte *fdata, ALsizei length, ALuint buffer);
125 typedef alureStream* (ALURE_APIENTRY *LPALURECREATESTREAMFROMFILE)(const ALchar*,ALsizei,ALsizei,ALuint*);
126 typedef alureStream* (ALURE_APIENTRY *LPALURECREATESTREAMFROMMEMORY)(const ALubyte*,ALuint,ALsizei,ALsizei,ALuint*);
127 typedef alureStream* (ALURE_APIENTRY *LPALURECREATESTREAMFROMSTATICMEMORY)(const ALubyte*,ALuint,ALsizei,ALsizei,ALuint*);
128 typedef alureStream* (ALURE_APIENTRY *LPALURECREATESTREAMFROMCALLBACK)(ALuint(*)(void*,ALubyte*,ALuint),void*,ALenum,ALuint,ALsizei,ALsizei,ALuint*);
129 typedef ALboolean (ALURE_APIENTRY *LPALUREGETSTREAMFORMAT)(alureStream*,ALenum*,ALuint*,ALuint*);
130 typedef ALsizei (ALURE_APIENTRY *LPALUREBUFFERDATAFROMSTREAM)(alureStream*,ALsizei,ALuint*);
131 typedef ALboolean (ALURE_APIENTRY *LPALUREREWINDSTREAM)(alureStream*);
132 typedef ALboolean (ALURE_APIENTRY *LPALURESETSTREAMORDER)(alureStream*,ALuint);
133 typedef ALboolean (ALURE_APIENTRY *LPALUREDESTROYSTREAM)(alureStream*,ALsizei,ALuint*);
134 typedef ALboolean (ALURE_APIENTRY *LPALUREPLAYSOURCESTREAM)(ALuint,alureStream*,ALsizei,ALsizei,void(*)(void*,ALuint),void*);
135 typedef ALboolean (ALURE_APIENTRY *LPALUREPLAYSOURCE)(ALuint,void(*)(void*,ALuint),void*);
136 typedef ALboolean (ALURE_APIENTRY *LPALURESTOPSOURCE)(ALuint,ALboolean);
137 typedef ALboolean (ALURE_APIENTRY *LPALUREPAUSESOURCE)(ALuint);
138 typedef ALboolean (ALURE_APIENTRY *LPALURERESUMESOURCE)(ALuint);
139 typedef alureUInt64 (ALURE_APIENTRY *LPALUREGETSOURCEOFFSET)(ALuint);
140 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*));
141 typedef ALboolean (ALURE_APIENTRY *LPALURESETIOCALLBACKS)(void*(*)(const char*,ALuint),void(*)(void*),ALsizei(*)(void*,ALubyte*,ALuint),ALsizei(*)(void*,const ALubyte*,ALuint),alureInt64(*)(void*,alureInt64,int));
142 typedef void* (ALURE_APIENTRY *LPALUREGETPROCADDRESS)(const ALchar*);
144 #if defined(__cplusplus)
145 } /* extern "C" */
146 #endif
148 #endif /* AL_ALURE_H */