Mercurial > audio-send
comparison 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 |
comparison
equal
deleted
inserted
replaced
-1:000000000000 | 0:f9476ff7637e |
---|---|
1 #ifndef _AL_BUFFER_H_ | |
2 #define _AL_BUFFER_H_ | |
3 | |
4 #include "AL/al.h" | |
5 | |
6 #ifdef __cplusplus | |
7 extern "C" { | |
8 #endif | |
9 | |
10 /* 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 }; | |
34 | |
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 } | |
44 | |
45 | |
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 }; | |
61 | |
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 } | |
69 | |
70 | |
71 typedef struct ALbuffer | |
72 { | |
73 ALvoid *data; | |
74 ALsizei size; | |
75 | |
76 ALsizei Frequency; | |
77 enum FmtChannels FmtChannels; | |
78 enum FmtType FmtType; | |
79 | |
80 enum UserFmtChannels OriginalChannels; | |
81 enum UserFmtType OriginalType; | |
82 ALsizei OriginalSize; | |
83 ALsizei OriginalAlign; | |
84 | |
85 ALsizei LoopStart; | |
86 ALsizei LoopEnd; | |
87 | |
88 ALuint refcount; // Number of sources using this buffer (deletion can only occur when this is 0) | |
89 | |
90 // Index to itself | |
91 ALuint buffer; | |
92 } ALbuffer; | |
93 | |
94 ALvoid ReleaseALBuffers(ALCdevice *device); | |
95 | |
96 #ifdef __cplusplus | |
97 } | |
98 #endif | |
99 | |
100 #endif |