comparison ALmixer.c @ 31:ad4eb4330fb0

Added initialized check in Begin/End interruption. Sanitized some booleans to use ALboolean/AL_TRUE/AL_FALSE.
author Eric Wing <ewing@anscamobile.com>
date Tue, 29 Mar 2011 11:16:39 -0700
parents a554e41eeb13
children 71fce7ac6e13
comparison
equal deleted inserted replaced
30:a554e41eeb13 31:ad4eb4330fb0
208 #ifdef ALMIXER_COMPILE_WITHOUT_SDL 208 #ifdef ALMIXER_COMPILE_WITHOUT_SDL
209 #include "tErrorLib.h" 209 #include "tErrorLib.h"
210 static TErrorPool* s_ALmixerErrorPool = NULL; 210 static TErrorPool* s_ALmixerErrorPool = NULL;
211 #endif 211 #endif
212 212
213 static ALboolean ALmixer_Initialized = 0; 213 static ALboolean ALmixer_Initialized = AL_FALSE;
214 /* This should be set correctly by Init */ 214 /* This should be set correctly by Init */
215 static ALuint ALmixer_Frequency_global = ALMIXER_DEFAULT_FREQUENCY; 215 static ALuint ALmixer_Frequency_global = ALMIXER_DEFAULT_FREQUENCY;
216 216
217 /* Will be initialized in Init */ 217 /* Will be initialized in Init */
218 static ALint Number_of_Channels_global = 0; 218 static ALint Number_of_Channels_global = 0;
221 221
222 #ifdef ENABLE_ALMIXER_THREADS 222 #ifdef ENABLE_ALMIXER_THREADS
223 /* This is for a simple lock system. It is not meant to be good, 223 /* This is for a simple lock system. It is not meant to be good,
224 * but just sufficient to minimize/avoid threading issues 224 * but just sufficient to minimize/avoid threading issues
225 */ 225 */
226 static ALuint g_StreamThreadEnabled = 0; 226 static ALboolean g_StreamThreadEnabled = AL_FALSE;
227 static SDL_mutex* s_simpleLock; 227 static SDL_mutex* s_simpleLock;
228 static SDL_Thread* Stream_Thread_global = NULL; 228 static SDL_Thread* Stream_Thread_global = NULL;
229 #endif /* ENABLE_ALMIXER_THREADS */ 229 #endif /* ENABLE_ALMIXER_THREADS */
230 230
231 static LinkedList* s_listOfALmixerData = NULL; 231 static LinkedList* s_listOfALmixerData = NULL;
232 232
233 /* Special stuff for iOS interruption handling */ 233 /* Special stuff for iOS interruption handling */
234 ALuint g_inInterruption = 0; 234 ALboolean g_inInterruption = AL_FALSE;
235 static ALCcontext* s_interruptionContext = NULL; 235 static ALCcontext* s_interruptionContext = NULL;
236 236
237 237
238 #ifdef __APPLE__ 238 #ifdef __APPLE__
239 static ALvoid Internal_alcMacOSXMixerOutputRate(const ALdouble sample_rate) 239 static ALvoid Internal_alcMacOSXMixerOutputRate(const ALdouble sample_rate)
4800 ALint i=0; 4800 ALint i=0;
4801 4801
4802 #ifdef ENABLE_ALMIXER_THREADS 4802 #ifdef ENABLE_ALMIXER_THREADS
4803 SDL_LockMutex(s_simpleLock); 4803 SDL_LockMutex(s_simpleLock);
4804 #endif 4804 #endif
4805 if(0 == ALmixer_Initialized) 4805 if(AL_FALSE == ALmixer_Initialized)
4806 { 4806 {
4807 #ifdef ENABLE_ALMIXER_THREADS 4807 #ifdef ENABLE_ALMIXER_THREADS
4808 SDL_UnlockMutex(s_simpleLock); 4808 SDL_UnlockMutex(s_simpleLock);
4809 #endif 4809 #endif
4810 return 0; 4810 return 0;
6192 6192
6193 static int Stream_Data_Thread_Callback(void* data) 6193 static int Stream_Data_Thread_Callback(void* data)
6194 { 6194 {
6195 ALint retval; 6195 ALint retval;
6196 6196
6197 while(g_StreamThreadEnabled) 6197 while(AL_TRUE == g_StreamThreadEnabled)
6198 { 6198 {
6199 retval = Update_ALmixer(data); 6199 retval = Update_ALmixer(data);
6200 /* 0 means that nothing needed updating and 6200 /* 0 means that nothing needed updating and
6201 * the function returned quickly 6201 * the function returned quickly
6202 */ 6202 */
6631 #endif /* __APPLE__ */ 6631 #endif /* __APPLE__ */
6632 6632
6633 6633
6634 6634
6635 6635
6636 ALmixer_Initialized = 1; 6636 ALmixer_Initialized = AL_TRUE;
6637 6637
6638 if(num_sources == 0) 6638 if(num_sources == 0)
6639 { 6639 {
6640 Number_of_Channels_global = ALMIXER_DEFAULT_NUM_CHANNELS; 6640 Number_of_Channels_global = ALMIXER_DEFAULT_NUM_CHANNELS;
6641 } 6641 }
6657 if(NULL == s_listOfALmixerData) 6657 if(NULL == s_listOfALmixerData)
6658 { 6658 {
6659 ALmixer_SetError("Couldn't create linked list"); 6659 ALmixer_SetError("Couldn't create linked list");
6660 alcDestroyContext(context); 6660 alcDestroyContext(context);
6661 alcCloseDevice(dev); 6661 alcCloseDevice(dev);
6662 ALmixer_Initialized = 0; 6662 ALmixer_Initialized = AL_FALSE;
6663 Number_of_Channels_global = 0; 6663 Number_of_Channels_global = 0;
6664 return AL_FALSE; 6664 return AL_FALSE;
6665 } 6665 }
6666 6666
6667 /* Allocate memory for the list of channels */ 6667 /* Allocate memory for the list of channels */
6670 { 6670 {
6671 ALmixer_SetError("Out of Memory for Channel List"); 6671 ALmixer_SetError("Out of Memory for Channel List");
6672 LinkedList_Free(s_listOfALmixerData); 6672 LinkedList_Free(s_listOfALmixerData);
6673 alcDestroyContext(context); 6673 alcDestroyContext(context);
6674 alcCloseDevice(dev); 6674 alcCloseDevice(dev);
6675 ALmixer_Initialized = 0; 6675 ALmixer_Initialized = AL_FALSE;
6676 Number_of_Channels_global = 0; 6676 Number_of_Channels_global = 0;
6677 return AL_FALSE; 6677 return AL_FALSE;
6678 } 6678 }
6679 6679
6680 /* Allocate memory for the list of sources that map to the channels */ 6680 /* Allocate memory for the list of sources that map to the channels */
6684 ALmixer_SetError("Out of Memory for Source Map List"); 6684 ALmixer_SetError("Out of Memory for Source Map List");
6685 free(ALmixer_Channel_List); 6685 free(ALmixer_Channel_List);
6686 LinkedList_Free(s_listOfALmixerData); 6686 LinkedList_Free(s_listOfALmixerData);
6687 alcDestroyContext(context); 6687 alcDestroyContext(context);
6688 alcCloseDevice(dev); 6688 alcCloseDevice(dev);
6689 ALmixer_Initialized = 0; 6689 ALmixer_Initialized = AL_FALSE;
6690 Number_of_Channels_global = 0; 6690 Number_of_Channels_global = 0;
6691 return AL_FALSE; 6691 return AL_FALSE;
6692 } 6692 }
6693 6693
6694 /* Create array that will hold the sources */ 6694 /* Create array that will hold the sources */
6699 free(Source_Map_List); 6699 free(Source_Map_List);
6700 free(ALmixer_Channel_List); 6700 free(ALmixer_Channel_List);
6701 LinkedList_Free(s_listOfALmixerData); 6701 LinkedList_Free(s_listOfALmixerData);
6702 alcDestroyContext(context); 6702 alcDestroyContext(context);
6703 alcCloseDevice(dev); 6703 alcCloseDevice(dev);
6704 ALmixer_Initialized = 0; 6704 ALmixer_Initialized = AL_FALSE;
6705 Number_of_Channels_global = 0; 6705 Number_of_Channels_global = 0;
6706 return AL_FALSE; 6706 return AL_FALSE;
6707 } 6707 }
6708 6708
6709 /* Clear the error state */ 6709 /* Clear the error state */
6716 free(ALmixer_Channel_List); 6716 free(ALmixer_Channel_List);
6717 free(Source_Map_List); 6717 free(Source_Map_List);
6718 LinkedList_Free(s_listOfALmixerData); 6718 LinkedList_Free(s_listOfALmixerData);
6719 alcDestroyContext(context); 6719 alcDestroyContext(context);
6720 alcCloseDevice(dev); 6720 alcCloseDevice(dev);
6721 ALmixer_Initialized = 0; 6721 ALmixer_Initialized = AL_FALSE;
6722 Number_of_Channels_global = 0; 6722 Number_of_Channels_global = 0;
6723 return AL_FALSE; 6723 return AL_FALSE;
6724 } 6724 }
6725 6725
6726 /* Initialize each channel and associate one source to one channel */ 6726 /* Initialize each channel and associate one source to one channel */
6768 free(ALmixer_Channel_List); 6768 free(ALmixer_Channel_List);
6769 free(Source_Map_List); 6769 free(Source_Map_List);
6770 LinkedList_Free(s_listOfALmixerData); 6770 LinkedList_Free(s_listOfALmixerData);
6771 alcDestroyContext(context); 6771 alcDestroyContext(context);
6772 alcCloseDevice(dev); 6772 alcCloseDevice(dev);
6773 ALmixer_Initialized = 0; 6773 ALmixer_Initialized = AL_FALSE;
6774 Number_of_Channels_global = 0; 6774 Number_of_Channels_global = 0;
6775 return AL_FALSE; 6775 return AL_FALSE;
6776 } 6776 }
6777 6777
6778 g_StreamThreadEnabled = 1; 6778 g_StreamThreadEnabled = AL_TRUE;
6779 Stream_Thread_global = SDL_CreateThread(Stream_Data_Thread_Callback, NULL); 6779 Stream_Thread_global = SDL_CreateThread(Stream_Data_Thread_Callback, NULL);
6780 if(NULL == Stream_Thread_global) 6780 if(NULL == Stream_Thread_global)
6781 { 6781 {
6782 /* SDL sets the error message already? */ 6782 /* SDL sets the error message already? */
6783 SDL_DestroyMutex(s_simpleLock); 6783 SDL_DestroyMutex(s_simpleLock);
6785 free(ALmixer_Channel_List); 6785 free(ALmixer_Channel_List);
6786 free(Source_Map_List); 6786 free(Source_Map_List);
6787 LinkedList_Free(s_listOfALmixerData); 6787 LinkedList_Free(s_listOfALmixerData);
6788 alcDestroyContext(context); 6788 alcDestroyContext(context);
6789 alcCloseDevice(dev); 6789 alcCloseDevice(dev);
6790 ALmixer_Initialized = 0; 6790 ALmixer_Initialized = AL_FALSE;
6791 Number_of_Channels_global = 0; 6791 Number_of_Channels_global = 0;
6792 g_StreamThreadEnabled = 0; 6792 g_StreamThreadEnabled = AL_FALSE;
6793 return AL_FALSE; 6793 return AL_FALSE;
6794 } 6794 }
6795 6795
6796 /* Note: Only a few platforms change the priority. See implementation for notes. */ 6796 /* Note: Only a few platforms change the priority. See implementation for notes. */
6797 Internal_LowerThreadPriority(Stream_Thread_global); 6797 Internal_LowerThreadPriority(Stream_Thread_global);
7186 ALint i; 7186 ALint i;
7187 ALenum error; 7187 ALenum error;
7188 ALuint* source; 7188 ALuint* source;
7189 7189
7190 7190
7191 ALmixer_Initialized = 1; 7191 ALmixer_Initialized = AL_TRUE;
7192 7192
7193 7193
7194 #ifdef ALMIXER_COMPILE_WITHOUT_SDL 7194 #ifdef ALMIXER_COMPILE_WITHOUT_SDL
7195 ALmixer_InitTime(); 7195 ALmixer_InitTime();
7196 7196
7234 /* Allocate memory for linked list of ALmixerData. */ 7234 /* Allocate memory for linked list of ALmixerData. */
7235 s_listOfALmixerData = LinkedList_Create(); 7235 s_listOfALmixerData = LinkedList_Create();
7236 if(NULL == s_listOfALmixerData) 7236 if(NULL == s_listOfALmixerData)
7237 { 7237 {
7238 ALmixer_SetError("Couldn't create linked list"); 7238 ALmixer_SetError("Couldn't create linked list");
7239 ALmixer_Initialized = 0; 7239 ALmixer_Initialized = AL_FALSE;
7240 Number_of_Channels_global = 0; 7240 Number_of_Channels_global = 0;
7241 return AL_FALSE; 7241 return AL_FALSE;
7242 } 7242 }
7243 7243
7244 7244
7246 ALmixer_Channel_List = (struct ALmixer_Channel*) malloc(Number_of_Channels_global * sizeof(struct ALmixer_Channel)); 7246 ALmixer_Channel_List = (struct ALmixer_Channel*) malloc(Number_of_Channels_global * sizeof(struct ALmixer_Channel));
7247 if(NULL == ALmixer_Channel_List) 7247 if(NULL == ALmixer_Channel_List)
7248 { 7248 {
7249 ALmixer_SetError("Out of Memory for Channel List"); 7249 ALmixer_SetError("Out of Memory for Channel List");
7250 LinkedList_Free(s_listOfALmixerData); 7250 LinkedList_Free(s_listOfALmixerData);
7251 ALmixer_Initialized = 0; 7251 ALmixer_Initialized = AL_FALSE;
7252 Number_of_Channels_global = 0; 7252 Number_of_Channels_global = 0;
7253 return AL_FALSE; 7253 return AL_FALSE;
7254 } 7254 }
7255 7255
7256 /* Allocate memory for the list of sources that map to the channels */ 7256 /* Allocate memory for the list of sources that map to the channels */
7258 if(NULL == Source_Map_List) 7258 if(NULL == Source_Map_List)
7259 { 7259 {
7260 ALmixer_SetError("Out of Memory for Source Map List"); 7260 ALmixer_SetError("Out of Memory for Source Map List");
7261 free(ALmixer_Channel_List); 7261 free(ALmixer_Channel_List);
7262 LinkedList_Free(s_listOfALmixerData); 7262 LinkedList_Free(s_listOfALmixerData);
7263 ALmixer_Initialized = 0; 7263 ALmixer_Initialized = AL_FALSE;
7264 Number_of_Channels_global = 0; 7264 Number_of_Channels_global = 0;
7265 return AL_FALSE; 7265 return AL_FALSE;
7266 } 7266 }
7267 7267
7268 /* Create array that will hold the sources */ 7268 /* Create array that will hold the sources */
7271 { 7271 {
7272 ALmixer_SetError("Out of Memory for sources"); 7272 ALmixer_SetError("Out of Memory for sources");
7273 free(Source_Map_List); 7273 free(Source_Map_List);
7274 free(ALmixer_Channel_List); 7274 free(ALmixer_Channel_List);
7275 LinkedList_Free(s_listOfALmixerData); 7275 LinkedList_Free(s_listOfALmixerData);
7276 ALmixer_Initialized = 0; 7276 ALmixer_Initialized = AL_FALSE;
7277 Number_of_Channels_global = 0; 7277 Number_of_Channels_global = 0;
7278 return AL_FALSE; 7278 return AL_FALSE;
7279 } 7279 }
7280 7280
7281 /* Clear the error state */ 7281 /* Clear the error state */
7286 { 7286 {
7287 ALmixer_SetError("Couldn't generate sources: %s\n", alGetString(error)); 7287 ALmixer_SetError("Couldn't generate sources: %s\n", alGetString(error));
7288 free(ALmixer_Channel_List); 7288 free(ALmixer_Channel_List);
7289 free(Source_Map_List); 7289 free(Source_Map_List);
7290 LinkedList_Free(s_listOfALmixerData); 7290 LinkedList_Free(s_listOfALmixerData);
7291 ALmixer_Initialized = 0; 7291 ALmixer_Initialized = AL_FALSE;
7292 Number_of_Channels_global = 0; 7292 Number_of_Channels_global = 0;
7293 return AL_FALSE; 7293 return AL_FALSE;
7294 } 7294 }
7295 7295
7296 /* Initialize each channel and associate one source to one channel */ 7296 /* Initialize each channel and associate one source to one channel */
7325 { 7325 {
7326 /* SDL sets the error message already? */ 7326 /* SDL sets the error message already? */
7327 free(source); 7327 free(source);
7328 free(ALmixer_Channel_List); 7328 free(ALmixer_Channel_List);
7329 free(Source_Map_List); 7329 free(Source_Map_List);
7330 ALmixer_Initialized = 0; 7330 ALmixer_Initialized = AL_FALSE;
7331 Number_of_Channels_global = 0; 7331 Number_of_Channels_global = 0;
7332 return AL_FALSE; 7332 return AL_FALSE;
7333 } 7333 }
7334 7334
7335 7335
7336 g_StreamThreadEnabled = 1; 7336 g_StreamThreadEnabled = AL_TRUE;
7337 Stream_Thread_global = SDL_CreateThread(Stream_Data_Thread_Callback, NULL); 7337 Stream_Thread_global = SDL_CreateThread(Stream_Data_Thread_Callback, NULL);
7338 if(NULL == Stream_Thread_global) 7338 if(NULL == Stream_Thread_global)
7339 { 7339 {
7340 /* SDL sets the error message already? */ 7340 /* SDL sets the error message already? */
7341 SDL_DestroyMutex(s_simpleLock); 7341 SDL_DestroyMutex(s_simpleLock);
7342 free(source); 7342 free(source);
7343 free(ALmixer_Channel_List); 7343 free(ALmixer_Channel_List);
7344 free(Source_Map_List); 7344 free(Source_Map_List);
7345 ALmixer_Initialized = 0; 7345 ALmixer_Initialized = AL_FALSE;
7346 Number_of_Channels_global = 0; 7346 Number_of_Channels_global = 0;
7347 g_StreamThreadEnabled = 0; 7347 g_StreamThreadEnabled = AL_FALSE;
7348 return AL_FALSE; 7348 return AL_FALSE;
7349 } 7349 }
7350 7350
7351 /* Note: Only a few platforms change the priority. See implementation for notes. */ 7351 /* Note: Only a few platforms change the priority. See implementation for notes. */
7352 Internal_LowerThreadPriority(Stream_Thread_global); 7352 Internal_LowerThreadPriority(Stream_Thread_global);
7363 return AL_TRUE; 7363 return AL_TRUE;
7364 } 7364 }
7365 7365
7366 void ALmixer_BeginInterruption() 7366 void ALmixer_BeginInterruption()
7367 { 7367 {
7368 if(1 == g_inInterruption) 7368 if((AL_TRUE == g_inInterruption) || (AL_FALSE == ALmixer_Initialized))
7369 { 7369 {
7370 return; 7370 return;
7371 } 7371 }
7372 #ifdef ENABLE_ALMIXER_THREADS 7372 #ifdef ENABLE_ALMIXER_THREADS
7373 /* Kill bookkeeping thread to help minimize wasted CPU resources */ 7373 /* Kill bookkeeping thread to help minimize wasted CPU resources */
7374 7374
7375 /* Is locking really necessary here? */ 7375 /* Is locking really necessary here? */
7376 /* SDL_LockMutex(s_simpleLock); */ 7376 /* SDL_LockMutex(s_simpleLock); */
7377 g_StreamThreadEnabled = 0; 7377 g_StreamThreadEnabled = AL_TRUE;
7378 /* SDL_UnlockMutex(s_simpleLock); */ 7378 /* SDL_UnlockMutex(s_simpleLock); */
7379 7379
7380 SDL_WaitThread(Stream_Thread_global, NULL); 7380 SDL_WaitThread(Stream_Thread_global, NULL);
7381 Stream_Thread_global = NULL; 7381 Stream_Thread_global = NULL;
7382 7382
7392 g_inInterruption = 1; 7392 g_inInterruption = 1;
7393 } 7393 }
7394 7394
7395 void ALmixer_EndInterruption() 7395 void ALmixer_EndInterruption()
7396 { 7396 {
7397 if(0 == g_inInterruption) 7397 if((AL_FALSE == g_inInterruption) || (AL_FALSE == ALmixer_Initialized))
7398 { 7398 {
7399 return; 7399 return;
7400 } 7400 }
7401 7401
7402 /* Note: iOS, you need to set the AudioSession active. 7402 /* Note: iOS, you need to set the AudioSession active.
7419 alcMakeContextCurrent(s_interruptionContext); 7419 alcMakeContextCurrent(s_interruptionContext);
7420 alcProcessContext(s_interruptionContext); 7420 alcProcessContext(s_interruptionContext);
7421 s_interruptionContext = NULL; 7421 s_interruptionContext = NULL;
7422 } 7422 }
7423 #ifdef ENABLE_ALMIXER_THREADS 7423 #ifdef ENABLE_ALMIXER_THREADS
7424 g_StreamThreadEnabled = 1; 7424 g_StreamThreadEnabled = AL_TRUE;
7425 7425
7426 Stream_Thread_global = SDL_CreateThread(Stream_Data_Thread_Callback, NULL); 7426 Stream_Thread_global = SDL_CreateThread(Stream_Data_Thread_Callback, NULL);
7427 if(NULL == Stream_Thread_global) 7427 if(NULL == Stream_Thread_global)
7428 { 7428 {
7429 fprintf(stderr, "Critical Error: Could not create bookkeeping thread in EndInterruption\n"); 7429 fprintf(stderr, "Critical Error: Could not create bookkeeping thread in EndInterruption\n");
7430 } 7430 }
7431 #endif 7431 #endif
7432 g_inInterruption = 0; 7432 g_inInterruption = AL_FALSE;
7433 } 7433 }
7434 7434
7435 /* Keep the return value void to allow easy use with 7435 /* Keep the return value void to allow easy use with
7436 * atexit() 7436 * atexit()
7437 */ 7437 */
7479 7479
7480 /* Shutdown everything before closing context */ 7480 /* Shutdown everything before closing context */
7481 Internal_HaltChannel(-1, AL_FALSE); 7481 Internal_HaltChannel(-1, AL_FALSE);
7482 7482
7483 /* This flag will cause the thread to terminate */ 7483 /* This flag will cause the thread to terminate */
7484 ALmixer_Initialized = 0; 7484 ALmixer_Initialized = AL_FALSE;
7485 #ifdef ENABLE_ALMIXER_THREADS 7485 #ifdef ENABLE_ALMIXER_THREADS
7486 g_StreamThreadEnabled = 0; 7486 g_StreamThreadEnabled = AL_FALSE;
7487 SDL_UnlockMutex(s_simpleLock); 7487 SDL_UnlockMutex(s_simpleLock);
7488 /* This is safe to call with NULL thread, so we don't need to do anything special for interruptions. */ 7488 /* This is safe to call with NULL thread, so we don't need to do anything special for interruptions. */
7489 SDL_WaitThread(Stream_Thread_global, NULL); 7489 SDL_WaitThread(Stream_Thread_global, NULL);
7490 Stream_Thread_global = NULL; 7490 Stream_Thread_global = NULL;
7491 7491
7492 SDL_DestroyMutex(s_simpleLock); 7492 SDL_DestroyMutex(s_simpleLock);
7493 #endif 7493 #endif
7494 g_inInterruption = 0; 7494 g_inInterruption = AL_FALSE;
7495 7495
7496 /* Delete all the OpenAL sources */ 7496 /* Delete all the OpenAL sources */
7497 for(i=0; i<Number_of_Channels_global; i++) 7497 for(i=0; i<Number_of_Channels_global; i++)
7498 { 7498 {
7499 alDeleteSources(1, &ALmixer_Channel_List[i].alsource); 7499 alDeleteSources(1, &ALmixer_Channel_List[i].alsource);
7719 } 7719 }
7720 7720
7721 7721
7722 ALint ALmixer_AllocateChannels(ALint numchans) 7722 ALint ALmixer_AllocateChannels(ALint numchans)
7723 { 7723 {
7724 if(0 == ALmixer_Initialized) 7724 if(AL_FALSE == ALmixer_Initialized)
7725 { 7725 {
7726 return -1; 7726 return -1;
7727 } 7727 }
7728 7728
7729 ALint retval; 7729 ALint retval;
7738 } 7738 }
7739 7739
7740 7740
7741 ALint ALmixer_ReserveChannels(ALint num) 7741 ALint ALmixer_ReserveChannels(ALint num)
7742 { 7742 {
7743 if(0 == ALmixer_Initialized) 7743 if(AL_FALSE == ALmixer_Initialized)
7744 { 7744 {
7745 return -1; 7745 return -1;
7746 } 7746 }
7747 7747
7748 ALint retval; 7748 ALint retval;
8302 ALmixer_Data* ALmixer_LoadSample_RW(ALmixer_RWops* rwops, const char* fileext, ALuint buffersize, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALboolean access_data) 8302 ALmixer_Data* ALmixer_LoadSample_RW(ALmixer_RWops* rwops, const char* fileext, ALuint buffersize, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALboolean access_data)
8303 { 8303 {
8304 Sound_Sample* sample = NULL; 8304 Sound_Sample* sample = NULL;
8305 Sound_AudioInfo target; 8305 Sound_AudioInfo target;
8306 8306
8307 if(0 == ALmixer_Initialized) 8307 if(AL_FALSE == ALmixer_Initialized)
8308 { 8308 {
8309 return NULL; 8309 return NULL;
8310 } 8310 }
8311 8311
8312 /* Initialize target values to defaults 8312 /* Initialize target values to defaults
8353 ALmixer_Data* ALmixer_LoadSample(const char* filename, ALuint buffersize, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALboolean access_data) 8353 ALmixer_Data* ALmixer_LoadSample(const char* filename, ALuint buffersize, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALboolean access_data)
8354 { 8354 {
8355 Sound_Sample* sample = NULL; 8355 Sound_Sample* sample = NULL;
8356 Sound_AudioInfo target; 8356 Sound_AudioInfo target;
8357 8357
8358 if(0 == ALmixer_Initialized) 8358 if(AL_FALSE == ALmixer_Initialized)
8359 { 8359 {
8360 return NULL; 8360 return NULL;
8361 } 8361 }
8362 8362
8363 /* Initialize target values to defaults 8363 /* Initialize target values to defaults
8460 ALmixer_Data* ALmixer_LoadSample_RAW_RW(ALmixer_RWops* rwops, const char* fileext, ALmixer_AudioInfo* desired, ALuint buffersize, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALboolean access_data) 8460 ALmixer_Data* ALmixer_LoadSample_RAW_RW(ALmixer_RWops* rwops, const char* fileext, ALmixer_AudioInfo* desired, ALuint buffersize, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALboolean access_data)
8461 { 8461 {
8462 Sound_Sample* sample = NULL; 8462 Sound_Sample* sample = NULL;
8463 Sound_AudioInfo sound_desired; 8463 Sound_AudioInfo sound_desired;
8464 8464
8465 if(0 == ALmixer_Initialized) 8465 if(AL_FALSE == ALmixer_Initialized)
8466 { 8466 {
8467 return NULL; 8467 return NULL;
8468 } 8468 }
8469 8469
8470 /* Rather than copying the data from struct to struct, I could just 8470 /* Rather than copying the data from struct to struct, I could just
8502 ALmixer_Data* ALmixer_LoadSample_RAW(const char* filename, ALmixer_AudioInfo* desired, ALuint buffersize, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALboolean access_data) 8502 ALmixer_Data* ALmixer_LoadSample_RAW(const char* filename, ALmixer_AudioInfo* desired, ALuint buffersize, ALboolean decode_mode_is_predecoded, ALuint max_queue_buffers, ALuint num_startup_buffers, ALboolean access_data)
8503 { 8503 {
8504 Sound_Sample* sample = NULL; 8504 Sound_Sample* sample = NULL;
8505 Sound_AudioInfo sound_desired; 8505 Sound_AudioInfo sound_desired;
8506 8506
8507 if(0 == ALmixer_Initialized) 8507 if(AL_FALSE == ALmixer_Initialized)
8508 { 8508 {
8509 return; 8509 return;
8510 } 8510 }
8511 8511
8512 /* Rather than copying the data from struct to struct, I could just 8512 /* Rather than copying the data from struct to struct, I could just
8545 if(NULL == data) 8545 if(NULL == data)
8546 { 8546 {
8547 return; 8547 return;
8548 } 8548 }
8549 8549
8550 if(0 == ALmixer_Initialized) 8550 if(AL_FALSE == ALmixer_Initialized)
8551 { 8551 {
8552 return; 8552 return;
8553 } 8553 }
8554 8554
8555 /* Bypass if in interruption event */ 8555 /* Bypass if in interruption event */
8621 /* This function will look up the source for the corresponding channel */ 8621 /* This function will look up the source for the corresponding channel */
8622 /* Must return 0 on error instead of -1 because of unsigned int */ 8622 /* Must return 0 on error instead of -1 because of unsigned int */
8623 ALuint ALmixer_GetSource(ALint channel) 8623 ALuint ALmixer_GetSource(ALint channel)
8624 { 8624 {
8625 ALuint retval; 8625 ALuint retval;
8626 if(0 == ALmixer_Initialized) 8626 if(AL_FALSE == ALmixer_Initialized)
8627 { 8627 {
8628 return 0; 8628 return 0;
8629 } 8629 }
8630 #ifdef ENABLE_ALMIXER_THREADS 8630 #ifdef ENABLE_ALMIXER_THREADS
8631 SDL_LockMutex(s_simpleLock); 8631 SDL_LockMutex(s_simpleLock);
8639 8639
8640 /* This function will look up the channel for the corresponding source */ 8640 /* This function will look up the channel for the corresponding source */
8641 ALint ALmixer_GetChannel(ALuint source) 8641 ALint ALmixer_GetChannel(ALuint source)
8642 { 8642 {
8643 ALint retval; 8643 ALint retval;
8644 if(0 == ALmixer_Initialized) 8644 if(AL_FALSE == ALmixer_Initialized)
8645 { 8645 {
8646 return -1; 8646 return -1;
8647 } 8647 }
8648 #ifdef ENABLE_ALMIXER_THREADS 8648 #ifdef ENABLE_ALMIXER_THREADS
8649 SDL_LockMutex(s_simpleLock); 8649 SDL_LockMutex(s_simpleLock);
8656 } 8656 }
8657 8657
8658 ALint ALmixer_FindFreeChannel(ALint start_channel) 8658 ALint ALmixer_FindFreeChannel(ALint start_channel)
8659 { 8659 {
8660 ALint retval; 8660 ALint retval;
8661 if(0 == ALmixer_Initialized) 8661 if(AL_FALSE == ALmixer_Initialized)
8662 { 8662 {
8663 return -1; 8663 return -1;
8664 } 8664 }
8665 #ifdef ENABLE_ALMIXER_THREADS 8665 #ifdef ENABLE_ALMIXER_THREADS
8666 SDL_LockMutex(s_simpleLock); 8666 SDL_LockMutex(s_simpleLock);
8732 8732
8733 8733
8734 ALint ALmixer_PlayChannelTimed(ALint channel, ALmixer_Data* data, ALint loops, ALint ticks) 8734 ALint ALmixer_PlayChannelTimed(ALint channel, ALmixer_Data* data, ALint loops, ALint ticks)
8735 { 8735 {
8736 ALint retval; 8736 ALint retval;
8737 if(0 == ALmixer_Initialized) 8737 if(AL_FALSE == ALmixer_Initialized)
8738 { 8738 {
8739 return -1; 8739 return -1;
8740 } 8740 }
8741 #ifdef ENABLE_ALMIXER_THREADS 8741 #ifdef ENABLE_ALMIXER_THREADS
8742 SDL_LockMutex(s_simpleLock); 8742 SDL_LockMutex(s_simpleLock);
8762 * In this event, an error message will be returned to you. 8762 * In this event, an error message will be returned to you.
8763 */ 8763 */
8764 ALuint ALmixer_PlaySourceTimed(ALuint source, ALmixer_Data* data, ALint loops, ALint ticks) 8764 ALuint ALmixer_PlaySourceTimed(ALuint source, ALmixer_Data* data, ALint loops, ALint ticks)
8765 { 8765 {
8766 ALuint retval; 8766 ALuint retval;
8767 if(0 == ALmixer_Initialized) 8767 if(AL_FALSE == ALmixer_Initialized)
8768 { 8768 {
8769 return 0; 8769 return 0;
8770 } 8770 }
8771 #ifdef ENABLE_ALMIXER_THREADS 8771 #ifdef ENABLE_ALMIXER_THREADS
8772 SDL_LockMutex(s_simpleLock); 8772 SDL_LockMutex(s_simpleLock);
8783 * or -1 for error 8783 * or -1 for error
8784 */ 8784 */
8785 ALint ALmixer_HaltChannel(ALint channel) 8785 ALint ALmixer_HaltChannel(ALint channel)
8786 { 8786 {
8787 ALint retval; 8787 ALint retval;
8788 if(0 == ALmixer_Initialized) 8788 if(AL_FALSE == ALmixer_Initialized)
8789 { 8789 {
8790 return -1; 8790 return -1;
8791 } 8791 }
8792 #ifdef ENABLE_ALMIXER_THREADS 8792 #ifdef ENABLE_ALMIXER_THREADS
8793 SDL_LockMutex(s_simpleLock); 8793 SDL_LockMutex(s_simpleLock);
8803 * or 0 for error 8803 * or 0 for error
8804 */ 8804 */
8805 ALint ALmixer_HaltSource(ALuint source) 8805 ALint ALmixer_HaltSource(ALuint source)
8806 { 8806 {
8807 ALint retval; 8807 ALint retval;
8808 if(0 == ALmixer_Initialized) 8808 if(AL_FALSE == ALmixer_Initialized)
8809 { 8809 {
8810 return -1; 8810 return -1;
8811 } 8811 }
8812 #ifdef ENABLE_ALMIXER_THREADS 8812 #ifdef ENABLE_ALMIXER_THREADS
8813 SDL_LockMutex(s_simpleLock); 8813 SDL_LockMutex(s_simpleLock);
8825 * playback. This may require samples to be halted 8825 * playback. This may require samples to be halted
8826 */ 8826 */
8827 ALboolean ALmixer_RewindData(ALmixer_Data* data) 8827 ALboolean ALmixer_RewindData(ALmixer_Data* data)
8828 { 8828 {
8829 ALboolean retval; 8829 ALboolean retval;
8830 if(0 == ALmixer_Initialized) 8830 if(AL_FALSE == ALmixer_Initialized)
8831 { 8831 {
8832 return AL_FALSE; 8832 return AL_FALSE;
8833 } 8833 }
8834 #ifdef ENABLE_ALMIXER_THREADS 8834 #ifdef ENABLE_ALMIXER_THREADS
8835 SDL_LockMutex(s_simpleLock); 8835 SDL_LockMutex(s_simpleLock);
8842 } 8842 }
8843 8843
8844 ALint ALmixer_RewindChannel(ALint channel) 8844 ALint ALmixer_RewindChannel(ALint channel)
8845 { 8845 {
8846 ALint retval; 8846 ALint retval;
8847 if(0 == ALmixer_Initialized) 8847 if(AL_FALSE == ALmixer_Initialized)
8848 { 8848 {
8849 return -1; 8849 return -1;
8850 } 8850 }
8851 #ifdef ENABLE_ALMIXER_THREADS 8851 #ifdef ENABLE_ALMIXER_THREADS
8852 SDL_LockMutex(s_simpleLock); 8852 SDL_LockMutex(s_simpleLock);
8859 } 8859 }
8860 8860
8861 ALint ALmixer_RewindSource(ALuint source) 8861 ALint ALmixer_RewindSource(ALuint source)
8862 { 8862 {
8863 ALint retval; 8863 ALint retval;
8864 if(0 == ALmixer_Initialized) 8864 if(AL_FALSE == ALmixer_Initialized)
8865 { 8865 {
8866 return -1; 8866 return -1;
8867 } 8867 }
8868 #ifdef ENABLE_ALMIXER_THREADS 8868 #ifdef ENABLE_ALMIXER_THREADS
8869 SDL_LockMutex(s_simpleLock); 8869 SDL_LockMutex(s_simpleLock);
8876 } 8876 }
8877 8877
8878 ALint ALmixer_PauseChannel(ALint channel) 8878 ALint ALmixer_PauseChannel(ALint channel)
8879 { 8879 {
8880 ALint retval; 8880 ALint retval;
8881 if(0 == ALmixer_Initialized) 8881 if(AL_FALSE == ALmixer_Initialized)
8882 { 8882 {
8883 return -1; 8883 return -1;
8884 } 8884 }
8885 #ifdef ENABLE_ALMIXER_THREADS 8885 #ifdef ENABLE_ALMIXER_THREADS
8886 SDL_LockMutex(s_simpleLock); 8886 SDL_LockMutex(s_simpleLock);
8893 } 8893 }
8894 8894
8895 ALint ALmixer_PauseSource(ALuint source) 8895 ALint ALmixer_PauseSource(ALuint source)
8896 { 8896 {
8897 ALint retval; 8897 ALint retval;
8898 if(0 == ALmixer_Initialized) 8898 if(AL_FALSE == ALmixer_Initialized)
8899 { 8899 {
8900 return -1; 8900 return -1;
8901 } 8901 }
8902 #ifdef ENABLE_ALMIXER_THREADS 8902 #ifdef ENABLE_ALMIXER_THREADS
8903 SDL_LockMutex(s_simpleLock); 8903 SDL_LockMutex(s_simpleLock);
8910 } 8910 }
8911 8911
8912 ALint ALmixer_ResumeChannel(ALint channel) 8912 ALint ALmixer_ResumeChannel(ALint channel)
8913 { 8913 {
8914 ALint retval; 8914 ALint retval;
8915 if(0 == ALmixer_Initialized) 8915 if(AL_FALSE == ALmixer_Initialized)
8916 { 8916 {
8917 return -1; 8917 return -1;
8918 } 8918 }
8919 #ifdef ENABLE_ALMIXER_THREADS 8919 #ifdef ENABLE_ALMIXER_THREADS
8920 SDL_LockMutex(s_simpleLock); 8920 SDL_LockMutex(s_simpleLock);
8927 } 8927 }
8928 8928
8929 ALint ALmixer_ResumeSource(ALuint source) 8929 ALint ALmixer_ResumeSource(ALuint source)
8930 { 8930 {
8931 ALint retval; 8931 ALint retval;
8932 if(0 == ALmixer_Initialized) 8932 if(AL_FALSE == ALmixer_Initialized)
8933 { 8933 {
8934 return -1; 8934 return -1;
8935 } 8935 }
8936 #ifdef ENABLE_ALMIXER_THREADS 8936 #ifdef ENABLE_ALMIXER_THREADS
8937 SDL_LockMutex(s_simpleLock); 8937 SDL_LockMutex(s_simpleLock);
8947 * This will allow seek to end to stay there because 8947 * This will allow seek to end to stay there because
8948 * Play automatically rewinds if at the end */ 8948 * Play automatically rewinds if at the end */
8949 ALboolean ALmixer_SeekData(ALmixer_Data* data, ALuint msec) 8949 ALboolean ALmixer_SeekData(ALmixer_Data* data, ALuint msec)
8950 { 8950 {
8951 ALboolean retval; 8951 ALboolean retval;
8952 if(0 == ALmixer_Initialized) 8952 if(AL_FALSE == ALmixer_Initialized)
8953 { 8953 {
8954 return -1; 8954 return -1;
8955 } 8955 }
8956 #ifdef ENABLE_ALMIXER_THREADS 8956 #ifdef ENABLE_ALMIXER_THREADS
8957 SDL_LockMutex(s_simpleLock); 8957 SDL_LockMutex(s_simpleLock);
8964 } 8964 }
8965 8965
8966 ALint ALmixer_SeekChannel(ALint channel, ALuint msec) 8966 ALint ALmixer_SeekChannel(ALint channel, ALuint msec)
8967 { 8967 {
8968 ALint retval; 8968 ALint retval;
8969 if(0 == ALmixer_Initialized) 8969 if(AL_FALSE == ALmixer_Initialized)
8970 { 8970 {
8971 return -1; 8971 return -1;
8972 } 8972 }
8973 #ifdef ENABLE_ALMIXER_THREADS 8973 #ifdef ENABLE_ALMIXER_THREADS
8974 SDL_LockMutex(s_simpleLock); 8974 SDL_LockMutex(s_simpleLock);
8981 } 8981 }
8982 8982
8983 ALint ALmixer_SeekSource(ALuint source, ALuint msec) 8983 ALint ALmixer_SeekSource(ALuint source, ALuint msec)
8984 { 8984 {
8985 ALint retval; 8985 ALint retval;
8986 if(0 == ALmixer_Initialized) 8986 if(AL_FALSE == ALmixer_Initialized)
8987 { 8987 {
8988 return -1; 8988 return -1;
8989 } 8989 }
8990 #ifdef ENABLE_ALMIXER_THREADS 8990 #ifdef ENABLE_ALMIXER_THREADS
8991 SDL_LockMutex(s_simpleLock); 8991 SDL_LockMutex(s_simpleLock);
8998 } 8998 }
8999 8999
9000 ALint ALmixer_FadeInChannelTimed(ALint channel, ALmixer_Data* data, ALint loops, ALuint fade_ticks, ALint expire_ticks) 9000 ALint ALmixer_FadeInChannelTimed(ALint channel, ALmixer_Data* data, ALint loops, ALuint fade_ticks, ALint expire_ticks)
9001 { 9001 {
9002 ALint retval; 9002 ALint retval;
9003 if(0 == ALmixer_Initialized) 9003 if(AL_FALSE == ALmixer_Initialized)
9004 { 9004 {
9005 return -1; 9005 return -1;
9006 } 9006 }
9007 #ifdef ENABLE_ALMIXER_THREADS 9007 #ifdef ENABLE_ALMIXER_THREADS
9008 SDL_LockMutex(s_simpleLock); 9008 SDL_LockMutex(s_simpleLock);
9015 } 9015 }
9016 9016
9017 ALuint ALmixer_FadeInSourceTimed(ALuint source, ALmixer_Data* data, ALint loops, ALuint fade_ticks, ALint expire_ticks) 9017 ALuint ALmixer_FadeInSourceTimed(ALuint source, ALmixer_Data* data, ALint loops, ALuint fade_ticks, ALint expire_ticks)
9018 { 9018 {
9019 ALuint retval; 9019 ALuint retval;
9020 if(0 == ALmixer_Initialized) 9020 if(AL_FALSE == ALmixer_Initialized)
9021 { 9021 {
9022 return 0; 9022 return 0;
9023 } 9023 }
9024 #ifdef ENABLE_ALMIXER_THREADS 9024 #ifdef ENABLE_ALMIXER_THREADS
9025 SDL_LockMutex(s_simpleLock); 9025 SDL_LockMutex(s_simpleLock);
9032 } 9032 }
9033 9033
9034 ALint ALmixer_FadeOutChannel(ALint channel, ALuint ticks) 9034 ALint ALmixer_FadeOutChannel(ALint channel, ALuint ticks)
9035 { 9035 {
9036 ALint retval; 9036 ALint retval;
9037 if(0 == ALmixer_Initialized) 9037 if(AL_FALSE == ALmixer_Initialized)
9038 { 9038 {
9039 return -1; 9039 return -1;
9040 } 9040 }
9041 #ifdef ENABLE_ALMIXER_THREADS 9041 #ifdef ENABLE_ALMIXER_THREADS
9042 SDL_LockMutex(s_simpleLock); 9042 SDL_LockMutex(s_simpleLock);
9049 } 9049 }
9050 9050
9051 ALint ALmixer_FadeOutSource(ALuint source, ALuint ticks) 9051 ALint ALmixer_FadeOutSource(ALuint source, ALuint ticks)
9052 { 9052 {
9053 ALint retval; 9053 ALint retval;
9054 if(0 == ALmixer_Initialized) 9054 if(AL_FALSE == ALmixer_Initialized)
9055 { 9055 {
9056 return 0; 9056 return 0;
9057 } 9057 }
9058 #ifdef ENABLE_ALMIXER_THREADS 9058 #ifdef ENABLE_ALMIXER_THREADS
9059 SDL_LockMutex(s_simpleLock); 9059 SDL_LockMutex(s_simpleLock);
9066 } 9066 }
9067 9067
9068 ALint ALmixer_FadeChannel(ALint channel, ALuint ticks, ALfloat volume) 9068 ALint ALmixer_FadeChannel(ALint channel, ALuint ticks, ALfloat volume)
9069 { 9069 {
9070 ALint retval; 9070 ALint retval;
9071 if(0 == ALmixer_Initialized) 9071 if(AL_FALSE == ALmixer_Initialized)
9072 { 9072 {
9073 return 0; 9073 return 0;
9074 } 9074 }
9075 #ifdef ENABLE_ALMIXER_THREADS 9075 #ifdef ENABLE_ALMIXER_THREADS
9076 SDL_LockMutex(s_simpleLock); 9076 SDL_LockMutex(s_simpleLock);
9083 } 9083 }
9084 9084
9085 ALint ALmixer_FadeSource(ALuint source, ALuint ticks, ALfloat volume) 9085 ALint ALmixer_FadeSource(ALuint source, ALuint ticks, ALfloat volume)
9086 { 9086 {
9087 ALint retval; 9087 ALint retval;
9088 if(0 == ALmixer_Initialized) 9088 if(AL_FALSE == ALmixer_Initialized)
9089 { 9089 {
9090 return -1; 9090 return -1;
9091 } 9091 }
9092 #ifdef ENABLE_ALMIXER_THREADS 9092 #ifdef ENABLE_ALMIXER_THREADS
9093 SDL_LockMutex(s_simpleLock); 9093 SDL_LockMutex(s_simpleLock);
9101 9101
9102 9102
9103 ALboolean ALmixer_SetVolumeChannel(ALint channel, ALfloat volume) 9103 ALboolean ALmixer_SetVolumeChannel(ALint channel, ALfloat volume)
9104 { 9104 {
9105 ALboolean retval; 9105 ALboolean retval;
9106 if(0 == ALmixer_Initialized) 9106 if(AL_FALSE == ALmixer_Initialized)
9107 { 9107 {
9108 return AL_FALSE; 9108 return AL_FALSE;
9109 } 9109 }
9110 #ifdef ENABLE_ALMIXER_THREADS 9110 #ifdef ENABLE_ALMIXER_THREADS
9111 SDL_LockMutex(s_simpleLock); 9111 SDL_LockMutex(s_simpleLock);
9118 } 9118 }
9119 9119
9120 ALboolean ALmixer_SetVolumeSource(ALuint source, ALfloat volume) 9120 ALboolean ALmixer_SetVolumeSource(ALuint source, ALfloat volume)
9121 { 9121 {
9122 ALboolean retval; 9122 ALboolean retval;
9123 if(0 == ALmixer_Initialized) 9123 if(AL_FALSE == ALmixer_Initialized)
9124 { 9124 {
9125 return AL_FALSE; 9125 return AL_FALSE;
9126 } 9126 }
9127 #ifdef ENABLE_ALMIXER_THREADS 9127 #ifdef ENABLE_ALMIXER_THREADS
9128 SDL_LockMutex(s_simpleLock); 9128 SDL_LockMutex(s_simpleLock);
9135 } 9135 }
9136 9136
9137 ALfloat ALmixer_GetVolumeChannel(ALint channel) 9137 ALfloat ALmixer_GetVolumeChannel(ALint channel)
9138 { 9138 {
9139 ALfloat retval; 9139 ALfloat retval;
9140 if(0 == ALmixer_Initialized) 9140 if(AL_FALSE == ALmixer_Initialized)
9141 { 9141 {
9142 return -1.0f; 9142 return -1.0f;
9143 } 9143 }
9144 #ifdef ENABLE_ALMIXER_THREADS 9144 #ifdef ENABLE_ALMIXER_THREADS
9145 SDL_LockMutex(s_simpleLock); 9145 SDL_LockMutex(s_simpleLock);
9152 } 9152 }
9153 9153
9154 ALfloat ALmixer_GetVolumeSource(ALuint source) 9154 ALfloat ALmixer_GetVolumeSource(ALuint source)
9155 { 9155 {
9156 ALfloat retval; 9156 ALfloat retval;
9157 if(0 == ALmixer_Initialized) 9157 if(AL_FALSE == ALmixer_Initialized)
9158 { 9158 {
9159 return -1.0f; 9159 return -1.0f;
9160 } 9160 }
9161 #ifdef ENABLE_ALMIXER_THREADS 9161 #ifdef ENABLE_ALMIXER_THREADS
9162 SDL_LockMutex(s_simpleLock); 9162 SDL_LockMutex(s_simpleLock);
9169 } 9169 }
9170 9170
9171 ALboolean ALmixer_SetMaxVolumeChannel(ALint channel, ALfloat volume) 9171 ALboolean ALmixer_SetMaxVolumeChannel(ALint channel, ALfloat volume)
9172 { 9172 {
9173 ALboolean retval; 9173 ALboolean retval;
9174 if(0 == ALmixer_Initialized) 9174 if(AL_FALSE == ALmixer_Initialized)
9175 { 9175 {
9176 return AL_FALSE; 9176 return AL_FALSE;
9177 } 9177 }
9178 #ifdef ENABLE_ALMIXER_THREADS 9178 #ifdef ENABLE_ALMIXER_THREADS
9179 SDL_LockMutex(s_simpleLock); 9179 SDL_LockMutex(s_simpleLock);
9186 } 9186 }
9187 9187
9188 ALboolean ALmixer_SetMaxVolumeSource(ALuint source, ALfloat volume) 9188 ALboolean ALmixer_SetMaxVolumeSource(ALuint source, ALfloat volume)
9189 { 9189 {
9190 ALboolean retval; 9190 ALboolean retval;
9191 if(0 == ALmixer_Initialized) 9191 if(AL_FALSE == ALmixer_Initialized)
9192 { 9192 {
9193 return AL_FALSE; 9193 return AL_FALSE;
9194 } 9194 }
9195 #ifdef ENABLE_ALMIXER_THREADS 9195 #ifdef ENABLE_ALMIXER_THREADS
9196 SDL_LockMutex(s_simpleLock); 9196 SDL_LockMutex(s_simpleLock);
9203 } 9203 }
9204 9204
9205 ALfloat ALmixer_GetMaxVolumeChannel(ALint channel) 9205 ALfloat ALmixer_GetMaxVolumeChannel(ALint channel)
9206 { 9206 {
9207 ALfloat retval; 9207 ALfloat retval;
9208 if(0 == ALmixer_Initialized) 9208 if(AL_FALSE == ALmixer_Initialized)
9209 { 9209 {
9210 return -1.0f; 9210 return -1.0f;
9211 } 9211 }
9212 #ifdef ENABLE_ALMIXER_THREADS 9212 #ifdef ENABLE_ALMIXER_THREADS
9213 SDL_LockMutex(s_simpleLock); 9213 SDL_LockMutex(s_simpleLock);
9220 } 9220 }
9221 9221
9222 ALfloat ALmixer_GetMaxVolumeSource(ALuint source) 9222 ALfloat ALmixer_GetMaxVolumeSource(ALuint source)
9223 { 9223 {
9224 ALfloat retval; 9224 ALfloat retval;
9225 if(0 == ALmixer_Initialized) 9225 if(AL_FALSE == ALmixer_Initialized)
9226 { 9226 {
9227 return -1.0f; 9227 return -1.0f;
9228 } 9228 }
9229 #ifdef ENABLE_ALMIXER_THREADS 9229 #ifdef ENABLE_ALMIXER_THREADS
9230 SDL_LockMutex(s_simpleLock); 9230 SDL_LockMutex(s_simpleLock);
9238 9238
9239 9239
9240 ALboolean ALmixer_SetMinVolumeChannel(ALint channel, ALfloat volume) 9240 ALboolean ALmixer_SetMinVolumeChannel(ALint channel, ALfloat volume)
9241 { 9241 {
9242 ALboolean retval; 9242 ALboolean retval;
9243 if(0 == ALmixer_Initialized) 9243 if(AL_FALSE == ALmixer_Initialized)
9244 { 9244 {
9245 return AL_FALSE; 9245 return AL_FALSE;
9246 } 9246 }
9247 #ifdef ENABLE_ALMIXER_THREADS 9247 #ifdef ENABLE_ALMIXER_THREADS
9248 SDL_LockMutex(s_simpleLock); 9248 SDL_LockMutex(s_simpleLock);
9255 } 9255 }
9256 9256
9257 ALboolean ALmixer_SetMinVolumeSource(ALuint source, ALfloat volume) 9257 ALboolean ALmixer_SetMinVolumeSource(ALuint source, ALfloat volume)
9258 { 9258 {
9259 ALboolean retval; 9259 ALboolean retval;
9260 if(0 == ALmixer_Initialized) 9260 if(AL_FALSE == ALmixer_Initialized)
9261 { 9261 {
9262 return AL_FALSE; 9262 return AL_FALSE;
9263 } 9263 }
9264 #ifdef ENABLE_ALMIXER_THREADS 9264 #ifdef ENABLE_ALMIXER_THREADS
9265 SDL_LockMutex(s_simpleLock); 9265 SDL_LockMutex(s_simpleLock);
9272 } 9272 }
9273 9273
9274 ALfloat ALmixer_GetMinVolumeChannel(ALint channel) 9274 ALfloat ALmixer_GetMinVolumeChannel(ALint channel)
9275 { 9275 {
9276 ALfloat retval; 9276 ALfloat retval;
9277 if(0 == ALmixer_Initialized) 9277 if(AL_FALSE == ALmixer_Initialized)
9278 { 9278 {
9279 return -1.0f; 9279 return -1.0f;
9280 } 9280 }
9281 #ifdef ENABLE_ALMIXER_THREADS 9281 #ifdef ENABLE_ALMIXER_THREADS
9282 SDL_LockMutex(s_simpleLock); 9282 SDL_LockMutex(s_simpleLock);
9289 } 9289 }
9290 9290
9291 ALfloat ALmixer_GetMinVolumeSource(ALuint source) 9291 ALfloat ALmixer_GetMinVolumeSource(ALuint source)
9292 { 9292 {
9293 ALfloat retval; 9293 ALfloat retval;
9294 if(0 == ALmixer_Initialized) 9294 if(AL_FALSE == ALmixer_Initialized)
9295 { 9295 {
9296 return -1.0f; 9296 return -1.0f;
9297 } 9297 }
9298 #ifdef ENABLE_ALMIXER_THREADS 9298 #ifdef ENABLE_ALMIXER_THREADS
9299 SDL_LockMutex(s_simpleLock); 9299 SDL_LockMutex(s_simpleLock);
9308 9308
9309 9309
9310 ALboolean ALmixer_SetMasterVolume(ALfloat volume) 9310 ALboolean ALmixer_SetMasterVolume(ALfloat volume)
9311 { 9311 {
9312 ALboolean retval; 9312 ALboolean retval;
9313 if(0 == ALmixer_Initialized) 9313 if(AL_FALSE == ALmixer_Initialized)
9314 { 9314 {
9315 return AL_FALSE; 9315 return AL_FALSE;
9316 } 9316 }
9317 #ifdef ENABLE_ALMIXER_THREADS 9317 #ifdef ENABLE_ALMIXER_THREADS
9318 SDL_LockMutex(s_simpleLock); 9318 SDL_LockMutex(s_simpleLock);
9325 } 9325 }
9326 9326
9327 ALfloat ALmixer_GetMasterVolume() 9327 ALfloat ALmixer_GetMasterVolume()
9328 { 9328 {
9329 ALfloat retval; 9329 ALfloat retval;
9330 if(0 == ALmixer_Initialized) 9330 if(AL_FALSE == ALmixer_Initialized)
9331 { 9331 {
9332 return -1.0f; 9332 return -1.0f;
9333 } 9333 }
9334 #ifdef ENABLE_ALMIXER_THREADS 9334 #ifdef ENABLE_ALMIXER_THREADS
9335 SDL_LockMutex(s_simpleLock); 9335 SDL_LockMutex(s_simpleLock);
9342 } 9342 }
9343 9343
9344 ALint ALmixer_ExpireChannel(ALint channel, ALint ticks) 9344 ALint ALmixer_ExpireChannel(ALint channel, ALint ticks)
9345 { 9345 {
9346 ALint retval; 9346 ALint retval;
9347 if(0 == ALmixer_Initialized) 9347 if(AL_FALSE == ALmixer_Initialized)
9348 { 9348 {
9349 return -1; 9349 return -1;
9350 } 9350 }
9351 #ifdef ENABLE_ALMIXER_THREADS 9351 #ifdef ENABLE_ALMIXER_THREADS
9352 SDL_LockMutex(s_simpleLock); 9352 SDL_LockMutex(s_simpleLock);
9359 } 9359 }
9360 9360
9361 ALint ALmixer_ExpireSource(ALuint source, ALint ticks) 9361 ALint ALmixer_ExpireSource(ALuint source, ALint ticks)
9362 { 9362 {
9363 ALint retval; 9363 ALint retval;
9364 if(0 == ALmixer_Initialized) 9364 if(AL_FALSE == ALmixer_Initialized)
9365 { 9365 {
9366 return -1; 9366 return -1;
9367 } 9367 }
9368 #ifdef ENABLE_ALMIXER_THREADS 9368 #ifdef ENABLE_ALMIXER_THREADS
9369 SDL_LockMutex(s_simpleLock); 9369 SDL_LockMutex(s_simpleLock);
9376 } 9376 }
9377 9377
9378 ALint ALmixer_IsActiveChannel(ALint channel) 9378 ALint ALmixer_IsActiveChannel(ALint channel)
9379 { 9379 {
9380 ALint retval; 9380 ALint retval;
9381 if(0 == ALmixer_Initialized) 9381 if(AL_FALSE == ALmixer_Initialized)
9382 { 9382 {
9383 return -1; 9383 return -1;
9384 } 9384 }
9385 #ifdef ENABLE_ALMIXER_THREADS 9385 #ifdef ENABLE_ALMIXER_THREADS
9386 SDL_LockMutex(s_simpleLock); 9386 SDL_LockMutex(s_simpleLock);
9393 } 9393 }
9394 9394
9395 ALint ALmixer_IsActiveSource(ALuint source) 9395 ALint ALmixer_IsActiveSource(ALuint source)
9396 { 9396 {
9397 ALint retval; 9397 ALint retval;
9398 if(0 == ALmixer_Initialized) 9398 if(AL_FALSE == ALmixer_Initialized)
9399 { 9399 {
9400 return -1; 9400 return -1;
9401 } 9401 }
9402 #ifdef ENABLE_ALMIXER_THREADS 9402 #ifdef ENABLE_ALMIXER_THREADS
9403 SDL_LockMutex(s_simpleLock); 9403 SDL_LockMutex(s_simpleLock);
9411 9411
9412 9412
9413 ALint ALmixer_IsPlayingChannel(ALint channel) 9413 ALint ALmixer_IsPlayingChannel(ALint channel)
9414 { 9414 {
9415 ALint retval; 9415 ALint retval;
9416 if(0 == ALmixer_Initialized) 9416 if(AL_FALSE == ALmixer_Initialized)
9417 { 9417 {
9418 return -1; 9418 return -1;
9419 } 9419 }
9420 #ifdef ENABLE_ALMIXER_THREADS 9420 #ifdef ENABLE_ALMIXER_THREADS
9421 SDL_LockMutex(s_simpleLock); 9421 SDL_LockMutex(s_simpleLock);
9428 } 9428 }
9429 9429
9430 ALint ALmixer_IsPlayingSource(ALuint source) 9430 ALint ALmixer_IsPlayingSource(ALuint source)
9431 { 9431 {
9432 ALint retval; 9432 ALint retval;
9433 if(0 == ALmixer_Initialized) 9433 if(AL_FALSE == ALmixer_Initialized)
9434 { 9434 {
9435 return -1; 9435 return -1;
9436 } 9436 }
9437 #ifdef ENABLE_ALMIXER_THREADS 9437 #ifdef ENABLE_ALMIXER_THREADS
9438 SDL_LockMutex(s_simpleLock); 9438 SDL_LockMutex(s_simpleLock);
9446 9446
9447 9447
9448 ALint ALmixer_IsPausedChannel(ALint channel) 9448 ALint ALmixer_IsPausedChannel(ALint channel)
9449 { 9449 {
9450 ALint retval; 9450 ALint retval;
9451 if(0 == ALmixer_Initialized) 9451 if(AL_FALSE == ALmixer_Initialized)
9452 { 9452 {
9453 return -1; 9453 return -1;
9454 } 9454 }
9455 #ifdef ENABLE_ALMIXER_THREADS 9455 #ifdef ENABLE_ALMIXER_THREADS
9456 SDL_LockMutex(s_simpleLock); 9456 SDL_LockMutex(s_simpleLock);
9463 } 9463 }
9464 9464
9465 ALint ALmixer_IsPausedSource(ALuint source) 9465 ALint ALmixer_IsPausedSource(ALuint source)
9466 { 9466 {
9467 ALint retval; 9467 ALint retval;
9468 if(0 == ALmixer_Initialized) 9468 if(AL_FALSE == ALmixer_Initialized)
9469 { 9469 {
9470 return -1; 9470 return -1;
9471 } 9471 }
9472 #ifdef ENABLE_ALMIXER_THREADS 9472 #ifdef ENABLE_ALMIXER_THREADS
9473 SDL_LockMutex(s_simpleLock); 9473 SDL_LockMutex(s_simpleLock);
9481 9481
9482 9482
9483 ALuint ALmixer_CountAllFreeChannels() 9483 ALuint ALmixer_CountAllFreeChannels()
9484 { 9484 {
9485 ALuint retval; 9485 ALuint retval;
9486 if(0 == ALmixer_Initialized) 9486 if(AL_FALSE == ALmixer_Initialized)
9487 { 9487 {
9488 return 0; 9488 return 0;
9489 } 9489 }
9490 #ifdef ENABLE_ALMIXER_THREADS 9490 #ifdef ENABLE_ALMIXER_THREADS
9491 SDL_LockMutex(s_simpleLock); 9491 SDL_LockMutex(s_simpleLock);
9498 } 9498 }
9499 9499
9500 ALuint ALmixer_CountUnreservedFreeChannels() 9500 ALuint ALmixer_CountUnreservedFreeChannels()
9501 { 9501 {
9502 ALuint retval; 9502 ALuint retval;
9503 if(0 == ALmixer_Initialized) 9503 if(AL_FALSE == ALmixer_Initialized)
9504 { 9504 {
9505 return 0; 9505 return 0;
9506 } 9506 }
9507 #ifdef ENABLE_ALMIXER_THREADS 9507 #ifdef ENABLE_ALMIXER_THREADS
9508 SDL_LockMutex(s_simpleLock); 9508 SDL_LockMutex(s_simpleLock);
9515 } 9515 }
9516 9516
9517 ALuint ALmixer_CountAllUsedChannels() 9517 ALuint ALmixer_CountAllUsedChannels()
9518 { 9518 {
9519 ALuint retval; 9519 ALuint retval;
9520 if(0 == ALmixer_Initialized) 9520 if(AL_FALSE == ALmixer_Initialized)
9521 { 9521 {
9522 return 0; 9522 return 0;
9523 } 9523 }
9524 #ifdef ENABLE_ALMIXER_THREADS 9524 #ifdef ENABLE_ALMIXER_THREADS
9525 SDL_LockMutex(s_simpleLock); 9525 SDL_LockMutex(s_simpleLock);
9532 } 9532 }
9533 9533
9534 ALuint ALmixer_CountUnreservedUsedChannels() 9534 ALuint ALmixer_CountUnreservedUsedChannels()
9535 { 9535 {
9536 ALuint retval; 9536 ALuint retval;
9537 if(0 == ALmixer_Initialized) 9537 if(AL_FALSE == ALmixer_Initialized)
9538 { 9538 {
9539 return 0; 9539 return 0;
9540 } 9540 }
9541 #ifdef ENABLE_ALMIXER_THREADS 9541 #ifdef ENABLE_ALMIXER_THREADS
9542 SDL_LockMutex(s_simpleLock); 9542 SDL_LockMutex(s_simpleLock);