Mercurial > audio-send
view OpenAL32/Include/alBuffer.h @ 19:22ac5a0367cd
finally, a first pass at ear.org
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Thu, 03 Nov 2011 14:54:45 -0700 |
parents | f9476ff7637e |
children |
line wrap: on
line source
1 #ifndef _AL_BUFFER_H_2 #define _AL_BUFFER_H_4 #include "AL/al.h"6 #ifdef __cplusplus7 extern "C" {8 #endif10 /* User formats */11 enum UserFmtType {12 UserFmtByte = AL_BYTE,13 UserFmtUByte = AL_UNSIGNED_BYTE,14 UserFmtShort = AL_SHORT,15 UserFmtUShort = AL_UNSIGNED_SHORT,16 UserFmtInt = AL_INT,17 UserFmtUInt = AL_UNSIGNED_INT,18 UserFmtFloat = AL_FLOAT,19 UserFmtDouble = AL_DOUBLE,20 UserFmtMulaw = AL_MULAW,21 UserFmtIMA4 = AL_IMA4,22 UserFmtByte3 = AL_BYTE3,23 UserFmtUByte3 = AL_UNSIGNED_BYTE3,24 };25 enum UserFmtChannels {26 UserFmtMono = AL_MONO,27 UserFmtStereo = AL_STEREO,28 UserFmtRear = AL_REAR,29 UserFmtQuad = AL_QUAD,30 UserFmtX51 = AL_5POINT1, /* (WFX order) */31 UserFmtX61 = AL_6POINT1, /* (WFX order) */32 UserFmtX71 = AL_7POINT1 /* (WFX order) */33 };35 ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans,36 enum UserFmtType *type);37 ALuint BytesFromUserFmt(enum UserFmtType type);38 ALuint ChannelsFromUserFmt(enum UserFmtChannels chans);39 static __inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans,40 enum UserFmtType type)41 {42 return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type);43 }46 /* Storable formats */47 enum FmtType {48 FmtByte = UserFmtByte,49 FmtShort = UserFmtShort,50 FmtFloat = UserFmtFloat,51 };52 enum FmtChannels {53 FmtMono = UserFmtMono,54 FmtStereo = UserFmtStereo,55 FmtRear = UserFmtRear,56 FmtQuad = UserFmtQuad,57 FmtX51 = UserFmtX51,58 FmtX61 = UserFmtX61,59 FmtX71 = UserFmtX71,60 };62 ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type);63 ALuint BytesFromFmt(enum FmtType type);64 ALuint ChannelsFromFmt(enum FmtChannels chans);65 static __inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type)66 {67 return ChannelsFromFmt(chans) * BytesFromFmt(type);68 }71 typedef struct ALbuffer72 {73 ALvoid *data;74 ALsizei size;76 ALsizei Frequency;77 enum FmtChannels FmtChannels;78 enum FmtType FmtType;80 enum UserFmtChannels OriginalChannels;81 enum UserFmtType OriginalType;82 ALsizei OriginalSize;83 ALsizei OriginalAlign;85 ALsizei LoopStart;86 ALsizei LoopEnd;88 ALuint refcount; // Number of sources using this buffer (deletion can only occur when this is 0)90 // Index to itself91 ALuint buffer;92 } ALbuffer;94 ALvoid ReleaseALBuffers(ALCdevice *device);96 #ifdef __cplusplus97 }98 #endif100 #endif