Imported Upstream version 1.2
[platform/upstream/alure.git] / include / AL / alure.h
1 #ifndef AL_ALURE_H
2 #define AL_ALURE_H
3
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
16
17 #if defined(__cplusplus)
18 extern "C" {
19 #endif
20
21 #define ALURE_VERSION_STRING "1.2"
22
23 #define ALURE_VERSION_1_0
24 #define ALURE_VERSION_1_1
25 #define ALURE_VERSION_1_2
26
27
28 #ifndef ALURE_API
29  #if defined(ALURE_STATIC_LIBRARY)
30   #define ALURE_API
31  #elif defined(_WIN32)
32   #define ALURE_API __declspec(dllimport)
33  #else
34   #define ALURE_API extern
35  #endif
36 #endif
37
38 #if defined(_WIN32)
39  #define ALURE_APIENTRY __cdecl
40
41  #include <sys/types.h>
42  typedef __int64 alureInt64;
43  typedef unsigned __int64 alureUInt64;
44 #else
45  #define ALURE_APIENTRY
46
47  #include <stdint.h>
48  typedef int64_t alureInt64;
49  typedef uint64_t alureUInt64;
50 #endif
51
52 typedef struct alureStream alureStream;
53
54 ALURE_API void ALURE_APIENTRY alureGetVersion(ALuint *major, ALuint *minor);
55 ALURE_API const ALchar* ALURE_APIENTRY alureGetErrorString(void);
56
57 ALURE_API const ALCchar** ALURE_APIENTRY alureGetDeviceNames(ALCboolean all, ALCsizei *count);
58 ALURE_API ALvoid ALURE_APIENTRY alureFreeDeviceNames(const ALCchar **names);
59
60 ALURE_API ALboolean ALURE_APIENTRY alureInitDevice(const ALCchar *name, const ALCint *attribs);
61 ALURE_API ALboolean ALURE_APIENTRY alureShutdownDevice(void);
62
63 ALURE_API ALenum ALURE_APIENTRY alureGetSampleFormat(ALuint channels, ALuint bits, ALuint floatbits);
64
65 ALURE_API ALboolean ALURE_APIENTRY alureSleep(ALfloat duration);
66
67 ALURE_API ALboolean ALURE_APIENTRY alureStreamSizeIsMicroSec(ALboolean useus);
68
69 ALURE_API ALuint ALURE_APIENTRY alureCreateBufferFromFile(const ALchar *fname);
70 ALURE_API ALuint ALURE_APIENTRY alureCreateBufferFromMemory(const ALubyte *data, ALsizei length);
71 ALURE_API ALboolean ALURE_APIENTRY alureBufferDataFromFile(const ALchar *fname, ALuint buffer);
72 ALURE_API ALboolean ALURE_APIENTRY alureBufferDataFromMemory(const ALubyte *fdata, ALsizei length, ALuint buffer);
73
74 ALURE_API alureStream* ALURE_APIENTRY alureCreateStreamFromFile(const ALchar *fname, ALsizei chunkLength, ALsizei numBufs, ALuint *bufs);
75 ALURE_API alureStream* ALURE_APIENTRY alureCreateStreamFromMemory(const ALubyte *data, ALuint length, ALsizei chunkLength, ALsizei numBufs, ALuint *bufs);
76 ALURE_API alureStream* ALURE_APIENTRY alureCreateStreamFromStaticMemory(const ALubyte *data, ALuint length, ALsizei chunkLength, ALsizei numBufs, ALuint *bufs);
77 ALURE_API alureStream* ALURE_APIENTRY alureCreateStreamFromCallback(
78     ALuint (*callback)(void *userdata, ALubyte *data, ALuint bytes),
79     void *userdata, ALenum format, ALuint samplerate,
80     ALsizei chunkLength, ALsizei numBufs, ALuint *bufs);
81 ALURE_API alureInt64 ALURE_APIENTRY alureGetStreamLength(alureStream *stream);
82 ALURE_API ALsizei ALURE_APIENTRY alureGetStreamFrequency(alureStream *stream);
83 ALURE_API ALsizei ALURE_APIENTRY alureBufferDataFromStream(alureStream *stream, ALsizei numBufs, ALuint *bufs);
84 ALURE_API ALboolean ALURE_APIENTRY alureRewindStream(alureStream *stream);
85 ALURE_API ALboolean ALURE_APIENTRY alureSetStreamOrder(alureStream *stream, ALuint order);
86 ALURE_API ALboolean ALURE_APIENTRY alureSetStreamPatchset(alureStream *stream, const ALchar *patchset);
87 ALURE_API ALboolean ALURE_APIENTRY alureDestroyStream(alureStream *stream, ALsizei numBufs, ALuint *bufs);
88
89 ALURE_API void ALURE_APIENTRY alureUpdate(void);
90 ALURE_API ALboolean ALURE_APIENTRY alureUpdateInterval(ALfloat interval);
91
92 ALURE_API ALboolean ALURE_APIENTRY alurePlaySourceStream(ALuint source,
93     alureStream *stream, ALsizei numBufs, ALsizei loopcount,
94     void (*eos_callback)(void *userdata, ALuint source), void *userdata);
95 ALURE_API ALboolean ALURE_APIENTRY alurePlaySource(ALuint source,
96     void (*callback)(void *userdata, ALuint source), void *userdata);
97 ALURE_API ALboolean ALURE_APIENTRY alureStopSource(ALuint source, ALboolean run_callback);
98 ALURE_API ALboolean ALURE_APIENTRY alurePauseSource(ALuint source);
99 ALURE_API ALboolean ALURE_APIENTRY alureResumeSource(ALuint source);
100
101 ALURE_API ALboolean ALURE_APIENTRY alureInstallDecodeCallbacks(ALint index,
102     void*     (*open_file)(const ALchar*),
103     void*     (*open_mem)(const ALubyte*,ALuint),
104     ALboolean (*get_format)(void*,ALenum*,ALuint*,ALuint*),
105     ALuint    (*decode)(void*,ALubyte*,ALuint),
106     ALboolean (*rewind)(void*),
107     void      (*close)(void*));
108 ALURE_API ALboolean ALURE_APIENTRY alureSetIOCallbacks(
109       void* (*open)(const char*,ALuint),
110       void (*close)(void*),
111       ALsizei (*read)(void*,ALubyte*,ALuint),
112       ALsizei (*write)(void*,const ALubyte*,ALuint),
113       alureInt64 (*seek)(void*,alureInt64,int));
114
115 ALURE_API void* ALURE_APIENTRY alureGetProcAddress(const ALchar *funcname);
116
117 typedef void            (ALURE_APIENTRY *LPALUREGETVERSION)(ALuint*,ALuint*);
118 typedef const ALchar*   (ALURE_APIENTRY *LPALUREGETERRORSTRING)(void);
119 typedef const ALCchar** (ALURE_APIENTRY *LPALUREGETDEVICENAMES)(ALCboolean,ALCsizei*);
120 typedef ALvoid          (ALURE_APIENTRY *LPALUREFREEDEVICENAMES)(const ALCchar**);
121 typedef ALboolean       (ALURE_APIENTRY *LPALUREINITDEVICE)(const ALCchar*,const ALCint*);
122 typedef ALboolean       (ALURE_APIENTRY *LPALURESHUTDOWNDEVICE)(void);
123 typedef ALenum          (ALURE_APIENTRY *LPALUREGETSAMPLEFORMAT)(ALuint,ALuint,ALuint);
124 typedef ALboolean       (ALURE_APIENTRY *LPALURESLEEP)(ALfloat);
125 typedef ALuint          (ALURE_APIENTRY *LPALURECREATEBUFFERFROMFILE)(const ALchar*);
126 typedef ALuint          (ALURE_APIENTRY *LPALURECREATEBUFFERFROMMEMORY)(const ALubyte*,ALsizei);
127 typedef ALboolean       (ALURE_APIENTRY *LPALUREBUFFERDATAFROMFILE)(const ALchar *fname, ALuint buffer);
128 typedef ALboolean       (ALURE_APIENTRY *LPALUREBUFFERDATAFROMMEMORY)(const ALubyte *fdata, ALsizei length, ALuint buffer);
129 typedef ALboolean       (ALURE_APIENTRY *LPALURESTREAMSIZEISMICROSEC)(ALboolean);
130 typedef alureStream*    (ALURE_APIENTRY *LPALURECREATESTREAMFROMFILE)(const ALchar*,ALsizei,ALsizei,ALuint*);
131 typedef alureStream*    (ALURE_APIENTRY *LPALURECREATESTREAMFROMMEMORY)(const ALubyte*,ALuint,ALsizei,ALsizei,ALuint*);
132 typedef alureStream*    (ALURE_APIENTRY *LPALURECREATESTREAMFROMSTATICMEMORY)(const ALubyte*,ALuint,ALsizei,ALsizei,ALuint*);
133 typedef alureStream*    (ALURE_APIENTRY *LPALURECREATESTREAMFROMCALLBACK)(ALuint(*)(void*,ALubyte*,ALuint),void*,ALenum,ALuint,ALsizei,ALsizei,ALuint*);
134 typedef alureInt64      (ALURE_APIENTRY *LPALUREGETSTREAMLENGTH)(alureStream*);
135 typedef ALsizei         (ALURE_APIENTRY *LPALUREGETSTREAMFREQUENCY)(alureStream*);
136 typedef ALsizei         (ALURE_APIENTRY *LPALUREBUFFERDATAFROMSTREAM)(alureStream*,ALsizei,ALuint*);
137 typedef ALboolean       (ALURE_APIENTRY *LPALUREREWINDSTREAM)(alureStream*);
138 typedef ALboolean       (ALURE_APIENTRY *LPALURESETSTREAMORDER)(alureStream*,ALuint);
139 typedef ALboolean       (ALURE_APIENTRY *LPALURESETSTREAMPATCHSET)(alureStream*,const ALchar*);
140 typedef ALboolean       (ALURE_APIENTRY *LPALUREDESTROYSTREAM)(alureStream*,ALsizei,ALuint*);
141 typedef void            (ALURE_APIENTRY *LPALUREUPDATE)(void);
142 typedef ALboolean       (ALURE_APIENTRY *LPALUREUPDATEINTERVAL)(ALfloat);
143 typedef ALboolean       (ALURE_APIENTRY *LPALUREPLAYSOURCESTREAM)(ALuint,alureStream*,ALsizei,ALsizei,void(*)(void*,ALuint),void*);
144 typedef ALboolean       (ALURE_APIENTRY *LPALUREPLAYSOURCE)(ALuint,void(*)(void*,ALuint),void*);
145 typedef ALboolean       (ALURE_APIENTRY *LPALURESTOPSOURCE)(ALuint,ALboolean);
146 typedef ALboolean       (ALURE_APIENTRY *LPALUREPAUSESOURCE)(ALuint);
147 typedef ALboolean       (ALURE_APIENTRY *LPALURERESUMESOURCE)(ALuint);
148 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*));
149 typedef ALboolean       (ALURE_APIENTRY *LPALURESETIOCALLBACKS)(void*(*)(const char*,ALuint),void(*)(void*),ALsizei(*)(void*,ALubyte*,ALuint),ALsizei(*)(void*,const ALubyte*,ALuint),alureInt64(*)(void*,alureInt64,int));
150 typedef void*           (ALURE_APIENTRY *LPALUREGETPROCADDRESS)(const ALchar*);
151
152 #if defined(__cplusplus)
153 }  /* extern "C" */
154 #endif
155
156 #endif /* AL_ALURE_H */