Cast to the pointer-to-type to increment the buffer
[openal-soft.git] / examples / common / alhelpers.h
blob62ed5be220bce0acba12133476e0fa8b3649fa46
1 #ifndef ALHELPERS_H
2 #define ALHELPERS_H
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
12 #include "AL/alc.h"
13 #include "AL/al.h"
14 #include "AL/alext.h"
16 #ifdef __cplusplus
17 extern "C" {
18 #endif /* __cplusplus */
20 /* Some helper functions to get the name from the channel and type enums. */
21 const char *ChannelsName(ALenum chans);
22 const char *TypeName(ALenum type);
24 /* Helpers to convert frame counts and byte lengths. */
25 ALsizei FramesToBytes(ALsizei size, ALenum channels, ALenum type);
26 ALsizei BytesToFrames(ALsizei size, ALenum channels, ALenum type);
28 /* Retrieves a compatible buffer format given the channel configuration and
29 * sample type. If an alIsBufferFormatSupportedSOFT-compatible function is
30 * provided, it will be called to find the closest-matching format from
31 * AL_SOFT_buffer_samples. Returns AL_NONE (0) if no supported format can be
32 * found. */
33 ALenum GetFormat(ALenum channels, ALenum type, LPALISBUFFERFORMATSUPPORTEDSOFT palIsBufferFormatSupportedSOFT);
35 /* Loads samples into a buffer using the standard alBufferData call, but with a
36 * LPALBUFFERSAMPLESSOFT-compatible prototype. Assumes internalformat is valid
37 * for alBufferData, and that channels and type match it. */
38 void AL_APIENTRY wrap_BufferSamples(ALuint buffer, ALuint samplerate,
39 ALenum internalformat, ALsizei samples,
40 ALenum channels, ALenum type,
41 const ALvoid *data);
43 /* Easy device init/deinit functions. InitAL returns 0 on success. */
44 int InitAL(void);
45 void CloseAL(void);
47 #ifdef __cplusplus
49 #endif /* __cplusplus */
51 #endif /* ALHELPERS_H */