2 * OpenAL cross platform audio library
3 * Copyright (C) 1999-2007 by authors.
4 * This library is free software; you can redistribute it and/or
5 * modify it under the terms of the GNU Library General Public
6 * License as published by the Free Software Foundation; either
7 * version 2 of the License, or (at your option) any later version.
9 * This library is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12 * Library General Public License for more details.
14 * You should have received a copy of the GNU Library General Public
15 * License along with this library; if not, write to the
16 * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
17 * Boston, MA 02111-1307, USA.
18 * Or go to http://www.gnu.org/copyleft/lgpl.html
21 #define _CRT_SECURE_NO_DEPRECATE // get rid of sprintf security warnings on VS2005
32 static void LoadData(ALbuffer
*ALBuf
, const ALubyte
*data
, ALsizei size
, ALuint freq
, ALenum OrigFormat
, ALenum NewFormat
);
37 * AL Buffers are shared amoung Contexts, so we store the list of generated Buffers
38 * as a global variable in this module. (A valid context is not required to make
39 * AL Buffer function calls
47 static ALbuffer
*g_pBuffers
= NULL
; // Linked List of Buffers
48 static ALuint g_uiBufferCount
= 0; // Buffer Count
50 static const long g_IMAStep_size
[89]={ // IMA ADPCM Stepsize table
51 7, 8, 9, 10, 11, 12, 13, 14, 16, 17, 19, 21, 23, 25, 28, 31,
52 34, 37, 41, 45, 50, 55, 60, 66, 73, 80, 88, 97, 107, 118, 130, 143,
53 157, 173, 190, 209, 230, 253, 279, 307, 337, 371, 408, 449, 494, 544, 598, 658,
54 724, 796, 876, 963, 1060, 1166, 1282, 1411, 1552, 1707, 1878, 2066, 2272, 2499, 2749, 3024,
55 3327, 3660, 4026, 4428, 4871, 5358, 5894, 6484, 7132, 7845, 8630, 9493,10442,11487,12635,13899,
56 15289,16818,18500,20350,22358,24633,27086,29794,32767
59 static const long g_IMACodeword_4
[16]={ // IMA4 ADPCM Codeword decode table
60 1, 3, 5, 7, 9, 11, 13, 15,
61 -1,-3,-5,-7,-9,-11,-13,-15,
64 static const long g_IMAIndex_adjust_4
[16]={ // IMA4 ADPCM Step index adjust decode table
65 -1,-1,-1,-1, 2, 4, 6, 8,
66 -1,-1,-1,-1, 2, 4, 6, 8
70 * alGenBuffers(ALsizei n, ALuint *puiBuffers)
72 * Generates n AL Buffers, and stores the Buffers Names in the array pointed to by puiBuffers
74 ALAPI ALvoid ALAPIENTRY
alGenBuffers(ALsizei n
,ALuint
*puiBuffers
)
79 Context
= alcGetCurrentContext();
80 SuspendContext(Context
);
82 // Check that we are actually generation some Buffers
85 // Check the pointer is valid (and points to enough memory to store Buffer Names)
86 if (!IsBadWritePtr((void*)puiBuffers
, n
* sizeof(ALuint
)))
88 ALbuffer
**list
= &g_pBuffers
;
90 list
= &(*list
)->next
;
92 // Create all the new Buffers
95 *list
= calloc(1, sizeof(ALbuffer
));
98 puiBuffers
[i
] = (ALuint
)ALTHUNK_ADDENTRY(*list
);
99 (*list
)->state
= UNUSED
;
103 list
= &(*list
)->next
;
107 // If we didn't create all the Buffers, we must have run out of memory
109 alSetError(AL_OUT_OF_MEMORY
);
113 // Pointer does not point to enough memory to write Buffer names
114 alSetError(AL_INVALID_VALUE
);
118 ProcessContext(Context
);
124 * alDeleteBuffers(ALsizei n, ALuint *puiBuffers)
126 * Deletes the n AL Buffers pointed to by puiBuffers
128 ALAPI ALvoid ALAPIENTRY
alDeleteBuffers(ALsizei n
, const ALuint
*puiBuffers
)
133 ALboolean bFailed
= AL_FALSE
;
135 Context
= alcGetCurrentContext();
136 SuspendContext(Context
);
138 // Check we are actually Deleting some Buffers
141 if ((ALuint
)n
<= g_uiBufferCount
)
143 // Check that all the buffers are valid and can actually be deleted
144 for (i
= 0; i
< n
; i
++)
146 // Check for valid Buffer ID (can be NULL buffer)
147 if (alIsBuffer(puiBuffers
[i
]))
149 // If not the NULL buffer, check that the reference count is 0
150 ALBuf
= ((ALbuffer
*)ALTHUNK_LOOKUPENTRY(puiBuffers
[i
]));
153 if (ALBuf
->refcount
!= 0)
155 // Buffer still in use, cannot be deleted
156 alSetError(AL_INVALID_OPERATION
);
164 alSetError(AL_INVALID_NAME
);
169 // If all the Buffers were valid (and have Reference Counts of 0), then we can delete them
172 for (i
= 0; i
< n
; i
++)
174 ALBuf
=((ALbuffer
*)ALTHUNK_LOOKUPENTRY(puiBuffers
[i
]));
177 ALbuffer
**list
= &g_pBuffers
;
178 while(*list
&& *list
!= ALBuf
)
179 list
= &(*list
)->next
;
182 *list
= (*list
)->next
;
184 // Release the memory used to store audio data
187 // Release buffer structure
188 ALTHUNK_REMOVEENTRY(puiBuffers
[i
]);
189 memset(ALBuf
, 0, sizeof(ALbuffer
));
197 alSetError(AL_INVALID_NAME
);
200 alSetError(AL_INVALID_VALUE
);
202 ProcessContext(Context
);
209 * alIsBuffer(ALuint uiBuffer)
211 * Checks if ulBuffer is a valid Buffer Name
213 ALAPI ALboolean ALAPIENTRY
alIsBuffer(ALuint uiBuffer
)
216 ALboolean result
=AL_FALSE
;
220 Context
= alcGetCurrentContext();
221 SuspendContext(Context
);
225 TgtALBuf
= (ALbuffer
*)ALTHUNK_LOOKUPENTRY(uiBuffer
);
227 // Check through list of generated buffers for uiBuffer
231 if (ALBuf
== TgtALBuf
)
246 ProcessContext(Context
);
252 * alBufferData(ALuint buffer,ALenum format,ALvoid *data,ALsizei size,ALsizei freq)
254 * Fill buffer with audio data
256 ALAPI ALvoid ALAPIENTRY
alBufferData(ALuint buffer
,ALenum format
,const ALvoid
*data
,ALsizei size
,ALsizei freq
)
258 ALuint
*IMAData
,IMACode
;
261 ALint LeftSample
,LeftIndex
;
262 ALint RightSample
,RightIndex
;
263 ALuint LeftIMACode
,RightIMACode
;
267 Context
= alcGetCurrentContext();
268 SuspendContext(Context
);
270 if (alIsBuffer(buffer
) && (buffer
!= 0))
272 ALBuf
=((ALbuffer
*)ALTHUNK_LOOKUPENTRY(buffer
));
273 if ((ALBuf
->refcount
==0)&&(data
))
277 case AL_FORMAT_MONO8
:
278 case AL_FORMAT_MONO16
:
279 case AL_FORMAT_MONO_FLOAT32
:
280 LoadData(ALBuf
, data
, size
, freq
, format
, AL_FORMAT_MONO16
);
283 case AL_FORMAT_STEREO8
:
284 case AL_FORMAT_STEREO16
:
285 case AL_FORMAT_STEREO_FLOAT32
:
286 LoadData(ALBuf
, data
, size
, freq
, format
, AL_FORMAT_STEREO16
);
289 case AL_FORMAT_MONO_IMA4
:
290 // Here is where things vary:
291 // nVidia and Apple use 64+1 samples per block => block_size=36 bytes
292 // Most PC sound software uses 2040+1 samples per block -> block_size=1024 bytes
295 // Allocate 8 extra samples (16 bytes)
296 ALBuf
->data
=realloc(ALBuf
->data
,16+(size
/36)*(65*sizeof(ALshort
)));
299 ALBuf
->format
= AL_FORMAT_MONO16
;
300 ALBuf
->eOriginalFormat
= AL_FORMAT_MONO_IMA4
;
301 IMAData
=(ALuint
*)data
;
302 for (i
=0;i
<size
/36;i
++)
304 Sample
=((ALshort
*)IMAData
)[0];
305 Index
=((ALshort
*)IMAData
)[1];
307 Index
=Index
<0?0:Index
;
308 Index
=Index
>88?88:Index
;
310 ALBuf
->data
[i
*65]=(short)Sample
;
319 Sample
+=((g_IMAStep_size
[Index
]*g_IMACodeword_4
[IMACode
&15])/8);
320 Index
+=g_IMAIndex_adjust_4
[IMACode
&15];
321 if (Sample
<-32768) Sample
=-32768;
322 else if (Sample
>32767) Sample
=32767;
323 if (Index
<0) Index
=0;
324 else if (Index
>88) Index
=88;
325 ALBuf
->data
[i
*65+j
+k
]=(short)Sample
;
328 Sample
+=((g_IMAStep_size
[Index
]*g_IMACodeword_4
[IMACode
&15])/8);
329 Index
+=g_IMAIndex_adjust_4
[IMACode
&15];
330 if (Sample
<-32768) Sample
=-32768;
331 else if (Sample
>32767) Sample
=32767;
332 if (Index
<0) Index
=0;
333 else if (Index
>88) Index
=88;
334 ALBuf
->data
[i
*65+j
+k
+1]=(short)Sample
;
340 memset(&(ALBuf
->data
[(size
/36*65)]), 0, 16);
341 ALBuf
->size
=size
/36*65*sizeof(ALshort
);
342 ALBuf
->frequency
=freq
;
345 alSetError(AL_OUT_OF_MEMORY
);
348 alSetError(AL_INVALID_VALUE
);
351 case AL_FORMAT_STEREO_IMA4
:
352 // Here is where things vary:
353 // nVidia and Apple use 64+1 samples per channel per block => block_size=72 bytes
354 // Most PC sound software uses 2040+1 samples per channel per block -> block_size=2048 bytes
357 // Allocate 8 extra samples (32 bytes)
358 ALBuf
->data
=realloc(ALBuf
->data
,32+(size
/72)*(2*65*sizeof(ALshort
)));
361 ALBuf
->format
= AL_FORMAT_STEREO16
;
362 ALBuf
->eOriginalFormat
= AL_FORMAT_STEREO_IMA4
;
363 IMAData
=(ALuint
*)data
;
364 for (i
=0;i
<size
/72;i
++)
366 LeftSample
=((ALshort
*)IMAData
)[0];
367 LeftIndex
=((ALshort
*)IMAData
)[1];
369 LeftIndex
=LeftIndex
<0?0:LeftIndex
;
370 LeftIndex
=LeftIndex
>88?88:LeftIndex
;
372 ALBuf
->data
[i
*2*65]=(short)LeftSample
;
376 RightSample
=((ALshort
*)IMAData
)[0];
377 RightIndex
=((ALshort
*)IMAData
)[1];
379 RightIndex
=RightIndex
<0?0:RightIndex
;
380 RightIndex
=RightIndex
>88?88:RightIndex
;
382 ALBuf
->data
[i
*2*65+1]=(short)RightSample
;
386 for (j
=2;j
<130;j
+=16)
388 LeftIMACode
=IMAData
[0];
389 RightIMACode
=IMAData
[1];
392 LeftSample
+=((g_IMAStep_size
[LeftIndex
]*g_IMACodeword_4
[LeftIMACode
&15])/8);
393 LeftIndex
+=g_IMAIndex_adjust_4
[LeftIMACode
&15];
394 if (LeftSample
<-32768) LeftSample
=-32768;
395 else if (LeftSample
>32767) LeftSample
=32767;
396 if (LeftIndex
<0) LeftIndex
=0;
397 else if (LeftIndex
>88) LeftIndex
=88;
398 ALBuf
->data
[i
*2*65+j
+k
]=(short)LeftSample
;
401 RightSample
+=((g_IMAStep_size
[RightIndex
]*g_IMACodeword_4
[RightIMACode
&15])/8);
402 RightIndex
+=g_IMAIndex_adjust_4
[RightIMACode
&15];
403 if (RightSample
<-32768) RightSample
=-32768;
404 else if (RightSample
>32767) RightSample
=32767;
405 if (RightIndex
<0) RightIndex
=0;
406 else if (RightIndex
>88) RightIndex
=88;
407 ALBuf
->data
[i
*2*65+j
+k
+1]=(short)RightSample
;
410 LeftSample
+=((g_IMAStep_size
[LeftIndex
]*g_IMACodeword_4
[LeftIMACode
&15])/8);
411 LeftIndex
+=g_IMAIndex_adjust_4
[LeftIMACode
&15];
412 if (LeftSample
<-32768) LeftSample
=-32768;
413 else if (LeftSample
>32767) LeftSample
=32767;
414 if (LeftIndex
<0) LeftIndex
=0;
415 else if (LeftIndex
>88) LeftIndex
=88;
416 ALBuf
->data
[i
*2*65+j
+k
+2]=(short)LeftSample
;
419 RightSample
+=((g_IMAStep_size
[RightIndex
]*g_IMACodeword_4
[RightIMACode
&15])/8);
420 RightIndex
+=g_IMAIndex_adjust_4
[RightIMACode
&15];
421 if (RightSample
<-32768) RightSample
=-32768;
422 else if (RightSample
>32767) RightSample
=32767;
423 if (RightIndex
<0) RightIndex
=0;
424 else if (RightIndex
>88) RightIndex
=88;
425 ALBuf
->data
[i
*2*65+j
+k
+3]=(short)RightSample
;
431 memset(&(ALBuf
->data
[(size
/72*2*65)]), 0, 32);
432 ALBuf
->size
=size
/72*2*65*sizeof(ALshort
);
433 ALBuf
->frequency
=freq
;
436 alSetError(AL_OUT_OF_MEMORY
);
439 alSetError(AL_INVALID_VALUE
);
443 alSetError(AL_INVALID_ENUM
);
449 // Buffer is in use, or data is a NULL pointer
450 alSetError(AL_INVALID_VALUE
);
455 // Invalid Buffer Name
456 alSetError(AL_INVALID_NAME
);
459 ProcessContext(Context
);
463 ALAPI
void ALAPIENTRY
alBufferf(ALuint buffer
, ALenum eParam
, ALfloat flValue
)
465 ALCcontext
*pContext
;
469 pContext
= alcGetCurrentContext();
470 SuspendContext(pContext
);
472 if (alIsBuffer(buffer
) && (buffer
!= 0))
477 alSetError(AL_INVALID_ENUM
);
483 alSetError(AL_INVALID_NAME
);
486 ProcessContext(pContext
);
490 ALAPI
void ALAPIENTRY
alBuffer3f(ALuint buffer
, ALenum eParam
, ALfloat flValue1
, ALfloat flValue2
, ALfloat flValue3
)
492 ALCcontext
*pContext
;
498 pContext
= alcGetCurrentContext();
499 SuspendContext(pContext
);
501 if (alIsBuffer(buffer
) && (buffer
!= 0))
506 alSetError(AL_INVALID_ENUM
);
512 alSetError(AL_INVALID_NAME
);
515 ProcessContext(pContext
);
519 ALAPI
void ALAPIENTRY
alBufferfv(ALuint buffer
, ALenum eParam
, const ALfloat
* flValues
)
521 ALCcontext
*pContext
;
525 pContext
= alcGetCurrentContext();
526 SuspendContext(pContext
);
528 if (alIsBuffer(buffer
) && (buffer
!= 0))
533 alSetError(AL_INVALID_ENUM
);
539 alSetError(AL_INVALID_NAME
);
542 ProcessContext(pContext
);
546 ALAPI
void ALAPIENTRY
alBufferi(ALuint buffer
, ALenum eParam
, ALint lValue
)
548 ALCcontext
*pContext
;
552 pContext
= alcGetCurrentContext();
553 SuspendContext(pContext
);
555 if (alIsBuffer(buffer
) && (buffer
!= 0))
560 alSetError(AL_INVALID_ENUM
);
566 alSetError(AL_INVALID_NAME
);
569 ProcessContext(pContext
);
573 ALAPI
void ALAPIENTRY
alBuffer3i( ALuint buffer
, ALenum eParam
, ALint lValue1
, ALint lValue2
, ALint lValue3
)
575 ALCcontext
*pContext
;
581 pContext
= alcGetCurrentContext();
582 SuspendContext(pContext
);
584 if (alIsBuffer(buffer
) && (buffer
!= 0))
589 alSetError(AL_INVALID_ENUM
);
595 alSetError(AL_INVALID_NAME
);
598 ProcessContext(pContext
);
602 ALAPI
void ALAPIENTRY
alBufferiv(ALuint buffer
, ALenum eParam
, const ALint
* plValues
)
604 ALCcontext
*pContext
;
608 pContext
= alcGetCurrentContext();
609 SuspendContext(pContext
);
611 if (alIsBuffer(buffer
) && (buffer
!= 0))
616 alSetError(AL_INVALID_ENUM
);
622 alSetError(AL_INVALID_NAME
);
625 ProcessContext(pContext
);
629 ALAPI ALvoid ALAPIENTRY
alGetBufferf(ALuint buffer
, ALenum eParam
, ALfloat
*pflValue
)
631 ALCcontext
*pContext
;
633 pContext
= alcGetCurrentContext();
634 SuspendContext(pContext
);
638 if (alIsBuffer(buffer
) && (buffer
!= 0))
643 alSetError(AL_INVALID_ENUM
);
649 alSetError(AL_INVALID_NAME
);
654 alSetError(AL_INVALID_VALUE
);
657 ProcessContext(pContext
);
661 ALAPI
void ALAPIENTRY
alGetBuffer3f(ALuint buffer
, ALenum eParam
, ALfloat
* pflValue1
, ALfloat
* pflValue2
, ALfloat
* pflValue3
)
663 ALCcontext
*pContext
;
665 pContext
= alcGetCurrentContext();
666 SuspendContext(pContext
);
668 if ((pflValue1
) && (pflValue2
) && (pflValue3
))
670 if (alIsBuffer(buffer
) && (buffer
!= 0))
675 alSetError(AL_INVALID_ENUM
);
681 alSetError(AL_INVALID_NAME
);
686 alSetError(AL_INVALID_VALUE
);
689 ProcessContext(pContext
);
693 ALAPI
void ALAPIENTRY
alGetBufferfv(ALuint buffer
, ALenum eParam
, ALfloat
* pflValues
)
695 ALCcontext
*pContext
;
697 pContext
= alcGetCurrentContext();
698 SuspendContext(pContext
);
702 if (alIsBuffer(buffer
) && (buffer
!= 0))
707 alSetError(AL_INVALID_ENUM
);
713 alSetError(AL_INVALID_NAME
);
718 alSetError(AL_INVALID_VALUE
);
721 ProcessContext(pContext
);
725 ALAPI ALvoid ALAPIENTRY
alGetBufferi(ALuint buffer
, ALenum eParam
, ALint
*plValue
)
727 ALCcontext
*pContext
;
730 pContext
= alcGetCurrentContext();
731 SuspendContext(pContext
);
735 if (alIsBuffer(buffer
) && (buffer
!= 0))
737 pBuffer
= ((ALbuffer
*)ALTHUNK_LOOKUPENTRY(buffer
));
742 *plValue
= pBuffer
->frequency
;
746 *plValue
= aluBytesFromFormat(pBuffer
->format
) * 8;
750 *plValue
= aluChannelsFromFormat(pBuffer
->format
);
754 *plValue
= pBuffer
->size
;
758 alSetError(AL_INVALID_ENUM
);
764 alSetError(AL_INVALID_NAME
);
769 alSetError(AL_INVALID_VALUE
);
772 ProcessContext(pContext
);
776 ALAPI
void ALAPIENTRY
alGetBuffer3i(ALuint buffer
, ALenum eParam
, ALint
* plValue1
, ALint
* plValue2
, ALint
* plValue3
)
778 ALCcontext
*pContext
;
780 pContext
= alcGetCurrentContext();
781 SuspendContext(pContext
);
783 if ((plValue1
) && (plValue2
) && (plValue3
))
785 if (alIsBuffer(buffer
) && (buffer
!= 0))
790 alSetError(AL_INVALID_ENUM
);
796 alSetError(AL_INVALID_NAME
);
801 alSetError(AL_INVALID_VALUE
);
804 ProcessContext(pContext
);
808 ALAPI
void ALAPIENTRY
alGetBufferiv(ALuint buffer
, ALenum eParam
, ALint
* plValues
)
810 ALCcontext
*pContext
;
812 pContext
= alcGetCurrentContext();
813 SuspendContext(pContext
);
817 if (alIsBuffer(buffer
) && (buffer
!= 0))
825 alGetBufferi(buffer
, eParam
, plValues
);
829 alSetError(AL_INVALID_ENUM
);
835 alSetError(AL_INVALID_NAME
);
840 alSetError(AL_INVALID_VALUE
);
843 ProcessContext(pContext
);
849 * Loads the specified data into the buffer, using the specified formats.
850 * Currently, the new format must be 16-bit, and must have the same channel
851 * configuration as the original format. This does NOT handle compressed
852 * formats (eg. IMA4).
854 static void LoadData(ALbuffer
*ALBuf
, const ALubyte
*data
, ALsizei size
, ALuint freq
, ALenum OrigFormat
, ALenum NewFormat
)
856 ALuint NewChannels
= aluChannelsFromFormat(NewFormat
);
857 ALuint OrigBytes
= aluBytesFromFormat(OrigFormat
);
858 ALuint OrigChannels
= aluChannelsFromFormat(OrigFormat
);
861 assert(aluBytesFromFormat(NewFormat
) == 2);
862 assert(NewChannels
== OrigChannels
);
864 if ((size
%(OrigBytes
*OrigChannels
)) != 0)
866 alSetError(AL_INVALID_VALUE
);
873 size
/= sizeof(ALubyte
);
875 // 8bit Samples are converted to 16 bit here
876 // Allocate 8 extra samples
877 ALBuf
->data
= realloc(ALBuf
->data
, (8*NewChannels
+ size
) * (1*sizeof(ALshort
)));
880 for (i
= 0;i
< size
;i
++)
881 ALBuf
->data
[i
] = (ALshort
)((data
[i
]-128) << 8);
882 memset(&(ALBuf
->data
[size
]), 0, 16*NewChannels
);
884 ALBuf
->format
= NewFormat
;
885 ALBuf
->eOriginalFormat
= OrigFormat
;
886 ALBuf
->size
= size
*1*sizeof(ALshort
);
887 ALBuf
->frequency
= freq
;
890 alSetError(AL_OUT_OF_MEMORY
);
894 size
/= sizeof(ALshort
);
896 // Allocate 8 extra samples
897 ALBuf
->data
= realloc(ALBuf
->data
, (8*NewChannels
+ size
) * (1*sizeof(ALshort
)));
900 memcpy(ALBuf
->data
, data
, size
*1*sizeof(ALshort
));
901 memset(&(ALBuf
->data
[size
]), 0, 16*NewChannels
);
903 ALBuf
->format
= NewFormat
;
904 ALBuf
->eOriginalFormat
= OrigFormat
;
905 ALBuf
->size
= size
*1*sizeof(ALshort
);
906 ALBuf
->frequency
= freq
;
909 alSetError(AL_OUT_OF_MEMORY
);
913 size
/= sizeof(ALfloat
);
915 // Allocate 8 extra samples
916 ALBuf
->data
= realloc(ALBuf
->data
, (8*NewChannels
+ size
) * (1*sizeof(ALshort
)));
919 for (i
= 0;i
< size
;i
++)
920 ALBuf
->data
[i
] = (ALshort
)(((ALfloat
*)data
)[i
] * 32767.5f
- 0.5);
921 memset(&(ALBuf
->data
[size
]), 0, 16*NewChannels
);
923 ALBuf
->format
= NewFormat
;
924 ALBuf
->eOriginalFormat
= OrigFormat
;
925 ALBuf
->size
= size
*1*sizeof(ALshort
);
926 ALBuf
->frequency
= freq
;
929 alSetError(AL_OUT_OF_MEMORY
);
941 * INTERNAL FN : Called by DLLMain on exit to destroy any buffers that still exist
943 ALvoid
ReleaseALBuffers(ALvoid
)
946 ALbuffer
*ALBufferTemp
;
949 if(g_uiBufferCount
> 0)
950 AL_PRINT("exit() %d Buffer(s) NOT deleted\n", g_uiBufferCount
);
953 ALBuffer
= g_pBuffers
;
956 // Release sample data
957 free(ALBuffer
->data
);
959 // Release Buffer structure
960 ALBufferTemp
= ALBuffer
;
961 ALBuffer
= ALBuffer
->next
;
962 memset(ALBufferTemp
, 0, sizeof(ALbuffer
));