zenilib  0.5.3.0
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Properties Friends Macros Groups Pages
alhelpers.h
Go to the documentation of this file.
1 #ifndef ALHELPERS_H
2 #define ALHELPERS_H
3 
4 #ifndef _WIN32
5 #include <unistd.h>
6 #define Sleep(x) usleep((x)*1000)
7 #else
8 #define WIN32_LEAN_AND_MEAN
9 #include <windows.h>
10 #endif
11 
12 #ifdef __cplusplus
13 extern "C" {
14 #endif /* __cplusplus */
15 
16 /* Some helper functions to get the name from the channel and type enums. */
17 const char *ChannelsName(ALenum chans);
18 const char *TypeName(ALenum type);
19 
20 /* Helpers to convert frame counts and byte lengths. */
22 ALsizei BytesToFrames(ALsizei size, ALenum channels, ALenum type);
23 
24 /* Retrieves a compatible buffer format given the channel configuration and
25  * sample type. If an alIsBufferFormatSupportedSOFT-compatible function is
26  * provided, it will be called to find the closest-matching format from
27  * AL_SOFT_buffer_samples. Returns AL_NONE (0) if no supported format can be
28  * found. */
29 ALenum GetFormat(ALenum channels, ALenum type, LPALISBUFFERFORMATSUPPORTEDSOFT palIsBufferFormatSupportedSOFT);
30 
31 /* Loads samples into a buffer using the standard alBufferData call, but with a
32  * LPALBUFFERSAMPLESSOFT-compatible prototype. Assumes internalformat is valid
33  * for alBufferData, and that channels and type match it. */
36  ALenum channels, ALenum type,
37  const ALvoid *data);
38 
39 /* Easy device init/deinit functions. InitAL returns 0 on success. */
40 int InitAL(void);
41 void CloseAL(void);
42 
43 #ifdef __cplusplus
44 }
45 #endif /* __cplusplus */
46 
47 #endif /* ALHELPERS_H */
#define AL_APIENTRY
Definition: al.h:21
void ALvoid
Definition: al.h:74
GLint GLenum GLsizei GLsizei GLsizei GLint GLenum GLenum type
Definition: gl2ext.h:845
void CloseAL(void)
Definition: alhelpers.c:71
int ALsizei
Definition: al.h:62
void AL_APIENTRY wrap_BufferSamples(ALuint buffer, ALuint samplerate, ALenum internalformat, ALsizei samples, ALenum channels, ALenum type, const ALvoid *data)
Definition: alhelpers.c:253
ALsizei FramesToBytes(ALsizei size, ALenum channels, ALenum type)
Definition: alhelpers.c:296
ALboolean(AL_APIENTRY * LPALISBUFFERFORMATSUPPORTEDSOFT)(ALenum)
Definition: alext.h:261
EGLContext EGLenum EGLClientBuffer buffer
Definition: eglext.h:87
const char * TypeName(ALenum type)
Definition: alhelpers.c:279
GLint GLenum GLsizei GLsizei GLsizei GLint GLsizei const GLvoid * data
Definition: gl2ext.h:848
GLsizei samples
Definition: gl2ext.h:970
int ALenum
Definition: al.h:65
unsigned int ALuint
Definition: al.h:59
ALsizei BytesToFrames(ALsizei size, ALenum channels, ALenum type)
Definition: alhelpers.c:324
GLint GLenum internalformat
Definition: gl2ext.h:845
ALenum GetFormat(ALenum channels, ALenum type, LPALISBUFFERFORMATSUPPORTEDSOFT palIsBufferFormatSupportedSOFT)
Definition: alhelpers.c:93
const char * ChannelsName(ALenum chans)
Definition: alhelpers.c:264
int InitAL(void)
Definition: alhelpers.c:42
GLsizei size
Definition: gl2ext.h:1467