Retrieve only the playback frequency from a stream for the app
[alure.git] / include / AL / alure.h
blob2a5a7ca65a98c01e596326a3036701867a943865
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("protected")))
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 ALboolean ALURE_APIENTRY alureStreamSizeIsMicroSec(ALboolean useus);
70 ALURE_API ALuint ALURE_APIENTRY alureCreateBufferFromFile(const ALchar *fname);
71 ALURE_API ALuint ALURE_APIENTRY alureCreateBufferFromMemory(const ALubyte *data, ALsizei length);
72 ALURE_API ALboolean ALURE_APIENTRY alureBufferDataFromFile(const ALchar *fname, ALuint buffer);
73 ALURE_API ALboolean ALURE_APIENTRY alureBufferDataFromMemory(const ALubyte *fdata, ALsizei length, ALuint buffer);
75 ALURE_API alureStream* ALURE_APIENTRY alureCreateStreamFromFile(const ALchar *fname, ALsizei chunkLength, ALsizei numBufs, ALuint *bufs);
76 ALURE_API alureStream* ALURE_APIENTRY alureCreateStreamFromMemory(const ALubyte *data, ALuint length, ALsizei chunkLength, ALsizei numBufs, ALuint *bufs);
77 ALURE_API alureStream* ALURE_APIENTRY alureCreateStreamFromStaticMemory(const ALubyte *data, ALuint length, ALsizei chunkLength, ALsizei numBufs, ALuint *bufs);
78 ALURE_API alureStream* ALURE_APIENTRY alureCreateStreamFromCallback(
79 ALuint (*callback)(void *userdata, ALubyte *data, ALuint bytes),
80 void *userdata, ALenum format, ALuint samplerate,
81 ALsizei chunkLength, ALsizei numBufs, ALuint *bufs);
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 alureDestroyStream(alureStream *stream, ALsizei numBufs, ALuint *bufs);
88 ALURE_API void ALURE_APIENTRY alureUpdate(void);
89 ALURE_API ALboolean ALURE_APIENTRY alureUpdateInterval(ALfloat interval);
91 ALURE_API ALboolean ALURE_APIENTRY alurePlaySourceStream(ALuint source,
92 alureStream *stream, ALsizei numBufs, ALsizei loopcount,
93 void (*eos_callback)(void *userdata, ALuint source), void *userdata);
94 ALURE_API ALboolean ALURE_APIENTRY alurePlaySource(ALuint source,
95 void (*callback)(void *userdata, ALuint source), void *userdata);
96 ALURE_API ALboolean ALURE_APIENTRY alureStopSource(ALuint source, ALboolean run_callback);
97 ALURE_API ALboolean ALURE_APIENTRY alurePauseSource(ALuint source);
98 ALURE_API ALboolean ALURE_APIENTRY alureResumeSource(ALuint source);
99 ALURE_API alureUInt64 ALURE_APIENTRY alureGetSourceOffset(ALuint source);
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));
115 ALURE_API void* ALURE_APIENTRY alureGetProcAddress(const ALchar *funcname);
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 ALsizei (ALURE_APIENTRY *LPALUREGETSTREAMFREQUENCY)(alureStream*);
135 typedef ALsizei (ALURE_APIENTRY *LPALUREBUFFERDATAFROMSTREAM)(alureStream*,ALsizei,ALuint*);
136 typedef ALboolean (ALURE_APIENTRY *LPALUREREWINDSTREAM)(alureStream*);
137 typedef ALboolean (ALURE_APIENTRY *LPALURESETSTREAMORDER)(alureStream*,ALuint);
138 typedef ALboolean (ALURE_APIENTRY *LPALUREDESTROYSTREAM)(alureStream*,ALsizei,ALuint*);
139 typedef void (ALURE_APIENTRY *LPALUREUPDATE)(void);
140 typedef ALboolean (ALURE_APIENTRY *LPALUREUPDATEINTERVAL)(ALfloat);
141 typedef ALboolean (ALURE_APIENTRY *LPALUREPLAYSOURCESTREAM)(ALuint,alureStream*,ALsizei,ALsizei,void(*)(void*,ALuint),void*);
142 typedef ALboolean (ALURE_APIENTRY *LPALUREPLAYSOURCE)(ALuint,void(*)(void*,ALuint),void*);
143 typedef ALboolean (ALURE_APIENTRY *LPALURESTOPSOURCE)(ALuint,ALboolean);
144 typedef ALboolean (ALURE_APIENTRY *LPALUREPAUSESOURCE)(ALuint);
145 typedef ALboolean (ALURE_APIENTRY *LPALURERESUMESOURCE)(ALuint);
146 typedef alureUInt64 (ALURE_APIENTRY *LPALUREGETSOURCEOFFSET)(ALuint);
147 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*));
148 typedef ALboolean (ALURE_APIENTRY *LPALURESETIOCALLBACKS)(void*(*)(const char*,ALuint),void(*)(void*),ALsizei(*)(void*,ALubyte*,ALuint),ALsizei(*)(void*,const ALubyte*,ALuint),alureInt64(*)(void*,alureInt64,int));
149 typedef void* (ALURE_APIENTRY *LPALUREGETPROCADDRESS)(const ALchar*);
151 #if defined(__cplusplus)
152 } /* extern "C" */
153 #endif
155 #endif /* AL_ALURE_H */