101 lines
2.5 KiB
C
Raw Normal View History

2007-11-13 18:02:18 -08:00
#ifndef _AL_BUFFER_H_
#define _AL_BUFFER_H_
#include "AL/al.h"
#ifdef __cplusplus
extern "C" {
#endif
2011-05-05 22:36:26 -07:00
/* User formats */
2010-12-03 22:33:41 -08:00
enum UserFmtType {
UserFmtByte = AL_BYTE,
UserFmtUByte = AL_UNSIGNED_BYTE,
UserFmtShort = AL_SHORT,
UserFmtUShort = AL_UNSIGNED_SHORT,
UserFmtInt = AL_INT,
UserFmtUInt = AL_UNSIGNED_INT,
UserFmtFloat = AL_FLOAT,
UserFmtDouble = AL_DOUBLE,
UserFmtMulaw = AL_MULAW,
2011-04-26 18:17:50 -07:00
UserFmtIMA4 = AL_IMA4,
UserFmtByte3 = AL_BYTE3,
UserFmtUByte3 = AL_UNSIGNED_BYTE3,
};
2010-12-03 22:33:41 -08:00
enum UserFmtChannels {
UserFmtMono = AL_MONO,
UserFmtStereo = AL_STEREO,
UserFmtRear = AL_REAR,
UserFmtQuad = AL_QUAD,
UserFmtX51 = AL_5POINT1, /* (WFX order) */
UserFmtX61 = AL_6POINT1, /* (WFX order) */
UserFmtX71 = AL_7POINT1 /* (WFX order) */
};
2010-12-03 22:33:41 -08:00
ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans,
enum UserFmtType *type);
ALuint BytesFromUserFmt(enum UserFmtType type);
ALuint ChannelsFromUserFmt(enum UserFmtChannels chans);
static __inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans,
enum UserFmtType type)
{
2010-12-03 22:33:41 -08:00
return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type);
}
/* Storable formats */
2010-11-26 23:42:30 -08:00
enum FmtType {
2011-05-05 18:54:10 -07:00
FmtByte = UserFmtByte,
2010-12-03 22:33:41 -08:00
FmtShort = UserFmtShort,
FmtFloat = UserFmtFloat,
2010-11-26 23:42:30 -08:00
};
enum FmtChannels {
FmtMono = UserFmtMono,
2010-12-03 22:33:41 -08:00
FmtStereo = UserFmtStereo,
FmtRear = UserFmtRear,
FmtQuad = UserFmtQuad,
FmtX51 = UserFmtX51,
FmtX61 = UserFmtX61,
FmtX71 = UserFmtX71,
2010-11-26 23:42:30 -08:00
};
ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type);
2010-11-29 15:01:27 -08:00
ALuint BytesFromFmt(enum FmtType type);
ALuint ChannelsFromFmt(enum FmtChannels chans);
static __inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type)
{
return ChannelsFromFmt(chans) * BytesFromFmt(type);
}
2010-11-26 23:42:30 -08:00
2009-08-15 09:14:08 -07:00
typedef struct ALbuffer
2007-11-13 18:02:18 -08:00
{
ALvoid *data;
2007-11-13 18:02:18 -08:00
ALsizei size;
2010-11-28 13:08:51 -08:00
ALsizei Frequency;
enum FmtChannels FmtChannels;
enum FmtType FmtType;
2010-12-03 22:33:41 -08:00
enum UserFmtChannels OriginalChannels;
enum UserFmtType OriginalType;
ALsizei OriginalSize;
ALsizei OriginalAlign;
ALsizei LoopStart;
ALsizei LoopEnd;
2007-11-13 18:02:18 -08:00
ALuint refcount; // Number of sources using this buffer (deletion can only occur when this is 0)
// Index to itself
ALuint buffer;
2007-11-13 18:02:18 -08:00
} ALbuffer;
2009-08-15 09:14:08 -07:00
ALvoid ReleaseALBuffers(ALCdevice *device);
2007-11-13 18:02:18 -08:00
#ifdef __cplusplus
}
#endif
#endif