12 UserFmtByte
= AL_BYTE_SOFT
,
13 UserFmtUByte
= AL_UNSIGNED_BYTE_SOFT
,
14 UserFmtShort
= AL_SHORT_SOFT
,
15 UserFmtUShort
= AL_UNSIGNED_SHORT_SOFT
,
16 UserFmtInt
= AL_INT_SOFT
,
17 UserFmtUInt
= AL_UNSIGNED_INT_SOFT
,
18 UserFmtFloat
= AL_FLOAT_SOFT
,
19 UserFmtDouble
= AL_DOUBLE_SOFT
,
20 UserFmtMulaw
= AL_MULAW_SOFT
,
21 UserFmtAlaw
= 0x10000000,
25 enum UserFmtChannels
{
26 UserFmtMono
= AL_MONO_SOFT
,
27 UserFmtStereo
= AL_STEREO_SOFT
,
28 UserFmtRear
= AL_REAR_SOFT
,
29 UserFmtQuad
= AL_QUAD_SOFT
,
30 UserFmtX51
= AL_5POINT1_SOFT
, /* (WFX order) */
31 UserFmtX61
= AL_6POINT1_SOFT
, /* (WFX order) */
32 UserFmtX71
= AL_7POINT1_SOFT
, /* (WFX order) */
33 UserFmtBFormat2D
= AL_BFORMAT2D_SOFT
, /* WXY */
34 UserFmtBFormat3D
= AL_BFORMAT3D_SOFT
, /* WXYZ */
37 ALsizei
BytesFromUserFmt(enum UserFmtType type
);
38 ALsizei
ChannelsFromUserFmt(enum UserFmtChannels chans
);
39 inline ALsizei
FrameSizeFromUserFmt(enum UserFmtChannels chans
, enum UserFmtType type
)
41 return ChannelsFromUserFmt(chans
) * BytesFromUserFmt(type
);
45 /* Storable formats */
47 FmtByte
= UserFmtByte
,
48 FmtShort
= UserFmtShort
,
49 FmtFloat
= UserFmtFloat
,
52 FmtMono
= UserFmtMono
,
53 FmtStereo
= UserFmtStereo
,
54 FmtRear
= UserFmtRear
,
55 FmtQuad
= UserFmtQuad
,
59 FmtBFormat2D
= UserFmtBFormat2D
,
60 FmtBFormat3D
= UserFmtBFormat3D
,
62 #define MAX_INPUT_CHANNELS (8)
64 ALsizei
BytesFromFmt(enum FmtType type
);
65 ALsizei
ChannelsFromFmt(enum FmtChannels chans
);
66 inline ALsizei
FrameSizeFromFmt(enum FmtChannels chans
, enum FmtType type
)
68 return ChannelsFromFmt(chans
) * BytesFromFmt(type
);
72 typedef struct ALbuffer
{
79 enum FmtChannels FmtChannels
;
83 enum UserFmtChannels OriginalChannels
;
84 enum UserFmtType OriginalType
;
86 ALsizei OriginalAlign
;
91 ATOMIC(ALsizei
) UnpackAlign
;
92 ATOMIC(ALsizei
) PackAlign
;
94 /* Number of times buffer was attached to a source (deletion can only occur when 0) */
103 ALbuffer
*NewBuffer(ALCcontext
*context
);
104 void DeleteBuffer(ALCdevice
*device
, ALbuffer
*buffer
);
106 ALenum
LoadData(ALbuffer
*buffer
, ALuint freq
, ALenum NewFormat
, ALsizei frames
, enum UserFmtChannels SrcChannels
, enum UserFmtType SrcType
, const ALvoid
*data
, ALsizei align
, ALboolean storesrc
);
108 inline void LockBuffersRead(ALCdevice
*device
)
109 { LockUIntMapRead(&device
->BufferMap
); }
110 inline void UnlockBuffersRead(ALCdevice
*device
)
111 { UnlockUIntMapRead(&device
->BufferMap
); }
112 inline void LockBuffersWrite(ALCdevice
*device
)
113 { LockUIntMapWrite(&device
->BufferMap
); }
114 inline void UnlockBuffersWrite(ALCdevice
*device
)
115 { UnlockUIntMapWrite(&device
->BufferMap
); }
117 inline struct ALbuffer
*LookupBuffer(ALCdevice
*device
, ALuint id
)
118 { return (struct ALbuffer
*)LookupUIntMapKeyNoLock(&device
->BufferMap
, id
); }
119 inline struct ALbuffer
*RemoveBuffer(ALCdevice
*device
, ALuint id
)
120 { return (struct ALbuffer
*)RemoveUIntMapKeyNoLock(&device
->BufferMap
, id
); }
122 ALvoid
ReleaseALBuffers(ALCdevice
*device
);