Mercurial > almixer_isolated
comparison ALmixer.c @ 40:2b0b55b7f8cf
Resync to get interruption changes.
author | Eric Wing <ewing@anscamobile.com> |
---|---|
date | Fri, 19 Aug 2011 12:36:50 -0700 |
parents | b346b6608eab |
children | 05e5dc4817a4 |
comparison
equal
deleted
inserted
replaced
39:c07dbd386ded | 40:2b0b55b7f8cf |
---|---|
331 static void ALmixer_Delay(ALuint milliseconds_delay) | 331 static void ALmixer_Delay(ALuint milliseconds_delay) |
332 { | 332 { |
333 #if defined(_WIN32) | 333 #if defined(_WIN32) |
334 Sleep(milliseconds_delay); | 334 Sleep(milliseconds_delay); |
335 #else | 335 #else |
336 usleep(milliseconds_delay); | 336 usleep(milliseconds_delay*1000); |
337 #endif | 337 #endif |
338 } | 338 } |
339 #else | 339 #else |
340 #include "SDL.h" /* For SDL_GetTicks(), SDL_Delay */ | 340 #include "SDL.h" /* For SDL_GetTicks(), SDL_Delay */ |
341 #define ALmixer_GetTicks SDL_GetTicks | 341 #define ALmixer_GetTicks SDL_GetTicks |
1979 | 1979 |
1980 /* Delete source associated with the channel */ | 1980 /* Delete source associated with the channel */ |
1981 alDeleteSources(1, &ALmixer_Channel_List[i].alsource); | 1981 alDeleteSources(1, &ALmixer_Channel_List[i].alsource); |
1982 if((error = alGetError()) != AL_NO_ERROR) | 1982 if((error = alGetError()) != AL_NO_ERROR) |
1983 { | 1983 { |
1984 fprintf(stderr, "13Testing error: %s\n", | 1984 fprintf(stderr, "13bTesting error: %s\n", |
1985 alGetString(error)); | 1985 alGetString(error)); |
1986 } | 1986 } |
1987 } | 1987 } |
1988 | 1988 |
1989 | 1989 |
4859 ALint i=0; | 4859 ALint i=0; |
4860 | 4860 |
4861 #ifdef ENABLE_ALMIXER_THREADS | 4861 #ifdef ENABLE_ALMIXER_THREADS |
4862 SDL_LockMutex(s_simpleLock); | 4862 SDL_LockMutex(s_simpleLock); |
4863 #endif | 4863 #endif |
4864 if(AL_FALSE == ALmixer_Initialized) | 4864 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
4865 { | 4865 { |
4866 #ifdef ENABLE_ALMIXER_THREADS | 4866 #ifdef ENABLE_ALMIXER_THREADS |
4867 SDL_UnlockMutex(s_simpleLock); | 4867 SDL_UnlockMutex(s_simpleLock); |
4868 #endif | 4868 #endif |
4869 return 0; | 4869 return 0; |
7446 /* iOS alcSuspendContext is a no-op */ | 7446 /* iOS alcSuspendContext is a no-op */ |
7447 alcSuspendContext(s_interruptionContext); | 7447 alcSuspendContext(s_interruptionContext); |
7448 alcMakeContextCurrent(NULL); | 7448 alcMakeContextCurrent(NULL); |
7449 } | 7449 } |
7450 | 7450 |
7451 g_inInterruption = 1; | 7451 g_inInterruption = AL_TRUE; |
7452 } | 7452 } |
7453 | 7453 |
7454 void ALmixer_EndInterruption() | 7454 void ALmixer_EndInterruption() |
7455 { | 7455 { |
7456 if((AL_FALSE == g_inInterruption) || (AL_FALSE == ALmixer_Initialized)) | 7456 if((AL_FALSE == g_inInterruption) || (AL_FALSE == ALmixer_Initialized)) |
7487 { | 7487 { |
7488 fprintf(stderr, "Critical Error: Could not create bookkeeping thread in EndInterruption\n"); | 7488 fprintf(stderr, "Critical Error: Could not create bookkeeping thread in EndInterruption\n"); |
7489 } | 7489 } |
7490 #endif | 7490 #endif |
7491 g_inInterruption = AL_FALSE; | 7491 g_inInterruption = AL_FALSE; |
7492 } | |
7493 | |
7494 | |
7495 ALboolean ALmixer_IsInInterruption() | |
7496 { | |
7497 if(AL_FALSE == ALmixer_Initialized) | |
7498 { | |
7499 return AL_FALSE; | |
7500 } | |
7501 return g_inInterruption; | |
7492 } | 7502 } |
7493 | 7503 |
7494 /* Keep the return value void to allow easy use with | 7504 /* Keep the return value void to allow easy use with |
7495 * atexit() | 7505 * atexit() |
7496 */ | 7506 */ |
7780 | 7790 |
7781 | 7791 |
7782 ALint ALmixer_AllocateChannels(ALint numchans) | 7792 ALint ALmixer_AllocateChannels(ALint numchans) |
7783 { | 7793 { |
7784 ALint retval; | 7794 ALint retval; |
7785 if(AL_FALSE == ALmixer_Initialized) | 7795 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
7786 { | 7796 { |
7787 return -1; | 7797 return -1; |
7788 } | 7798 } |
7789 | 7799 |
7790 #ifdef ENABLE_ALMIXER_THREADS | 7800 #ifdef ENABLE_ALMIXER_THREADS |
7799 | 7809 |
7800 | 7810 |
7801 ALint ALmixer_ReserveChannels(ALint num) | 7811 ALint ALmixer_ReserveChannels(ALint num) |
7802 { | 7812 { |
7803 ALint retval; | 7813 ALint retval; |
7804 if(AL_FALSE == ALmixer_Initialized) | 7814 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
7805 { | 7815 { |
7806 return -1; | 7816 return -1; |
7807 } | 7817 } |
7808 | 7818 |
7809 #ifdef ENABLE_ALMIXER_THREADS | 7819 #ifdef ENABLE_ALMIXER_THREADS |
8165 } | 8175 } |
8166 } | 8176 } |
8167 /* If an error happened, we have to clean up the memory */ | 8177 /* If an error happened, we have to clean up the memory */ |
8168 if(j < max_queue_buffers) | 8178 if(j < max_queue_buffers) |
8169 { | 8179 { |
8180 ALmixer_SetError("################## Buffer allocation failed"); | |
8170 fprintf(stderr, "################## Buffer allocation failed\n"); | 8181 fprintf(stderr, "################## Buffer allocation failed\n"); |
8171 for( ; j>=0; j--) | 8182 while(j>0) |
8172 { | 8183 { |
8173 free(ret_data->buffer_map_list[j].data); | 8184 free(ret_data->buffer_map_list[j].data); |
8185 j--; | |
8174 } | 8186 } |
8187 // Delete for j=0 because the while loop misses the last one | |
8188 free(ret_data->buffer_map_list[j].data); | |
8189 | |
8175 free(ret_data->buffer_map_list); | 8190 free(ret_data->buffer_map_list); |
8176 CircularQueueUnsignedInt_FreeQueue(ret_data->circular_buffer_queue); | 8191 CircularQueueUnsignedInt_FreeQueue(ret_data->circular_buffer_queue); |
8177 Sound_FreeSample(sample); | 8192 Sound_FreeSample(sample); |
8178 free(ret_data->buffer); | 8193 free(ret_data->buffer); |
8179 free(ret_data); | 8194 free(ret_data); |
8365 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) | 8380 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) |
8366 { | 8381 { |
8367 Sound_Sample* sample = NULL; | 8382 Sound_Sample* sample = NULL; |
8368 Sound_AudioInfo target; | 8383 Sound_AudioInfo target; |
8369 | 8384 |
8370 if(AL_FALSE == ALmixer_Initialized) | 8385 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8371 { | 8386 { |
8372 return NULL; | 8387 return NULL; |
8373 } | 8388 } |
8374 | 8389 |
8375 /* Initialize target values to defaults | 8390 /* Initialize target values to defaults |
8416 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) | 8431 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) |
8417 { | 8432 { |
8418 Sound_Sample* sample = NULL; | 8433 Sound_Sample* sample = NULL; |
8419 Sound_AudioInfo target; | 8434 Sound_AudioInfo target; |
8420 | 8435 |
8421 if(AL_FALSE == ALmixer_Initialized) | 8436 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8422 { | 8437 { |
8423 return NULL; | 8438 return NULL; |
8424 } | 8439 } |
8425 | 8440 |
8426 /* Initialize target values to defaults | 8441 /* Initialize target values to defaults |
8523 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) | 8538 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) |
8524 { | 8539 { |
8525 Sound_Sample* sample = NULL; | 8540 Sound_Sample* sample = NULL; |
8526 Sound_AudioInfo sound_desired; | 8541 Sound_AudioInfo sound_desired; |
8527 | 8542 |
8528 if(AL_FALSE == ALmixer_Initialized) | 8543 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8529 { | 8544 { |
8530 return NULL; | 8545 return NULL; |
8531 } | 8546 } |
8532 | 8547 |
8533 /* Rather than copying the data from struct to struct, I could just | 8548 /* Rather than copying the data from struct to struct, I could just |
8565 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) | 8580 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) |
8566 { | 8581 { |
8567 Sound_Sample* sample = NULL; | 8582 Sound_Sample* sample = NULL; |
8568 Sound_AudioInfo sound_desired; | 8583 Sound_AudioInfo sound_desired; |
8569 | 8584 |
8570 if(AL_FALSE == ALmixer_Initialized) | 8585 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8571 { | 8586 { |
8572 return NULL; | 8587 return NULL; |
8573 } | 8588 } |
8574 | 8589 |
8575 /* Rather than copying the data from struct to struct, I could just | 8590 /* Rather than copying the data from struct to struct, I could just |
8600 } | 8615 } |
8601 | 8616 |
8602 | 8617 |
8603 void ALmixer_FreeData(ALmixer_Data* data) | 8618 void ALmixer_FreeData(ALmixer_Data* data) |
8604 { | 8619 { |
8605 if(AL_FALSE == ALmixer_Initialized) | 8620 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8606 { | 8621 { |
8607 return; | 8622 return; |
8608 } | 8623 } |
8609 | 8624 |
8610 /* Bypass if in interruption event */ | 8625 /* Bypass if in interruption event */ |
8631 /* This function will look up the source for the corresponding channel */ | 8646 /* This function will look up the source for the corresponding channel */ |
8632 /* Must return 0 on error instead of -1 because of unsigned int */ | 8647 /* Must return 0 on error instead of -1 because of unsigned int */ |
8633 ALuint ALmixer_GetSource(ALint channel) | 8648 ALuint ALmixer_GetSource(ALint channel) |
8634 { | 8649 { |
8635 ALuint retval; | 8650 ALuint retval; |
8636 if(AL_FALSE == ALmixer_Initialized) | 8651 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8637 { | 8652 { |
8638 return 0; | 8653 return 0; |
8639 } | 8654 } |
8640 #ifdef ENABLE_ALMIXER_THREADS | 8655 #ifdef ENABLE_ALMIXER_THREADS |
8641 SDL_LockMutex(s_simpleLock); | 8656 SDL_LockMutex(s_simpleLock); |
8649 | 8664 |
8650 /* This function will look up the channel for the corresponding source */ | 8665 /* This function will look up the channel for the corresponding source */ |
8651 ALint ALmixer_GetChannel(ALuint source) | 8666 ALint ALmixer_GetChannel(ALuint source) |
8652 { | 8667 { |
8653 ALint retval; | 8668 ALint retval; |
8654 if(AL_FALSE == ALmixer_Initialized) | 8669 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8655 { | 8670 { |
8656 return -1; | 8671 return -1; |
8657 } | 8672 } |
8658 #ifdef ENABLE_ALMIXER_THREADS | 8673 #ifdef ENABLE_ALMIXER_THREADS |
8659 SDL_LockMutex(s_simpleLock); | 8674 SDL_LockMutex(s_simpleLock); |
8666 } | 8681 } |
8667 | 8682 |
8668 ALint ALmixer_FindFreeChannel(ALint start_channel) | 8683 ALint ALmixer_FindFreeChannel(ALint start_channel) |
8669 { | 8684 { |
8670 ALint retval; | 8685 ALint retval; |
8671 if(AL_FALSE == ALmixer_Initialized) | 8686 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8672 { | 8687 { |
8673 return -1; | 8688 return -1; |
8674 } | 8689 } |
8675 #ifdef ENABLE_ALMIXER_THREADS | 8690 #ifdef ENABLE_ALMIXER_THREADS |
8676 SDL_LockMutex(s_simpleLock); | 8691 SDL_LockMutex(s_simpleLock); |
8742 | 8757 |
8743 | 8758 |
8744 ALint ALmixer_PlayChannelTimed(ALint channel, ALmixer_Data* data, ALint loops, ALint ticks) | 8759 ALint ALmixer_PlayChannelTimed(ALint channel, ALmixer_Data* data, ALint loops, ALint ticks) |
8745 { | 8760 { |
8746 ALint retval; | 8761 ALint retval; |
8747 if(AL_FALSE == ALmixer_Initialized) | 8762 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8748 { | 8763 { |
8749 return -1; | 8764 return -1; |
8750 } | 8765 } |
8751 #ifdef ENABLE_ALMIXER_THREADS | 8766 #ifdef ENABLE_ALMIXER_THREADS |
8752 SDL_LockMutex(s_simpleLock); | 8767 SDL_LockMutex(s_simpleLock); |
8772 * In this event, an error message will be returned to you. | 8787 * In this event, an error message will be returned to you. |
8773 */ | 8788 */ |
8774 ALuint ALmixer_PlaySourceTimed(ALuint source, ALmixer_Data* data, ALint loops, ALint ticks) | 8789 ALuint ALmixer_PlaySourceTimed(ALuint source, ALmixer_Data* data, ALint loops, ALint ticks) |
8775 { | 8790 { |
8776 ALuint retval; | 8791 ALuint retval; |
8777 if(AL_FALSE == ALmixer_Initialized) | 8792 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8778 { | 8793 { |
8779 return 0; | 8794 return 0; |
8780 } | 8795 } |
8781 #ifdef ENABLE_ALMIXER_THREADS | 8796 #ifdef ENABLE_ALMIXER_THREADS |
8782 SDL_LockMutex(s_simpleLock); | 8797 SDL_LockMutex(s_simpleLock); |
8793 * or -1 for error | 8808 * or -1 for error |
8794 */ | 8809 */ |
8795 ALint ALmixer_HaltChannel(ALint channel) | 8810 ALint ALmixer_HaltChannel(ALint channel) |
8796 { | 8811 { |
8797 ALint retval; | 8812 ALint retval; |
8798 if(AL_FALSE == ALmixer_Initialized) | 8813 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8799 { | 8814 { |
8800 return -1; | 8815 return -1; |
8801 } | 8816 } |
8802 #ifdef ENABLE_ALMIXER_THREADS | 8817 #ifdef ENABLE_ALMIXER_THREADS |
8803 SDL_LockMutex(s_simpleLock); | 8818 SDL_LockMutex(s_simpleLock); |
8813 * or 0 for error | 8828 * or 0 for error |
8814 */ | 8829 */ |
8815 ALint ALmixer_HaltSource(ALuint source) | 8830 ALint ALmixer_HaltSource(ALuint source) |
8816 { | 8831 { |
8817 ALint retval; | 8832 ALint retval; |
8818 if(AL_FALSE == ALmixer_Initialized) | 8833 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8819 { | 8834 { |
8820 return -1; | 8835 return -1; |
8821 } | 8836 } |
8822 #ifdef ENABLE_ALMIXER_THREADS | 8837 #ifdef ENABLE_ALMIXER_THREADS |
8823 SDL_LockMutex(s_simpleLock); | 8838 SDL_LockMutex(s_simpleLock); |
8835 * playback. This may require samples to be halted | 8850 * playback. This may require samples to be halted |
8836 */ | 8851 */ |
8837 ALboolean ALmixer_RewindData(ALmixer_Data* data) | 8852 ALboolean ALmixer_RewindData(ALmixer_Data* data) |
8838 { | 8853 { |
8839 ALboolean retval; | 8854 ALboolean retval; |
8840 if(AL_FALSE == ALmixer_Initialized) | 8855 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8841 { | 8856 { |
8842 return AL_FALSE; | 8857 return AL_FALSE; |
8843 } | 8858 } |
8844 #ifdef ENABLE_ALMIXER_THREADS | 8859 #ifdef ENABLE_ALMIXER_THREADS |
8845 SDL_LockMutex(s_simpleLock); | 8860 SDL_LockMutex(s_simpleLock); |
8852 } | 8867 } |
8853 | 8868 |
8854 ALint ALmixer_RewindChannel(ALint channel) | 8869 ALint ALmixer_RewindChannel(ALint channel) |
8855 { | 8870 { |
8856 ALint retval; | 8871 ALint retval; |
8857 if(AL_FALSE == ALmixer_Initialized) | 8872 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8858 { | 8873 { |
8859 return -1; | 8874 return -1; |
8860 } | 8875 } |
8861 #ifdef ENABLE_ALMIXER_THREADS | 8876 #ifdef ENABLE_ALMIXER_THREADS |
8862 SDL_LockMutex(s_simpleLock); | 8877 SDL_LockMutex(s_simpleLock); |
8869 } | 8884 } |
8870 | 8885 |
8871 ALint ALmixer_RewindSource(ALuint source) | 8886 ALint ALmixer_RewindSource(ALuint source) |
8872 { | 8887 { |
8873 ALint retval; | 8888 ALint retval; |
8874 if(AL_FALSE == ALmixer_Initialized) | 8889 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8875 { | 8890 { |
8876 return -1; | 8891 return -1; |
8877 } | 8892 } |
8878 #ifdef ENABLE_ALMIXER_THREADS | 8893 #ifdef ENABLE_ALMIXER_THREADS |
8879 SDL_LockMutex(s_simpleLock); | 8894 SDL_LockMutex(s_simpleLock); |
8886 } | 8901 } |
8887 | 8902 |
8888 ALint ALmixer_PauseChannel(ALint channel) | 8903 ALint ALmixer_PauseChannel(ALint channel) |
8889 { | 8904 { |
8890 ALint retval; | 8905 ALint retval; |
8891 if(AL_FALSE == ALmixer_Initialized) | 8906 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8892 { | 8907 { |
8893 return -1; | 8908 return -1; |
8894 } | 8909 } |
8895 #ifdef ENABLE_ALMIXER_THREADS | 8910 #ifdef ENABLE_ALMIXER_THREADS |
8896 SDL_LockMutex(s_simpleLock); | 8911 SDL_LockMutex(s_simpleLock); |
8903 } | 8918 } |
8904 | 8919 |
8905 ALint ALmixer_PauseSource(ALuint source) | 8920 ALint ALmixer_PauseSource(ALuint source) |
8906 { | 8921 { |
8907 ALint retval; | 8922 ALint retval; |
8908 if(AL_FALSE == ALmixer_Initialized) | 8923 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8909 { | 8924 { |
8910 return -1; | 8925 return -1; |
8911 } | 8926 } |
8912 #ifdef ENABLE_ALMIXER_THREADS | 8927 #ifdef ENABLE_ALMIXER_THREADS |
8913 SDL_LockMutex(s_simpleLock); | 8928 SDL_LockMutex(s_simpleLock); |
8920 } | 8935 } |
8921 | 8936 |
8922 ALint ALmixer_ResumeChannel(ALint channel) | 8937 ALint ALmixer_ResumeChannel(ALint channel) |
8923 { | 8938 { |
8924 ALint retval; | 8939 ALint retval; |
8925 if(AL_FALSE == ALmixer_Initialized) | 8940 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8926 { | 8941 { |
8927 return -1; | 8942 return -1; |
8928 } | 8943 } |
8929 #ifdef ENABLE_ALMIXER_THREADS | 8944 #ifdef ENABLE_ALMIXER_THREADS |
8930 SDL_LockMutex(s_simpleLock); | 8945 SDL_LockMutex(s_simpleLock); |
8937 } | 8952 } |
8938 | 8953 |
8939 ALint ALmixer_ResumeSource(ALuint source) | 8954 ALint ALmixer_ResumeSource(ALuint source) |
8940 { | 8955 { |
8941 ALint retval; | 8956 ALint retval; |
8942 if(AL_FALSE == ALmixer_Initialized) | 8957 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8943 { | 8958 { |
8944 return -1; | 8959 return -1; |
8945 } | 8960 } |
8946 #ifdef ENABLE_ALMIXER_THREADS | 8961 #ifdef ENABLE_ALMIXER_THREADS |
8947 SDL_LockMutex(s_simpleLock); | 8962 SDL_LockMutex(s_simpleLock); |
8957 * This will allow seek to end to stay there because | 8972 * This will allow seek to end to stay there because |
8958 * Play automatically rewinds if at the end */ | 8973 * Play automatically rewinds if at the end */ |
8959 ALboolean ALmixer_SeekData(ALmixer_Data* data, ALuint msec) | 8974 ALboolean ALmixer_SeekData(ALmixer_Data* data, ALuint msec) |
8960 { | 8975 { |
8961 ALboolean retval; | 8976 ALboolean retval; |
8962 if(AL_FALSE == ALmixer_Initialized) | 8977 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8963 { | 8978 { |
8964 return -1; | 8979 return -1; |
8965 } | 8980 } |
8966 #ifdef ENABLE_ALMIXER_THREADS | 8981 #ifdef ENABLE_ALMIXER_THREADS |
8967 SDL_LockMutex(s_simpleLock); | 8982 SDL_LockMutex(s_simpleLock); |
8974 } | 8989 } |
8975 | 8990 |
8976 ALint ALmixer_SeekChannel(ALint channel, ALuint msec) | 8991 ALint ALmixer_SeekChannel(ALint channel, ALuint msec) |
8977 { | 8992 { |
8978 ALint retval; | 8993 ALint retval; |
8979 if(AL_FALSE == ALmixer_Initialized) | 8994 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8980 { | 8995 { |
8981 return -1; | 8996 return -1; |
8982 } | 8997 } |
8983 #ifdef ENABLE_ALMIXER_THREADS | 8998 #ifdef ENABLE_ALMIXER_THREADS |
8984 SDL_LockMutex(s_simpleLock); | 8999 SDL_LockMutex(s_simpleLock); |
8991 } | 9006 } |
8992 | 9007 |
8993 ALint ALmixer_SeekSource(ALuint source, ALuint msec) | 9008 ALint ALmixer_SeekSource(ALuint source, ALuint msec) |
8994 { | 9009 { |
8995 ALint retval; | 9010 ALint retval; |
8996 if(AL_FALSE == ALmixer_Initialized) | 9011 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
8997 { | 9012 { |
8998 return -1; | 9013 return -1; |
8999 } | 9014 } |
9000 #ifdef ENABLE_ALMIXER_THREADS | 9015 #ifdef ENABLE_ALMIXER_THREADS |
9001 SDL_LockMutex(s_simpleLock); | 9016 SDL_LockMutex(s_simpleLock); |
9008 } | 9023 } |
9009 | 9024 |
9010 ALint ALmixer_FadeInChannelTimed(ALint channel, ALmixer_Data* data, ALint loops, ALuint fade_ticks, ALint expire_ticks) | 9025 ALint ALmixer_FadeInChannelTimed(ALint channel, ALmixer_Data* data, ALint loops, ALuint fade_ticks, ALint expire_ticks) |
9011 { | 9026 { |
9012 ALint retval; | 9027 ALint retval; |
9013 if(AL_FALSE == ALmixer_Initialized) | 9028 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9014 { | 9029 { |
9015 return -1; | 9030 return -1; |
9016 } | 9031 } |
9017 #ifdef ENABLE_ALMIXER_THREADS | 9032 #ifdef ENABLE_ALMIXER_THREADS |
9018 SDL_LockMutex(s_simpleLock); | 9033 SDL_LockMutex(s_simpleLock); |
9025 } | 9040 } |
9026 | 9041 |
9027 ALuint ALmixer_FadeInSourceTimed(ALuint source, ALmixer_Data* data, ALint loops, ALuint fade_ticks, ALint expire_ticks) | 9042 ALuint ALmixer_FadeInSourceTimed(ALuint source, ALmixer_Data* data, ALint loops, ALuint fade_ticks, ALint expire_ticks) |
9028 { | 9043 { |
9029 ALuint retval; | 9044 ALuint retval; |
9030 if(AL_FALSE == ALmixer_Initialized) | 9045 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9031 { | 9046 { |
9032 return 0; | 9047 return 0; |
9033 } | 9048 } |
9034 #ifdef ENABLE_ALMIXER_THREADS | 9049 #ifdef ENABLE_ALMIXER_THREADS |
9035 SDL_LockMutex(s_simpleLock); | 9050 SDL_LockMutex(s_simpleLock); |
9042 } | 9057 } |
9043 | 9058 |
9044 ALint ALmixer_FadeOutChannel(ALint channel, ALuint ticks) | 9059 ALint ALmixer_FadeOutChannel(ALint channel, ALuint ticks) |
9045 { | 9060 { |
9046 ALint retval; | 9061 ALint retval; |
9047 if(AL_FALSE == ALmixer_Initialized) | 9062 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9048 { | 9063 { |
9049 return -1; | 9064 return -1; |
9050 } | 9065 } |
9051 #ifdef ENABLE_ALMIXER_THREADS | 9066 #ifdef ENABLE_ALMIXER_THREADS |
9052 SDL_LockMutex(s_simpleLock); | 9067 SDL_LockMutex(s_simpleLock); |
9059 } | 9074 } |
9060 | 9075 |
9061 ALint ALmixer_FadeOutSource(ALuint source, ALuint ticks) | 9076 ALint ALmixer_FadeOutSource(ALuint source, ALuint ticks) |
9062 { | 9077 { |
9063 ALint retval; | 9078 ALint retval; |
9064 if(AL_FALSE == ALmixer_Initialized) | 9079 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9065 { | 9080 { |
9066 return 0; | 9081 return 0; |
9067 } | 9082 } |
9068 #ifdef ENABLE_ALMIXER_THREADS | 9083 #ifdef ENABLE_ALMIXER_THREADS |
9069 SDL_LockMutex(s_simpleLock); | 9084 SDL_LockMutex(s_simpleLock); |
9076 } | 9091 } |
9077 | 9092 |
9078 ALint ALmixer_FadeChannel(ALint channel, ALuint ticks, ALfloat volume) | 9093 ALint ALmixer_FadeChannel(ALint channel, ALuint ticks, ALfloat volume) |
9079 { | 9094 { |
9080 ALint retval; | 9095 ALint retval; |
9081 if(AL_FALSE == ALmixer_Initialized) | 9096 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9082 { | 9097 { |
9083 return 0; | 9098 return 0; |
9084 } | 9099 } |
9085 #ifdef ENABLE_ALMIXER_THREADS | 9100 #ifdef ENABLE_ALMIXER_THREADS |
9086 SDL_LockMutex(s_simpleLock); | 9101 SDL_LockMutex(s_simpleLock); |
9093 } | 9108 } |
9094 | 9109 |
9095 ALint ALmixer_FadeSource(ALuint source, ALuint ticks, ALfloat volume) | 9110 ALint ALmixer_FadeSource(ALuint source, ALuint ticks, ALfloat volume) |
9096 { | 9111 { |
9097 ALint retval; | 9112 ALint retval; |
9098 if(AL_FALSE == ALmixer_Initialized) | 9113 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9099 { | 9114 { |
9100 return -1; | 9115 return -1; |
9101 } | 9116 } |
9102 #ifdef ENABLE_ALMIXER_THREADS | 9117 #ifdef ENABLE_ALMIXER_THREADS |
9103 SDL_LockMutex(s_simpleLock); | 9118 SDL_LockMutex(s_simpleLock); |
9111 | 9126 |
9112 | 9127 |
9113 ALboolean ALmixer_SetVolumeChannel(ALint channel, ALfloat volume) | 9128 ALboolean ALmixer_SetVolumeChannel(ALint channel, ALfloat volume) |
9114 { | 9129 { |
9115 ALboolean retval; | 9130 ALboolean retval; |
9116 if(AL_FALSE == ALmixer_Initialized) | 9131 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9117 { | 9132 { |
9118 return AL_FALSE; | 9133 return AL_FALSE; |
9119 } | 9134 } |
9120 #ifdef ENABLE_ALMIXER_THREADS | 9135 #ifdef ENABLE_ALMIXER_THREADS |
9121 SDL_LockMutex(s_simpleLock); | 9136 SDL_LockMutex(s_simpleLock); |
9128 } | 9143 } |
9129 | 9144 |
9130 ALboolean ALmixer_SetVolumeSource(ALuint source, ALfloat volume) | 9145 ALboolean ALmixer_SetVolumeSource(ALuint source, ALfloat volume) |
9131 { | 9146 { |
9132 ALboolean retval; | 9147 ALboolean retval; |
9133 if(AL_FALSE == ALmixer_Initialized) | 9148 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9134 { | 9149 { |
9135 return AL_FALSE; | 9150 return AL_FALSE; |
9136 } | 9151 } |
9137 #ifdef ENABLE_ALMIXER_THREADS | 9152 #ifdef ENABLE_ALMIXER_THREADS |
9138 SDL_LockMutex(s_simpleLock); | 9153 SDL_LockMutex(s_simpleLock); |
9145 } | 9160 } |
9146 | 9161 |
9147 ALfloat ALmixer_GetVolumeChannel(ALint channel) | 9162 ALfloat ALmixer_GetVolumeChannel(ALint channel) |
9148 { | 9163 { |
9149 ALfloat retval; | 9164 ALfloat retval; |
9150 if(AL_FALSE == ALmixer_Initialized) | 9165 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9151 { | 9166 { |
9152 return -1.0f; | 9167 return -1.0f; |
9153 } | 9168 } |
9154 #ifdef ENABLE_ALMIXER_THREADS | 9169 #ifdef ENABLE_ALMIXER_THREADS |
9155 SDL_LockMutex(s_simpleLock); | 9170 SDL_LockMutex(s_simpleLock); |
9162 } | 9177 } |
9163 | 9178 |
9164 ALfloat ALmixer_GetVolumeSource(ALuint source) | 9179 ALfloat ALmixer_GetVolumeSource(ALuint source) |
9165 { | 9180 { |
9166 ALfloat retval; | 9181 ALfloat retval; |
9167 if(AL_FALSE == ALmixer_Initialized) | 9182 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9168 { | 9183 { |
9169 return -1.0f; | 9184 return -1.0f; |
9170 } | 9185 } |
9171 #ifdef ENABLE_ALMIXER_THREADS | 9186 #ifdef ENABLE_ALMIXER_THREADS |
9172 SDL_LockMutex(s_simpleLock); | 9187 SDL_LockMutex(s_simpleLock); |
9179 } | 9194 } |
9180 | 9195 |
9181 ALboolean ALmixer_SetMaxVolumeChannel(ALint channel, ALfloat volume) | 9196 ALboolean ALmixer_SetMaxVolumeChannel(ALint channel, ALfloat volume) |
9182 { | 9197 { |
9183 ALboolean retval; | 9198 ALboolean retval; |
9184 if(AL_FALSE == ALmixer_Initialized) | 9199 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9185 { | 9200 { |
9186 return AL_FALSE; | 9201 return AL_FALSE; |
9187 } | 9202 } |
9188 #ifdef ENABLE_ALMIXER_THREADS | 9203 #ifdef ENABLE_ALMIXER_THREADS |
9189 SDL_LockMutex(s_simpleLock); | 9204 SDL_LockMutex(s_simpleLock); |
9196 } | 9211 } |
9197 | 9212 |
9198 ALboolean ALmixer_SetMaxVolumeSource(ALuint source, ALfloat volume) | 9213 ALboolean ALmixer_SetMaxVolumeSource(ALuint source, ALfloat volume) |
9199 { | 9214 { |
9200 ALboolean retval; | 9215 ALboolean retval; |
9201 if(AL_FALSE == ALmixer_Initialized) | 9216 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9202 { | 9217 { |
9203 return AL_FALSE; | 9218 return AL_FALSE; |
9204 } | 9219 } |
9205 #ifdef ENABLE_ALMIXER_THREADS | 9220 #ifdef ENABLE_ALMIXER_THREADS |
9206 SDL_LockMutex(s_simpleLock); | 9221 SDL_LockMutex(s_simpleLock); |
9213 } | 9228 } |
9214 | 9229 |
9215 ALfloat ALmixer_GetMaxVolumeChannel(ALint channel) | 9230 ALfloat ALmixer_GetMaxVolumeChannel(ALint channel) |
9216 { | 9231 { |
9217 ALfloat retval; | 9232 ALfloat retval; |
9218 if(AL_FALSE == ALmixer_Initialized) | 9233 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9219 { | 9234 { |
9220 return -1.0f; | 9235 return -1.0f; |
9221 } | 9236 } |
9222 #ifdef ENABLE_ALMIXER_THREADS | 9237 #ifdef ENABLE_ALMIXER_THREADS |
9223 SDL_LockMutex(s_simpleLock); | 9238 SDL_LockMutex(s_simpleLock); |
9230 } | 9245 } |
9231 | 9246 |
9232 ALfloat ALmixer_GetMaxVolumeSource(ALuint source) | 9247 ALfloat ALmixer_GetMaxVolumeSource(ALuint source) |
9233 { | 9248 { |
9234 ALfloat retval; | 9249 ALfloat retval; |
9235 if(AL_FALSE == ALmixer_Initialized) | 9250 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9236 { | 9251 { |
9237 return -1.0f; | 9252 return -1.0f; |
9238 } | 9253 } |
9239 #ifdef ENABLE_ALMIXER_THREADS | 9254 #ifdef ENABLE_ALMIXER_THREADS |
9240 SDL_LockMutex(s_simpleLock); | 9255 SDL_LockMutex(s_simpleLock); |
9248 | 9263 |
9249 | 9264 |
9250 ALboolean ALmixer_SetMinVolumeChannel(ALint channel, ALfloat volume) | 9265 ALboolean ALmixer_SetMinVolumeChannel(ALint channel, ALfloat volume) |
9251 { | 9266 { |
9252 ALboolean retval; | 9267 ALboolean retval; |
9253 if(AL_FALSE == ALmixer_Initialized) | 9268 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9254 { | 9269 { |
9255 return AL_FALSE; | 9270 return AL_FALSE; |
9256 } | 9271 } |
9257 #ifdef ENABLE_ALMIXER_THREADS | 9272 #ifdef ENABLE_ALMIXER_THREADS |
9258 SDL_LockMutex(s_simpleLock); | 9273 SDL_LockMutex(s_simpleLock); |
9265 } | 9280 } |
9266 | 9281 |
9267 ALboolean ALmixer_SetMinVolumeSource(ALuint source, ALfloat volume) | 9282 ALboolean ALmixer_SetMinVolumeSource(ALuint source, ALfloat volume) |
9268 { | 9283 { |
9269 ALboolean retval; | 9284 ALboolean retval; |
9270 if(AL_FALSE == ALmixer_Initialized) | 9285 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9271 { | 9286 { |
9272 return AL_FALSE; | 9287 return AL_FALSE; |
9273 } | 9288 } |
9274 #ifdef ENABLE_ALMIXER_THREADS | 9289 #ifdef ENABLE_ALMIXER_THREADS |
9275 SDL_LockMutex(s_simpleLock); | 9290 SDL_LockMutex(s_simpleLock); |
9282 } | 9297 } |
9283 | 9298 |
9284 ALfloat ALmixer_GetMinVolumeChannel(ALint channel) | 9299 ALfloat ALmixer_GetMinVolumeChannel(ALint channel) |
9285 { | 9300 { |
9286 ALfloat retval; | 9301 ALfloat retval; |
9287 if(AL_FALSE == ALmixer_Initialized) | 9302 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9288 { | 9303 { |
9289 return -1.0f; | 9304 return -1.0f; |
9290 } | 9305 } |
9291 #ifdef ENABLE_ALMIXER_THREADS | 9306 #ifdef ENABLE_ALMIXER_THREADS |
9292 SDL_LockMutex(s_simpleLock); | 9307 SDL_LockMutex(s_simpleLock); |
9299 } | 9314 } |
9300 | 9315 |
9301 ALfloat ALmixer_GetMinVolumeSource(ALuint source) | 9316 ALfloat ALmixer_GetMinVolumeSource(ALuint source) |
9302 { | 9317 { |
9303 ALfloat retval; | 9318 ALfloat retval; |
9304 if(AL_FALSE == ALmixer_Initialized) | 9319 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9305 { | 9320 { |
9306 return -1.0f; | 9321 return -1.0f; |
9307 } | 9322 } |
9308 #ifdef ENABLE_ALMIXER_THREADS | 9323 #ifdef ENABLE_ALMIXER_THREADS |
9309 SDL_LockMutex(s_simpleLock); | 9324 SDL_LockMutex(s_simpleLock); |
9318 | 9333 |
9319 | 9334 |
9320 ALboolean ALmixer_SetMasterVolume(ALfloat volume) | 9335 ALboolean ALmixer_SetMasterVolume(ALfloat volume) |
9321 { | 9336 { |
9322 ALboolean retval; | 9337 ALboolean retval; |
9323 if(AL_FALSE == ALmixer_Initialized) | 9338 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9324 { | 9339 { |
9325 return AL_FALSE; | 9340 return AL_FALSE; |
9326 } | 9341 } |
9327 #ifdef ENABLE_ALMIXER_THREADS | 9342 #ifdef ENABLE_ALMIXER_THREADS |
9328 SDL_LockMutex(s_simpleLock); | 9343 SDL_LockMutex(s_simpleLock); |
9335 } | 9350 } |
9336 | 9351 |
9337 ALfloat ALmixer_GetMasterVolume() | 9352 ALfloat ALmixer_GetMasterVolume() |
9338 { | 9353 { |
9339 ALfloat retval; | 9354 ALfloat retval; |
9340 if(AL_FALSE == ALmixer_Initialized) | 9355 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9341 { | 9356 { |
9342 return -1.0f; | 9357 return -1.0f; |
9343 } | 9358 } |
9344 #ifdef ENABLE_ALMIXER_THREADS | 9359 #ifdef ENABLE_ALMIXER_THREADS |
9345 SDL_LockMutex(s_simpleLock); | 9360 SDL_LockMutex(s_simpleLock); |
9352 } | 9367 } |
9353 | 9368 |
9354 ALint ALmixer_ExpireChannel(ALint channel, ALint ticks) | 9369 ALint ALmixer_ExpireChannel(ALint channel, ALint ticks) |
9355 { | 9370 { |
9356 ALint retval; | 9371 ALint retval; |
9357 if(AL_FALSE == ALmixer_Initialized) | 9372 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9358 { | 9373 { |
9359 return -1; | 9374 return -1; |
9360 } | 9375 } |
9361 #ifdef ENABLE_ALMIXER_THREADS | 9376 #ifdef ENABLE_ALMIXER_THREADS |
9362 SDL_LockMutex(s_simpleLock); | 9377 SDL_LockMutex(s_simpleLock); |
9369 } | 9384 } |
9370 | 9385 |
9371 ALint ALmixer_ExpireSource(ALuint source, ALint ticks) | 9386 ALint ALmixer_ExpireSource(ALuint source, ALint ticks) |
9372 { | 9387 { |
9373 ALint retval; | 9388 ALint retval; |
9374 if(AL_FALSE == ALmixer_Initialized) | 9389 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9375 { | 9390 { |
9376 return -1; | 9391 return -1; |
9377 } | 9392 } |
9378 #ifdef ENABLE_ALMIXER_THREADS | 9393 #ifdef ENABLE_ALMIXER_THREADS |
9379 SDL_LockMutex(s_simpleLock); | 9394 SDL_LockMutex(s_simpleLock); |
9386 } | 9401 } |
9387 | 9402 |
9388 ALint ALmixer_IsActiveChannel(ALint channel) | 9403 ALint ALmixer_IsActiveChannel(ALint channel) |
9389 { | 9404 { |
9390 ALint retval; | 9405 ALint retval; |
9391 if(AL_FALSE == ALmixer_Initialized) | 9406 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9392 { | 9407 { |
9393 return -1; | 9408 return -1; |
9394 } | 9409 } |
9395 #ifdef ENABLE_ALMIXER_THREADS | 9410 #ifdef ENABLE_ALMIXER_THREADS |
9396 SDL_LockMutex(s_simpleLock); | 9411 SDL_LockMutex(s_simpleLock); |
9403 } | 9418 } |
9404 | 9419 |
9405 ALint ALmixer_IsActiveSource(ALuint source) | 9420 ALint ALmixer_IsActiveSource(ALuint source) |
9406 { | 9421 { |
9407 ALint retval; | 9422 ALint retval; |
9408 if(AL_FALSE == ALmixer_Initialized) | 9423 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9409 { | 9424 { |
9410 return -1; | 9425 return -1; |
9411 } | 9426 } |
9412 #ifdef ENABLE_ALMIXER_THREADS | 9427 #ifdef ENABLE_ALMIXER_THREADS |
9413 SDL_LockMutex(s_simpleLock); | 9428 SDL_LockMutex(s_simpleLock); |
9421 | 9436 |
9422 | 9437 |
9423 ALint ALmixer_IsPlayingChannel(ALint channel) | 9438 ALint ALmixer_IsPlayingChannel(ALint channel) |
9424 { | 9439 { |
9425 ALint retval; | 9440 ALint retval; |
9426 if(AL_FALSE == ALmixer_Initialized) | 9441 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9427 { | 9442 { |
9428 return -1; | 9443 return -1; |
9429 } | 9444 } |
9430 #ifdef ENABLE_ALMIXER_THREADS | 9445 #ifdef ENABLE_ALMIXER_THREADS |
9431 SDL_LockMutex(s_simpleLock); | 9446 SDL_LockMutex(s_simpleLock); |
9438 } | 9453 } |
9439 | 9454 |
9440 ALint ALmixer_IsPlayingSource(ALuint source) | 9455 ALint ALmixer_IsPlayingSource(ALuint source) |
9441 { | 9456 { |
9442 ALint retval; | 9457 ALint retval; |
9443 if(AL_FALSE == ALmixer_Initialized) | 9458 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9444 { | 9459 { |
9445 return -1; | 9460 return -1; |
9446 } | 9461 } |
9447 #ifdef ENABLE_ALMIXER_THREADS | 9462 #ifdef ENABLE_ALMIXER_THREADS |
9448 SDL_LockMutex(s_simpleLock); | 9463 SDL_LockMutex(s_simpleLock); |
9456 | 9471 |
9457 | 9472 |
9458 ALint ALmixer_IsPausedChannel(ALint channel) | 9473 ALint ALmixer_IsPausedChannel(ALint channel) |
9459 { | 9474 { |
9460 ALint retval; | 9475 ALint retval; |
9461 if(AL_FALSE == ALmixer_Initialized) | 9476 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9462 { | 9477 { |
9463 return -1; | 9478 return -1; |
9464 } | 9479 } |
9465 #ifdef ENABLE_ALMIXER_THREADS | 9480 #ifdef ENABLE_ALMIXER_THREADS |
9466 SDL_LockMutex(s_simpleLock); | 9481 SDL_LockMutex(s_simpleLock); |
9473 } | 9488 } |
9474 | 9489 |
9475 ALint ALmixer_IsPausedSource(ALuint source) | 9490 ALint ALmixer_IsPausedSource(ALuint source) |
9476 { | 9491 { |
9477 ALint retval; | 9492 ALint retval; |
9478 if(AL_FALSE == ALmixer_Initialized) | 9493 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9479 { | 9494 { |
9480 return -1; | 9495 return -1; |
9481 } | 9496 } |
9482 #ifdef ENABLE_ALMIXER_THREADS | 9497 #ifdef ENABLE_ALMIXER_THREADS |
9483 SDL_LockMutex(s_simpleLock); | 9498 SDL_LockMutex(s_simpleLock); |
9491 | 9506 |
9492 | 9507 |
9493 ALuint ALmixer_CountAllFreeChannels() | 9508 ALuint ALmixer_CountAllFreeChannels() |
9494 { | 9509 { |
9495 ALuint retval; | 9510 ALuint retval; |
9496 if(AL_FALSE == ALmixer_Initialized) | 9511 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9497 { | 9512 { |
9498 return 0; | 9513 return 0; |
9499 } | 9514 } |
9500 #ifdef ENABLE_ALMIXER_THREADS | 9515 #ifdef ENABLE_ALMIXER_THREADS |
9501 SDL_LockMutex(s_simpleLock); | 9516 SDL_LockMutex(s_simpleLock); |
9508 } | 9523 } |
9509 | 9524 |
9510 ALuint ALmixer_CountUnreservedFreeChannels() | 9525 ALuint ALmixer_CountUnreservedFreeChannels() |
9511 { | 9526 { |
9512 ALuint retval; | 9527 ALuint retval; |
9513 if(AL_FALSE == ALmixer_Initialized) | 9528 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9514 { | 9529 { |
9515 return 0; | 9530 return 0; |
9516 } | 9531 } |
9517 #ifdef ENABLE_ALMIXER_THREADS | 9532 #ifdef ENABLE_ALMIXER_THREADS |
9518 SDL_LockMutex(s_simpleLock); | 9533 SDL_LockMutex(s_simpleLock); |
9525 } | 9540 } |
9526 | 9541 |
9527 ALuint ALmixer_CountAllUsedChannels() | 9542 ALuint ALmixer_CountAllUsedChannels() |
9528 { | 9543 { |
9529 ALuint retval; | 9544 ALuint retval; |
9530 if(AL_FALSE == ALmixer_Initialized) | 9545 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9531 { | 9546 { |
9532 return 0; | 9547 return 0; |
9533 } | 9548 } |
9534 #ifdef ENABLE_ALMIXER_THREADS | 9549 #ifdef ENABLE_ALMIXER_THREADS |
9535 SDL_LockMutex(s_simpleLock); | 9550 SDL_LockMutex(s_simpleLock); |
9542 } | 9557 } |
9543 | 9558 |
9544 ALuint ALmixer_CountUnreservedUsedChannels() | 9559 ALuint ALmixer_CountUnreservedUsedChannels() |
9545 { | 9560 { |
9546 ALuint retval; | 9561 ALuint retval; |
9547 if(AL_FALSE == ALmixer_Initialized) | 9562 if( (AL_FALSE == ALmixer_Initialized) || (AL_TRUE == g_inInterruption) ) |
9548 { | 9563 { |
9549 return 0; | 9564 return 0; |
9550 } | 9565 } |
9551 #ifdef ENABLE_ALMIXER_THREADS | 9566 #ifdef ENABLE_ALMIXER_THREADS |
9552 SDL_LockMutex(s_simpleLock); | 9567 SDL_LockMutex(s_simpleLock); |