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 LoadData(ALBuf
, data
, size
, freq
, format
, AL_FORMAT_MONO16
);
281 case AL_FORMAT_MONO16
:
282 LoadData(ALBuf
, data
, size
, freq
, format
, AL_FORMAT_MONO16
);
285 case AL_FORMAT_MONO_FLOAT32
:
286 LoadData(ALBuf
, data
, size
, freq
, format
, AL_FORMAT_MONO16
);
289 case AL_FORMAT_STEREO8
:
290 LoadData(ALBuf
, data
, size
, freq
, format
, AL_FORMAT_STEREO16
);
293 case AL_FORMAT_STEREO16
:
294 LoadData(ALBuf
, data
, size
, freq
, format
, AL_FORMAT_STEREO16
);
297 case AL_FORMAT_STEREO_FLOAT32
:
298 LoadData(ALBuf
, data
, size
, freq
, format
, AL_FORMAT_STEREO16
);
301 case AL_FORMAT_MONO_IMA4
:
302 // Here is where things vary:
303 // nVidia and Apple use 64+1 samples per block => block_size=36 bytes
304 // Most PC sound software uses 2040+1 samples per block -> block_size=1024 bytes
307 // Allocate 8 extra samples (16 bytes)
308 ALBuf
->data
=realloc(ALBuf
->data
,16+(size
/36)*(65*sizeof(ALshort
)));
311 ALBuf
->format
= AL_FORMAT_MONO16
;
312 ALBuf
->eOriginalFormat
= AL_FORMAT_MONO_IMA4
;
313 IMAData
=(ALuint
*)data
;
314 for (i
=0;i
<size
/36;i
++)
316 Sample
=((ALshort
*)IMAData
)[0];
317 Index
=((ALshort
*)IMAData
)[1];
319 Index
=Index
<0?0:Index
;
320 Index
=Index
>88?88:Index
;
322 ALBuf
->data
[i
*65]=(short)Sample
;
331 Sample
+=((g_IMAStep_size
[Index
]*g_IMACodeword_4
[IMACode
&15])/8);
332 Index
+=g_IMAIndex_adjust_4
[IMACode
&15];
333 if (Sample
<-32768) Sample
=-32768;
334 else if (Sample
>32767) Sample
=32767;
335 if (Index
<0) Index
=0;
336 else if (Index
>88) Index
=88;
337 ALBuf
->data
[i
*65+j
+k
]=(short)Sample
;
340 Sample
+=((g_IMAStep_size
[Index
]*g_IMACodeword_4
[IMACode
&15])/8);
341 Index
+=g_IMAIndex_adjust_4
[IMACode
&15];
342 if (Sample
<-32768) Sample
=-32768;
343 else if (Sample
>32767) Sample
=32767;
344 if (Index
<0) Index
=0;
345 else if (Index
>88) Index
=88;
346 ALBuf
->data
[i
*65+j
+k
+1]=(short)Sample
;
352 memset(&(ALBuf
->data
[(size
/36*65)]), 0, 16);
353 ALBuf
->size
=size
/36*65*sizeof(ALshort
);
354 ALBuf
->frequency
=freq
;
357 alSetError(AL_OUT_OF_MEMORY
);
360 alSetError(AL_INVALID_VALUE
);
363 case AL_FORMAT_STEREO_IMA4
:
364 // Here is where things vary:
365 // nVidia and Apple use 64+1 samples per channel per block => block_size=72 bytes
366 // Most PC sound software uses 2040+1 samples per channel per block -> block_size=2048 bytes
369 // Allocate 8 extra samples (32 bytes)
370 ALBuf
->data
=realloc(ALBuf
->data
,32+(size
/72)*(2*65*sizeof(ALshort
)));
373 ALBuf
->format
= AL_FORMAT_STEREO16
;
374 ALBuf
->eOriginalFormat
= AL_FORMAT_STEREO_IMA4
;
375 IMAData
=(ALuint
*)data
;
376 for (i
=0;i
<size
/72;i
++)
378 LeftSample
=((ALshort
*)IMAData
)[0];
379 LeftIndex
=((ALshort
*)IMAData
)[1];
381 LeftIndex
=LeftIndex
<0?0:LeftIndex
;
382 LeftIndex
=LeftIndex
>88?88:LeftIndex
;
384 ALBuf
->data
[i
*2*65]=(short)LeftSample
;
388 RightSample
=((ALshort
*)IMAData
)[0];
389 RightIndex
=((ALshort
*)IMAData
)[1];
391 RightIndex
=RightIndex
<0?0:RightIndex
;
392 RightIndex
=RightIndex
>88?88:RightIndex
;
394 ALBuf
->data
[i
*2*65+1]=(short)RightSample
;
398 for (j
=2;j
<130;j
+=16)
400 LeftIMACode
=IMAData
[0];
401 RightIMACode
=IMAData
[1];
404 LeftSample
+=((g_IMAStep_size
[LeftIndex
]*g_IMACodeword_4
[LeftIMACode
&15])/8);
405 LeftIndex
+=g_IMAIndex_adjust_4
[LeftIMACode
&15];
406 if (LeftSample
<-32768) LeftSample
=-32768;
407 else if (LeftSample
>32767) LeftSample
=32767;
408 if (LeftIndex
<0) LeftIndex
=0;
409 else if (LeftIndex
>88) LeftIndex
=88;
410 ALBuf
->data
[i
*2*65+j
+k
]=(short)LeftSample
;
413 RightSample
+=((g_IMAStep_size
[RightIndex
]*g_IMACodeword_4
[RightIMACode
&15])/8);
414 RightIndex
+=g_IMAIndex_adjust_4
[RightIMACode
&15];
415 if (RightSample
<-32768) RightSample
=-32768;
416 else if (RightSample
>32767) RightSample
=32767;
417 if (RightIndex
<0) RightIndex
=0;
418 else if (RightIndex
>88) RightIndex
=88;
419 ALBuf
->data
[i
*2*65+j
+k
+1]=(short)RightSample
;
422 LeftSample
+=((g_IMAStep_size
[LeftIndex
]*g_IMACodeword_4
[LeftIMACode
&15])/8);
423 LeftIndex
+=g_IMAIndex_adjust_4
[LeftIMACode
&15];
424 if (LeftSample
<-32768) LeftSample
=-32768;
425 else if (LeftSample
>32767) LeftSample
=32767;
426 if (LeftIndex
<0) LeftIndex
=0;
427 else if (LeftIndex
>88) LeftIndex
=88;
428 ALBuf
->data
[i
*2*65+j
+k
+2]=(short)LeftSample
;
431 RightSample
+=((g_IMAStep_size
[RightIndex
]*g_IMACodeword_4
[RightIMACode
&15])/8);
432 RightIndex
+=g_IMAIndex_adjust_4
[RightIMACode
&15];
433 if (RightSample
<-32768) RightSample
=-32768;
434 else if (RightSample
>32767) RightSample
=32767;
435 if (RightIndex
<0) RightIndex
=0;
436 else if (RightIndex
>88) RightIndex
=88;
437 ALBuf
->data
[i
*2*65+j
+k
+3]=(short)RightSample
;
443 memset(&(ALBuf
->data
[(size
/72*2*65)]), 0, 32);
444 ALBuf
->size
=size
/72*2*65*sizeof(ALshort
);
445 ALBuf
->frequency
=freq
;
448 alSetError(AL_OUT_OF_MEMORY
);
451 alSetError(AL_INVALID_VALUE
);
455 alSetError(AL_INVALID_ENUM
);
461 // Buffer is in use, or data is a NULL pointer
462 alSetError(AL_INVALID_VALUE
);
467 // Invalid Buffer Name
468 alSetError(AL_INVALID_NAME
);
471 ProcessContext(Context
);
475 ALAPI
void ALAPIENTRY
alBufferf(ALuint buffer
, ALenum eParam
, ALfloat flValue
)
477 ALCcontext
*pContext
;
481 pContext
= alcGetCurrentContext();
482 SuspendContext(pContext
);
484 if (alIsBuffer(buffer
) && (buffer
!= 0))
489 alSetError(AL_INVALID_ENUM
);
495 alSetError(AL_INVALID_NAME
);
498 ProcessContext(pContext
);
502 ALAPI
void ALAPIENTRY
alBuffer3f(ALuint buffer
, ALenum eParam
, ALfloat flValue1
, ALfloat flValue2
, ALfloat flValue3
)
504 ALCcontext
*pContext
;
510 pContext
= alcGetCurrentContext();
511 SuspendContext(pContext
);
513 if (alIsBuffer(buffer
) && (buffer
!= 0))
518 alSetError(AL_INVALID_ENUM
);
524 alSetError(AL_INVALID_NAME
);
527 ProcessContext(pContext
);
531 ALAPI
void ALAPIENTRY
alBufferfv(ALuint buffer
, ALenum eParam
, const ALfloat
* flValues
)
533 ALCcontext
*pContext
;
537 pContext
= alcGetCurrentContext();
538 SuspendContext(pContext
);
540 if (alIsBuffer(buffer
) && (buffer
!= 0))
545 alSetError(AL_INVALID_ENUM
);
551 alSetError(AL_INVALID_NAME
);
554 ProcessContext(pContext
);
558 ALAPI
void ALAPIENTRY
alBufferi(ALuint buffer
, ALenum eParam
, ALint lValue
)
560 ALCcontext
*pContext
;
564 pContext
= alcGetCurrentContext();
565 SuspendContext(pContext
);
567 if (alIsBuffer(buffer
) && (buffer
!= 0))
572 alSetError(AL_INVALID_ENUM
);
578 alSetError(AL_INVALID_NAME
);
581 ProcessContext(pContext
);
585 ALAPI
void ALAPIENTRY
alBuffer3i( ALuint buffer
, ALenum eParam
, ALint lValue1
, ALint lValue2
, ALint lValue3
)
587 ALCcontext
*pContext
;
593 pContext
= alcGetCurrentContext();
594 SuspendContext(pContext
);
596 if (alIsBuffer(buffer
) && (buffer
!= 0))
601 alSetError(AL_INVALID_ENUM
);
607 alSetError(AL_INVALID_NAME
);
610 ProcessContext(pContext
);
614 ALAPI
void ALAPIENTRY
alBufferiv(ALuint buffer
, ALenum eParam
, const ALint
* plValues
)
616 ALCcontext
*pContext
;
620 pContext
= alcGetCurrentContext();
621 SuspendContext(pContext
);
623 if (alIsBuffer(buffer
) && (buffer
!= 0))
628 alSetError(AL_INVALID_ENUM
);
634 alSetError(AL_INVALID_NAME
);
637 ProcessContext(pContext
);
641 ALAPI ALvoid ALAPIENTRY
alGetBufferf(ALuint buffer
, ALenum eParam
, ALfloat
*pflValue
)
643 ALCcontext
*pContext
;
645 pContext
= alcGetCurrentContext();
646 SuspendContext(pContext
);
650 if (alIsBuffer(buffer
) && (buffer
!= 0))
655 alSetError(AL_INVALID_ENUM
);
661 alSetError(AL_INVALID_NAME
);
666 alSetError(AL_INVALID_VALUE
);
669 ProcessContext(pContext
);
673 ALAPI
void ALAPIENTRY
alGetBuffer3f(ALuint buffer
, ALenum eParam
, ALfloat
* pflValue1
, ALfloat
* pflValue2
, ALfloat
* pflValue3
)
675 ALCcontext
*pContext
;
677 pContext
= alcGetCurrentContext();
678 SuspendContext(pContext
);
680 if ((pflValue1
) && (pflValue2
) && (pflValue3
))
682 if (alIsBuffer(buffer
) && (buffer
!= 0))
687 alSetError(AL_INVALID_ENUM
);
693 alSetError(AL_INVALID_NAME
);
698 alSetError(AL_INVALID_VALUE
);
701 ProcessContext(pContext
);
705 ALAPI
void ALAPIENTRY
alGetBufferfv(ALuint buffer
, ALenum eParam
, ALfloat
* pflValues
)
707 ALCcontext
*pContext
;
709 pContext
= alcGetCurrentContext();
710 SuspendContext(pContext
);
714 if (alIsBuffer(buffer
) && (buffer
!= 0))
719 alSetError(AL_INVALID_ENUM
);
725 alSetError(AL_INVALID_NAME
);
730 alSetError(AL_INVALID_VALUE
);
733 ProcessContext(pContext
);
737 ALAPI ALvoid ALAPIENTRY
alGetBufferi(ALuint buffer
, ALenum eParam
, ALint
*plValue
)
739 ALCcontext
*pContext
;
742 pContext
= alcGetCurrentContext();
743 SuspendContext(pContext
);
747 if (alIsBuffer(buffer
) && (buffer
!= 0))
749 pBuffer
= ((ALbuffer
*)ALTHUNK_LOOKUPENTRY(buffer
));
754 *plValue
= pBuffer
->frequency
;
758 *plValue
= aluBytesFromFormat(pBuffer
->format
) * 8;
762 *plValue
= aluChannelsFromFormat(pBuffer
->format
);
766 *plValue
= pBuffer
->size
;
770 alSetError(AL_INVALID_ENUM
);
776 alSetError(AL_INVALID_NAME
);
781 alSetError(AL_INVALID_VALUE
);
784 ProcessContext(pContext
);
788 ALAPI
void ALAPIENTRY
alGetBuffer3i(ALuint buffer
, ALenum eParam
, ALint
* plValue1
, ALint
* plValue2
, ALint
* plValue3
)
790 ALCcontext
*pContext
;
792 pContext
= alcGetCurrentContext();
793 SuspendContext(pContext
);
795 if ((plValue1
) && (plValue2
) && (plValue3
))
797 if (alIsBuffer(buffer
) && (buffer
!= 0))
802 alSetError(AL_INVALID_ENUM
);
808 alSetError(AL_INVALID_NAME
);
813 alSetError(AL_INVALID_VALUE
);
816 ProcessContext(pContext
);
820 ALAPI
void ALAPIENTRY
alGetBufferiv(ALuint buffer
, ALenum eParam
, ALint
* plValues
)
822 ALCcontext
*pContext
;
824 pContext
= alcGetCurrentContext();
825 SuspendContext(pContext
);
829 if (alIsBuffer(buffer
) && (buffer
!= 0))
837 alGetBufferi(buffer
, eParam
, plValues
);
841 alSetError(AL_INVALID_ENUM
);
847 alSetError(AL_INVALID_NAME
);
852 alSetError(AL_INVALID_VALUE
);
855 ProcessContext(pContext
);
861 * Loads the specified data into the buffer, using the specified formats.
862 * Currently, the new format must be 16-bit, and must have the same channel
863 * configuration as the original format. This does NOT handle compressed
864 * formats (eg. IMA4).
866 static void LoadData(ALbuffer
*ALBuf
, const ALubyte
*data
, ALsizei size
, ALuint freq
, ALenum OrigFormat
, ALenum NewFormat
)
868 ALuint NewChannels
= aluChannelsFromFormat(NewFormat
);
869 ALuint OrigBytes
= aluBytesFromFormat(OrigFormat
);
870 ALuint OrigChannels
= aluChannelsFromFormat(OrigFormat
);
873 assert(aluBytesFromFormat(NewFormat
) == 2);
874 assert(NewChannels
== OrigChannels
);
876 if ((size
%(OrigBytes
*OrigChannels
)) != 0)
878 alSetError(AL_INVALID_VALUE
);
885 size
/= sizeof(ALubyte
);
887 // 8bit Samples are converted to 16 bit here
888 // Allocate 8 extra samples
889 ALBuf
->data
= realloc(ALBuf
->data
, (8*NewChannels
+ size
) * (1*sizeof(ALshort
)));
892 for (i
= 0;i
< size
;i
++)
893 ALBuf
->data
[i
] = (ALshort
)((data
[i
]-128) << 8);
894 memset(&(ALBuf
->data
[size
]), 0, 16*NewChannels
);
896 ALBuf
->format
= NewFormat
;
897 ALBuf
->eOriginalFormat
= OrigFormat
;
898 ALBuf
->size
= size
*1*sizeof(ALshort
);
899 ALBuf
->frequency
= freq
;
902 alSetError(AL_OUT_OF_MEMORY
);
906 size
/= sizeof(ALshort
);
908 // Allocate 8 extra samples
909 ALBuf
->data
= realloc(ALBuf
->data
, (8*NewChannels
+ size
) * (1*sizeof(ALshort
)));
912 memcpy(ALBuf
->data
, data
, size
*1*sizeof(ALshort
));
913 memset(&(ALBuf
->data
[size
]), 0, 16*NewChannels
);
915 ALBuf
->format
= NewFormat
;
916 ALBuf
->eOriginalFormat
= OrigFormat
;
917 ALBuf
->size
= size
*1*sizeof(ALshort
);
918 ALBuf
->frequency
= freq
;
921 alSetError(AL_OUT_OF_MEMORY
);
925 size
/= sizeof(ALfloat
);
927 // Allocate 8 extra samples
928 ALBuf
->data
= realloc(ALBuf
->data
, (8*NewChannels
+ size
) * (1*sizeof(ALshort
)));
931 for (i
= 0;i
< size
;i
++)
932 ALBuf
->data
[i
] = (ALshort
)(((ALfloat
*)data
)[i
] * 32767.5f
- 0.5);
933 memset(&(ALBuf
->data
[size
]), 0, 16*NewChannels
);
935 ALBuf
->format
= NewFormat
;
936 ALBuf
->eOriginalFormat
= OrigFormat
;
937 ALBuf
->size
= size
*1*sizeof(ALshort
);
938 ALBuf
->frequency
= freq
;
941 alSetError(AL_OUT_OF_MEMORY
);
953 * INTERNAL FN : Called by DLLMain on exit to destroy any buffers that still exist
955 ALvoid
ReleaseALBuffers(ALvoid
)
958 ALbuffer
*ALBufferTemp
;
961 if(g_uiBufferCount
> 0)
962 AL_PRINT("exit() %d Buffer(s) NOT deleted\n", g_uiBufferCount
);
965 ALBuffer
= g_pBuffers
;
968 // Release sample data
969 free(ALBuffer
->data
);
971 // Release Buffer structure
972 ALBufferTemp
= ALBuffer
;
973 ALBuffer
= ALBuffer
->next
;
974 memset(ALBufferTemp
, 0, sizeof(ALbuffer
));