Mercurial > audio-send
diff OpenAL32/Include/alBuffer.h @ 0:f9476ff7637e
initial forking of open-al to create multiple listeners
author | Robert McIntyre <rlm@mit.edu> |
---|---|
date | Tue, 25 Oct 2011 13:02:31 -0700 |
parents | |
children |
line wrap: on
line diff
1.1 --- /dev/null Thu Jan 01 00:00:00 1970 +0000 1.2 +++ b/OpenAL32/Include/alBuffer.h Tue Oct 25 13:02:31 2011 -0700 1.3 @@ -0,0 +1,100 @@ 1.4 +#ifndef _AL_BUFFER_H_ 1.5 +#define _AL_BUFFER_H_ 1.6 + 1.7 +#include "AL/al.h" 1.8 + 1.9 +#ifdef __cplusplus 1.10 +extern "C" { 1.11 +#endif 1.12 + 1.13 +/* User formats */ 1.14 +enum UserFmtType { 1.15 + UserFmtByte = AL_BYTE, 1.16 + UserFmtUByte = AL_UNSIGNED_BYTE, 1.17 + UserFmtShort = AL_SHORT, 1.18 + UserFmtUShort = AL_UNSIGNED_SHORT, 1.19 + UserFmtInt = AL_INT, 1.20 + UserFmtUInt = AL_UNSIGNED_INT, 1.21 + UserFmtFloat = AL_FLOAT, 1.22 + UserFmtDouble = AL_DOUBLE, 1.23 + UserFmtMulaw = AL_MULAW, 1.24 + UserFmtIMA4 = AL_IMA4, 1.25 + UserFmtByte3 = AL_BYTE3, 1.26 + UserFmtUByte3 = AL_UNSIGNED_BYTE3, 1.27 +}; 1.28 +enum UserFmtChannels { 1.29 + UserFmtMono = AL_MONO, 1.30 + UserFmtStereo = AL_STEREO, 1.31 + UserFmtRear = AL_REAR, 1.32 + UserFmtQuad = AL_QUAD, 1.33 + UserFmtX51 = AL_5POINT1, /* (WFX order) */ 1.34 + UserFmtX61 = AL_6POINT1, /* (WFX order) */ 1.35 + UserFmtX71 = AL_7POINT1 /* (WFX order) */ 1.36 +}; 1.37 + 1.38 +ALboolean DecomposeUserFormat(ALenum format, enum UserFmtChannels *chans, 1.39 + enum UserFmtType *type); 1.40 +ALuint BytesFromUserFmt(enum UserFmtType type); 1.41 +ALuint ChannelsFromUserFmt(enum UserFmtChannels chans); 1.42 +static __inline ALuint FrameSizeFromUserFmt(enum UserFmtChannels chans, 1.43 + enum UserFmtType type) 1.44 +{ 1.45 + return ChannelsFromUserFmt(chans) * BytesFromUserFmt(type); 1.46 +} 1.47 + 1.48 + 1.49 +/* Storable formats */ 1.50 +enum FmtType { 1.51 + FmtByte = UserFmtByte, 1.52 + FmtShort = UserFmtShort, 1.53 + FmtFloat = UserFmtFloat, 1.54 +}; 1.55 +enum FmtChannels { 1.56 + FmtMono = UserFmtMono, 1.57 + FmtStereo = UserFmtStereo, 1.58 + FmtRear = UserFmtRear, 1.59 + FmtQuad = UserFmtQuad, 1.60 + FmtX51 = UserFmtX51, 1.61 + FmtX61 = UserFmtX61, 1.62 + FmtX71 = UserFmtX71, 1.63 +}; 1.64 + 1.65 +ALboolean DecomposeFormat(ALenum format, enum FmtChannels *chans, enum FmtType *type); 1.66 +ALuint BytesFromFmt(enum FmtType type); 1.67 +ALuint ChannelsFromFmt(enum FmtChannels chans); 1.68 +static __inline ALuint FrameSizeFromFmt(enum FmtChannels chans, enum FmtType type) 1.69 +{ 1.70 + return ChannelsFromFmt(chans) * BytesFromFmt(type); 1.71 +} 1.72 + 1.73 + 1.74 +typedef struct ALbuffer 1.75 +{ 1.76 + ALvoid *data; 1.77 + ALsizei size; 1.78 + 1.79 + ALsizei Frequency; 1.80 + enum FmtChannels FmtChannels; 1.81 + enum FmtType FmtType; 1.82 + 1.83 + enum UserFmtChannels OriginalChannels; 1.84 + enum UserFmtType OriginalType; 1.85 + ALsizei OriginalSize; 1.86 + ALsizei OriginalAlign; 1.87 + 1.88 + ALsizei LoopStart; 1.89 + ALsizei LoopEnd; 1.90 + 1.91 + ALuint refcount; // Number of sources using this buffer (deletion can only occur when this is 0) 1.92 + 1.93 + // Index to itself 1.94 + ALuint buffer; 1.95 +} ALbuffer; 1.96 + 1.97 +ALvoid ReleaseALBuffers(ALCdevice *device); 1.98 + 1.99 +#ifdef __cplusplus 1.100 +} 1.101 +#endif 1.102 + 1.103 +#endif