annotate OpenAL32/Include/alBuffer.h @ 32:b8bc24918d63

moved ear.org into cortex
author Robert McIntyre <rlm@mit.edu>
date Sat, 04 Feb 2012 01:43:33 -0700
parents f9476ff7637e
children
rev   line source
rlm@0 1 #ifndef _AL_BUFFER_H_
rlm@0 2 #define _AL_BUFFER_H_
rlm@0 3
rlm@0 4 #include "AL/al.h"
rlm@0 5
rlm@0 6 #ifdef __cplusplus
rlm@0 7 extern "C" {
rlm@0 8 #endif
rlm@0 9
rlm@0 10 /* User formats */
rlm@0 11 enum UserFmtType {
rlm@0 12 UserFmtByte = AL_BYTE,
rlm@0 13 UserFmtUByte = AL_UNSIGNED_BYTE,
rlm@0 14 UserFmtShort = AL_SHORT,
rlm@0 15 UserFmtUShort = AL_UNSIGNED_SHORT,
rlm@0 16 UserFmtInt = AL_INT,
rlm@0 17 UserFmtUInt = AL_UNSIGNED_INT,
rlm@0 18 UserFmtFloat = AL_FLOAT,
rlm@0 19 UserFmtDouble = AL_DOUBLE,
rlm@0 20 UserFmtMulaw = AL_MULAW,
rlm@0 21 UserFmtIMA4 = AL_IMA4,
rlm@0 22 UserFmtByte3 = AL_BYTE3,
rlm@0 23 UserFmtUByte3 = AL_UNSIGNED_BYTE3,
rlm@0 24 };
rlm@0 25 enum UserFmtChannels {
rlm@0 26 UserFmtMono = AL_MONO,
rlm@0 27 UserFmtStereo = AL_STEREO,
rlm@0 28 UserFmtRear = AL_REAR,
rlm@0 29 UserFmtQuad = AL_QUAD,
rlm@0 30 UserFmtX51 = AL_5POINT1, /* (WFX order) */
rlm@0 31 UserFmtX61 = AL_6POINT1, /* (WFX order) */
rlm@0 32 UserFmtX71 = AL_7POINT1 /* (WFX order) */
rlm@0 33 };
rlm@0 34
rlm@0 35 ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans,
rlm@0 36 enum UserFmtType *type);
rlm@0 37 ALuint BytesFromUserFmt(enum UserFmtType type);
rlm@0 38 ALuint ChannelsFromUserFmt(enum UserFmtChannels chans);
rlm@0 39 static __inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans,
rlm@0 40 enum UserFmtType type)
rlm@0 41 {
rlm@0 42 return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type);
rlm@0 43 }
rlm@0 44
rlm@0 45
rlm@0 46 /* Storable formats */
rlm@0 47 enum FmtType {
rlm@0 48 FmtByte = UserFmtByte,
rlm@0 49 FmtShort = UserFmtShort,
rlm@0 50 FmtFloat = UserFmtFloat,
rlm@0 51 };
rlm@0 52 enum FmtChannels {
rlm@0 53 FmtMono = UserFmtMono,
rlm@0 54 FmtStereo = UserFmtStereo,
rlm@0 55 FmtRear = UserFmtRear,
rlm@0 56 FmtQuad = UserFmtQuad,
rlm@0 57 FmtX51 = UserFmtX51,
rlm@0 58 FmtX61 = UserFmtX61,
rlm@0 59 FmtX71 = UserFmtX71,
rlm@0 60 };
rlm@0 61
rlm@0 62 ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type);
rlm@0 63 ALuint BytesFromFmt(enum FmtType type);
rlm@0 64 ALuint ChannelsFromFmt(enum FmtChannels chans);
rlm@0 65 static __inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type)
rlm@0 66 {
rlm@0 67 return ChannelsFromFmt(chans) * BytesFromFmt(type);
rlm@0 68 }
rlm@0 69
rlm@0 70
rlm@0 71 typedef struct ALbuffer
rlm@0 72 {
rlm@0 73 ALvoid *data;
rlm@0 74 ALsizei size;
rlm@0 75
rlm@0 76 ALsizei Frequency;
rlm@0 77 enum FmtChannels FmtChannels;
rlm@0 78 enum FmtType FmtType;
rlm@0 79
rlm@0 80 enum UserFmtChannels OriginalChannels;
rlm@0 81 enum UserFmtType OriginalType;
rlm@0 82 ALsizei OriginalSize;
rlm@0 83 ALsizei OriginalAlign;
rlm@0 84
rlm@0 85 ALsizei LoopStart;
rlm@0 86 ALsizei LoopEnd;
rlm@0 87
rlm@0 88 ALuint refcount; // Number of sources using this buffer (deletion can only occur when this is 0)
rlm@0 89
rlm@0 90 // Index to itself
rlm@0 91 ALuint buffer;
rlm@0 92 } ALbuffer;
rlm@0 93
rlm@0 94 ALvoid ReleaseALBuffers(ALCdevice *device);
rlm@0 95
rlm@0 96 #ifdef __cplusplus
rlm@0 97 }
rlm@0 98 #endif
rlm@0 99
rlm@0 100 #endif