Mercurial > almixer_isolated
comparison ALmixer.c @ 27:9cf93a099f75
Added initialization checks to all API functions.
author | Eric Wing <ewing . public |-at-| gmail . com> |
---|---|
date | Fri, 04 Mar 2011 11:29:05 -0800 |
parents | 884cce2515eb |
children | 60500a33735a |
comparison
equal
deleted
inserted
replaced
26:884cce2515eb | 27:9cf93a099f75 |
---|---|
7676 } | 7676 } |
7677 | 7677 |
7678 | 7678 |
7679 ALint ALmixer_AllocateChannels(ALint numchans) | 7679 ALint ALmixer_AllocateChannels(ALint numchans) |
7680 { | 7680 { |
7681 if(0 == ALmixer_Initialized) | |
7682 { | |
7683 return -1; | |
7684 } | |
7685 | |
7681 ALint retval; | 7686 ALint retval; |
7682 #ifdef ENABLE_ALMIXER_THREADS | 7687 #ifdef ENABLE_ALMIXER_THREADS |
7683 SDL_LockMutex(s_simpleLock); | 7688 SDL_LockMutex(s_simpleLock); |
7684 #endif | 7689 #endif |
7685 retval = Internal_AllocateChannels(numchans); | 7690 retval = Internal_AllocateChannels(numchans); |
7690 } | 7695 } |
7691 | 7696 |
7692 | 7697 |
7693 ALint ALmixer_ReserveChannels(ALint num) | 7698 ALint ALmixer_ReserveChannels(ALint num) |
7694 { | 7699 { |
7700 if(0 == ALmixer_Initialized) | |
7701 { | |
7702 return -1; | |
7703 } | |
7704 | |
7695 ALint retval; | 7705 ALint retval; |
7696 #ifdef ENABLE_ALMIXER_THREADS | 7706 #ifdef ENABLE_ALMIXER_THREADS |
7697 SDL_LockMutex(s_simpleLock); | 7707 SDL_LockMutex(s_simpleLock); |
7698 #endif | 7708 #endif |
7699 retval = Internal_ReserveChannels(num); | 7709 retval = Internal_ReserveChannels(num); |
8249 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) | 8259 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) |
8250 { | 8260 { |
8251 Sound_Sample* sample = NULL; | 8261 Sound_Sample* sample = NULL; |
8252 Sound_AudioInfo target; | 8262 Sound_AudioInfo target; |
8253 | 8263 |
8264 if(0 == ALmixer_Initialized) | |
8265 { | |
8266 return NULL; | |
8267 } | |
8268 | |
8254 /* Initialize target values to defaults | 8269 /* Initialize target values to defaults |
8255 * 0 tells SDL_sound to use the "actual" values | 8270 * 0 tells SDL_sound to use the "actual" values |
8256 */ | 8271 */ |
8257 target.channels = 0; | 8272 target.channels = 0; |
8258 target.rate = 0; | 8273 target.rate = 0; |
8294 */ | 8309 */ |
8295 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) | 8310 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) |
8296 { | 8311 { |
8297 Sound_Sample* sample = NULL; | 8312 Sound_Sample* sample = NULL; |
8298 Sound_AudioInfo target; | 8313 Sound_AudioInfo target; |
8314 | |
8315 if(0 == ALmixer_Initialized) | |
8316 { | |
8317 return NULL; | |
8318 } | |
8299 | 8319 |
8300 /* Initialize target values to defaults | 8320 /* Initialize target values to defaults |
8301 * 0 tells SDL_sound to use the "actual" values | 8321 * 0 tells SDL_sound to use the "actual" values |
8302 */ | 8322 */ |
8303 target.channels = 0; | 8323 target.channels = 0; |
8396 */ | 8416 */ |
8397 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) | 8417 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) |
8398 { | 8418 { |
8399 Sound_Sample* sample = NULL; | 8419 Sound_Sample* sample = NULL; |
8400 Sound_AudioInfo sound_desired; | 8420 Sound_AudioInfo sound_desired; |
8421 | |
8422 if(0 == ALmixer_Initialized) | |
8423 { | |
8424 return NULL; | |
8425 } | |
8426 | |
8401 /* Rather than copying the data from struct to struct, I could just | 8427 /* Rather than copying the data from struct to struct, I could just |
8402 * cast the thing since the structs are meant to be identical. | 8428 * cast the thing since the structs are meant to be identical. |
8403 * But if SDL_sound changes it's implementation, bad things | 8429 * But if SDL_sound changes it's implementation, bad things |
8404 * will probably happen. (Or if I change my implementation and | 8430 * will probably happen. (Or if I change my implementation and |
8405 * forget about the cast, same bad scenario.) Since this is a load | 8431 * forget about the cast, same bad scenario.) Since this is a load |
8432 */ | 8458 */ |
8433 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) | 8459 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) |
8434 { | 8460 { |
8435 Sound_Sample* sample = NULL; | 8461 Sound_Sample* sample = NULL; |
8436 Sound_AudioInfo sound_desired; | 8462 Sound_AudioInfo sound_desired; |
8463 | |
8464 if(0 == ALmixer_Initialized) | |
8465 { | |
8466 return; | |
8467 } | |
8468 | |
8437 /* Rather than copying the data from struct to struct, I could just | 8469 /* Rather than copying the data from struct to struct, I could just |
8438 * cast the thing since the structs are meant to be identical. | 8470 * cast the thing since the structs are meant to be identical. |
8439 * But if SDL_sound changes it's implementation, bad things | 8471 * But if SDL_sound changes it's implementation, bad things |
8440 * will probably happen. (Or if I change my implementation and | 8472 * will probably happen. (Or if I change my implementation and |
8441 * forget about the cast, same bad scenario.) Since this is a load | 8473 * forget about the cast, same bad scenario.) Since this is a load |
8470 if(NULL == data) | 8502 if(NULL == data) |
8471 { | 8503 { |
8472 return; | 8504 return; |
8473 } | 8505 } |
8474 | 8506 |
8507 if(0 == ALmixer_Initialized) | |
8508 { | |
8509 return; | |
8510 } | |
8511 | |
8475 /* Bypass if in interruption event */ | 8512 /* Bypass if in interruption event */ |
8476 if(NULL == alcGetCurrentContext()) | 8513 if(NULL == alcGetCurrentContext()) |
8477 { | 8514 { |
8478 fprintf(stderr, "ALmixer_FreeData: Programmer Error. You cannot delete data when the OpenAL content is currently NULL. You may have already called ALmixer_Quit() or are in an interruption event\n"); | 8515 fprintf(stderr, "ALmixer_FreeData: Programmer Error. You cannot delete data when the OpenAL content is currently NULL. You may have already called ALmixer_Quit() or are in an interruption event\n"); |
8479 return; | 8516 return; |
8541 /* This function will look up the source for the corresponding channel */ | 8578 /* This function will look up the source for the corresponding channel */ |
8542 /* Must return 0 on error instead of -1 because of unsigned int */ | 8579 /* Must return 0 on error instead of -1 because of unsigned int */ |
8543 ALuint ALmixer_GetSource(ALint channel) | 8580 ALuint ALmixer_GetSource(ALint channel) |
8544 { | 8581 { |
8545 ALuint retval; | 8582 ALuint retval; |
8583 if(0 == ALmixer_Initialized) | |
8584 { | |
8585 return 0; | |
8586 } | |
8546 #ifdef ENABLE_ALMIXER_THREADS | 8587 #ifdef ENABLE_ALMIXER_THREADS |
8547 SDL_LockMutex(s_simpleLock); | 8588 SDL_LockMutex(s_simpleLock); |
8548 #endif | 8589 #endif |
8549 retval = Internal_GetSource(channel); | 8590 retval = Internal_GetSource(channel); |
8550 #ifdef ENABLE_ALMIXER_THREADS | 8591 #ifdef ENABLE_ALMIXER_THREADS |
8555 | 8596 |
8556 /* This function will look up the channel for the corresponding source */ | 8597 /* This function will look up the channel for the corresponding source */ |
8557 ALint ALmixer_GetChannel(ALuint source) | 8598 ALint ALmixer_GetChannel(ALuint source) |
8558 { | 8599 { |
8559 ALint retval; | 8600 ALint retval; |
8601 if(0 == ALmixer_Initialized) | |
8602 { | |
8603 return -1; | |
8604 } | |
8560 #ifdef ENABLE_ALMIXER_THREADS | 8605 #ifdef ENABLE_ALMIXER_THREADS |
8561 SDL_LockMutex(s_simpleLock); | 8606 SDL_LockMutex(s_simpleLock); |
8562 #endif | 8607 #endif |
8563 retval = Internal_GetChannel(source); | 8608 retval = Internal_GetChannel(source); |
8564 #ifdef ENABLE_ALMIXER_THREADS | 8609 #ifdef ENABLE_ALMIXER_THREADS |
8568 } | 8613 } |
8569 | 8614 |
8570 ALint ALmixer_FindFreeChannel(ALint start_channel) | 8615 ALint ALmixer_FindFreeChannel(ALint start_channel) |
8571 { | 8616 { |
8572 ALint retval; | 8617 ALint retval; |
8618 if(0 == ALmixer_Initialized) | |
8619 { | |
8620 return -1; | |
8621 } | |
8573 #ifdef ENABLE_ALMIXER_THREADS | 8622 #ifdef ENABLE_ALMIXER_THREADS |
8574 SDL_LockMutex(s_simpleLock); | 8623 SDL_LockMutex(s_simpleLock); |
8575 #endif | 8624 #endif |
8576 retval = Internal_FindFreeChannel(start_channel); | 8625 retval = Internal_FindFreeChannel(start_channel); |
8577 #ifdef ENABLE_ALMIXER_THREADS | 8626 #ifdef ENABLE_ALMIXER_THREADS |
8640 | 8689 |
8641 | 8690 |
8642 ALint ALmixer_PlayChannelTimed(ALint channel, ALmixer_Data* data, ALint loops, ALint ticks) | 8691 ALint ALmixer_PlayChannelTimed(ALint channel, ALmixer_Data* data, ALint loops, ALint ticks) |
8643 { | 8692 { |
8644 ALint retval; | 8693 ALint retval; |
8694 if(0 == ALmixer_Initialized) | |
8695 { | |
8696 return -1; | |
8697 } | |
8645 #ifdef ENABLE_ALMIXER_THREADS | 8698 #ifdef ENABLE_ALMIXER_THREADS |
8646 SDL_LockMutex(s_simpleLock); | 8699 SDL_LockMutex(s_simpleLock); |
8647 #endif | 8700 #endif |
8648 retval = Internal_PlayChannelTimed(channel, data, loops, ticks); | 8701 retval = Internal_PlayChannelTimed(channel, data, loops, ticks); |
8649 #ifdef ENABLE_ALMIXER_THREADS | 8702 #ifdef ENABLE_ALMIXER_THREADS |
8666 * In this event, an error message will be returned to you. | 8719 * In this event, an error message will be returned to you. |
8667 */ | 8720 */ |
8668 ALuint ALmixer_PlaySourceTimed(ALuint source, ALmixer_Data* data, ALint loops, ALint ticks) | 8721 ALuint ALmixer_PlaySourceTimed(ALuint source, ALmixer_Data* data, ALint loops, ALint ticks) |
8669 { | 8722 { |
8670 ALuint retval; | 8723 ALuint retval; |
8724 if(0 == ALmixer_Initialized) | |
8725 { | |
8726 return 0; | |
8727 } | |
8671 #ifdef ENABLE_ALMIXER_THREADS | 8728 #ifdef ENABLE_ALMIXER_THREADS |
8672 SDL_LockMutex(s_simpleLock); | 8729 SDL_LockMutex(s_simpleLock); |
8673 #endif | 8730 #endif |
8674 retval = Internal_PlaySourceTimed(source, data, loops, ticks); | 8731 retval = Internal_PlaySourceTimed(source, data, loops, ticks); |
8675 #ifdef ENABLE_ALMIXER_THREADS | 8732 #ifdef ENABLE_ALMIXER_THREADS |
8678 return retval; | 8735 return retval; |
8679 } | 8736 } |
8680 | 8737 |
8681 | 8738 |
8682 /* Will return the number of channels halted | 8739 /* Will return the number of channels halted |
8683 * or 0 for error | 8740 * or -1 for error |
8684 */ | 8741 */ |
8685 ALint ALmixer_HaltChannel(ALint channel) | 8742 ALint ALmixer_HaltChannel(ALint channel) |
8686 { | 8743 { |
8687 ALint retval; | 8744 ALint retval; |
8745 if(0 == ALmixer_Initialized) | |
8746 { | |
8747 return -1; | |
8748 } | |
8688 #ifdef ENABLE_ALMIXER_THREADS | 8749 #ifdef ENABLE_ALMIXER_THREADS |
8689 SDL_LockMutex(s_simpleLock); | 8750 SDL_LockMutex(s_simpleLock); |
8690 #endif | 8751 #endif |
8691 retval = Internal_HaltChannel(channel, AL_FALSE); | 8752 retval = Internal_HaltChannel(channel, AL_FALSE); |
8692 #ifdef ENABLE_ALMIXER_THREADS | 8753 #ifdef ENABLE_ALMIXER_THREADS |
8699 * or 0 for error | 8760 * or 0 for error |
8700 */ | 8761 */ |
8701 ALint ALmixer_HaltSource(ALuint source) | 8762 ALint ALmixer_HaltSource(ALuint source) |
8702 { | 8763 { |
8703 ALint retval; | 8764 ALint retval; |
8765 if(0 == ALmixer_Initialized) | |
8766 { | |
8767 return -1; | |
8768 } | |
8704 #ifdef ENABLE_ALMIXER_THREADS | 8769 #ifdef ENABLE_ALMIXER_THREADS |
8705 SDL_LockMutex(s_simpleLock); | 8770 SDL_LockMutex(s_simpleLock); |
8706 #endif | 8771 #endif |
8707 retval = Internal_HaltSource(source, AL_FALSE); | 8772 retval = Internal_HaltSource(source, AL_FALSE); |
8708 #ifdef ENABLE_ALMIXER_THREADS | 8773 #ifdef ENABLE_ALMIXER_THREADS |
8717 * playback. This may require samples to be halted | 8782 * playback. This may require samples to be halted |
8718 */ | 8783 */ |
8719 ALboolean ALmixer_RewindData(ALmixer_Data* data) | 8784 ALboolean ALmixer_RewindData(ALmixer_Data* data) |
8720 { | 8785 { |
8721 ALboolean retval; | 8786 ALboolean retval; |
8787 if(0 == ALmixer_Initialized) | |
8788 { | |
8789 return AL_FALSE; | |
8790 } | |
8722 #ifdef ENABLE_ALMIXER_THREADS | 8791 #ifdef ENABLE_ALMIXER_THREADS |
8723 SDL_LockMutex(s_simpleLock); | 8792 SDL_LockMutex(s_simpleLock); |
8724 #endif | 8793 #endif |
8725 retval = Internal_RewindData(data); | 8794 retval = Internal_RewindData(data); |
8726 #ifdef ENABLE_ALMIXER_THREADS | 8795 #ifdef ENABLE_ALMIXER_THREADS |
8730 } | 8799 } |
8731 | 8800 |
8732 ALint ALmixer_RewindChannel(ALint channel) | 8801 ALint ALmixer_RewindChannel(ALint channel) |
8733 { | 8802 { |
8734 ALint retval; | 8803 ALint retval; |
8804 if(0 == ALmixer_Initialized) | |
8805 { | |
8806 return -1; | |
8807 } | |
8735 #ifdef ENABLE_ALMIXER_THREADS | 8808 #ifdef ENABLE_ALMIXER_THREADS |
8736 SDL_LockMutex(s_simpleLock); | 8809 SDL_LockMutex(s_simpleLock); |
8737 #endif | 8810 #endif |
8738 retval = Internal_RewindChannel(channel); | 8811 retval = Internal_RewindChannel(channel); |
8739 #ifdef ENABLE_ALMIXER_THREADS | 8812 #ifdef ENABLE_ALMIXER_THREADS |
8743 } | 8816 } |
8744 | 8817 |
8745 ALint ALmixer_RewindSource(ALuint source) | 8818 ALint ALmixer_RewindSource(ALuint source) |
8746 { | 8819 { |
8747 ALint retval; | 8820 ALint retval; |
8821 if(0 == ALmixer_Initialized) | |
8822 { | |
8823 return -1; | |
8824 } | |
8748 #ifdef ENABLE_ALMIXER_THREADS | 8825 #ifdef ENABLE_ALMIXER_THREADS |
8749 SDL_LockMutex(s_simpleLock); | 8826 SDL_LockMutex(s_simpleLock); |
8750 #endif | 8827 #endif |
8751 retval = Internal_RewindSource(source); | 8828 retval = Internal_RewindSource(source); |
8752 #ifdef ENABLE_ALMIXER_THREADS | 8829 #ifdef ENABLE_ALMIXER_THREADS |
8756 } | 8833 } |
8757 | 8834 |
8758 ALint ALmixer_PauseChannel(ALint channel) | 8835 ALint ALmixer_PauseChannel(ALint channel) |
8759 { | 8836 { |
8760 ALint retval; | 8837 ALint retval; |
8838 if(0 == ALmixer_Initialized) | |
8839 { | |
8840 return -1; | |
8841 } | |
8761 #ifdef ENABLE_ALMIXER_THREADS | 8842 #ifdef ENABLE_ALMIXER_THREADS |
8762 SDL_LockMutex(s_simpleLock); | 8843 SDL_LockMutex(s_simpleLock); |
8763 #endif | 8844 #endif |
8764 retval = Internal_PauseChannel(channel); | 8845 retval = Internal_PauseChannel(channel); |
8765 #ifdef ENABLE_ALMIXER_THREADS | 8846 #ifdef ENABLE_ALMIXER_THREADS |
8769 } | 8850 } |
8770 | 8851 |
8771 ALint ALmixer_PauseSource(ALuint source) | 8852 ALint ALmixer_PauseSource(ALuint source) |
8772 { | 8853 { |
8773 ALint retval; | 8854 ALint retval; |
8855 if(0 == ALmixer_Initialized) | |
8856 { | |
8857 return -1; | |
8858 } | |
8774 #ifdef ENABLE_ALMIXER_THREADS | 8859 #ifdef ENABLE_ALMIXER_THREADS |
8775 SDL_LockMutex(s_simpleLock); | 8860 SDL_LockMutex(s_simpleLock); |
8776 #endif | 8861 #endif |
8777 retval = Internal_PauseSource(source); | 8862 retval = Internal_PauseSource(source); |
8778 #ifdef ENABLE_ALMIXER_THREADS | 8863 #ifdef ENABLE_ALMIXER_THREADS |
8782 } | 8867 } |
8783 | 8868 |
8784 ALint ALmixer_ResumeChannel(ALint channel) | 8869 ALint ALmixer_ResumeChannel(ALint channel) |
8785 { | 8870 { |
8786 ALint retval; | 8871 ALint retval; |
8872 if(0 == ALmixer_Initialized) | |
8873 { | |
8874 return -1; | |
8875 } | |
8787 #ifdef ENABLE_ALMIXER_THREADS | 8876 #ifdef ENABLE_ALMIXER_THREADS |
8788 SDL_LockMutex(s_simpleLock); | 8877 SDL_LockMutex(s_simpleLock); |
8789 #endif | 8878 #endif |
8790 retval = Internal_ResumeChannel(channel); | 8879 retval = Internal_ResumeChannel(channel); |
8791 #ifdef ENABLE_ALMIXER_THREADS | 8880 #ifdef ENABLE_ALMIXER_THREADS |
8795 } | 8884 } |
8796 | 8885 |
8797 ALint ALmixer_ResumeSource(ALuint source) | 8886 ALint ALmixer_ResumeSource(ALuint source) |
8798 { | 8887 { |
8799 ALint retval; | 8888 ALint retval; |
8889 if(0 == ALmixer_Initialized) | |
8890 { | |
8891 return -1; | |
8892 } | |
8800 #ifdef ENABLE_ALMIXER_THREADS | 8893 #ifdef ENABLE_ALMIXER_THREADS |
8801 SDL_LockMutex(s_simpleLock); | 8894 SDL_LockMutex(s_simpleLock); |
8802 #endif | 8895 #endif |
8803 retval = Internal_ResumeSource(source); | 8896 retval = Internal_ResumeSource(source); |
8804 #ifdef ENABLE_ALMIXER_THREADS | 8897 #ifdef ENABLE_ALMIXER_THREADS |
8811 * This will allow seek to end to stay there because | 8904 * This will allow seek to end to stay there because |
8812 * Play automatically rewinds if at the end */ | 8905 * Play automatically rewinds if at the end */ |
8813 ALboolean ALmixer_SeekData(ALmixer_Data* data, ALuint msec) | 8906 ALboolean ALmixer_SeekData(ALmixer_Data* data, ALuint msec) |
8814 { | 8907 { |
8815 ALboolean retval; | 8908 ALboolean retval; |
8909 if(0 == ALmixer_Initialized) | |
8910 { | |
8911 return -1; | |
8912 } | |
8816 #ifdef ENABLE_ALMIXER_THREADS | 8913 #ifdef ENABLE_ALMIXER_THREADS |
8817 SDL_LockMutex(s_simpleLock); | 8914 SDL_LockMutex(s_simpleLock); |
8818 #endif | 8915 #endif |
8819 retval = Internal_SeekData(data, msec); | 8916 retval = Internal_SeekData(data, msec); |
8820 #ifdef ENABLE_ALMIXER_THREADS | 8917 #ifdef ENABLE_ALMIXER_THREADS |
8824 } | 8921 } |
8825 | 8922 |
8826 ALint ALmixer_SeekChannel(ALint channel, ALuint msec) | 8923 ALint ALmixer_SeekChannel(ALint channel, ALuint msec) |
8827 { | 8924 { |
8828 ALint retval; | 8925 ALint retval; |
8926 if(0 == ALmixer_Initialized) | |
8927 { | |
8928 return -1; | |
8929 } | |
8829 #ifdef ENABLE_ALMIXER_THREADS | 8930 #ifdef ENABLE_ALMIXER_THREADS |
8830 SDL_LockMutex(s_simpleLock); | 8931 SDL_LockMutex(s_simpleLock); |
8831 #endif | 8932 #endif |
8832 retval = Internal_SeekChannel(channel, msec); | 8933 retval = Internal_SeekChannel(channel, msec); |
8833 #ifdef ENABLE_ALMIXER_THREADS | 8934 #ifdef ENABLE_ALMIXER_THREADS |
8837 } | 8938 } |
8838 | 8939 |
8839 ALint ALmixer_SeekSource(ALuint source, ALuint msec) | 8940 ALint ALmixer_SeekSource(ALuint source, ALuint msec) |
8840 { | 8941 { |
8841 ALint retval; | 8942 ALint retval; |
8943 if(0 == ALmixer_Initialized) | |
8944 { | |
8945 return -1; | |
8946 } | |
8842 #ifdef ENABLE_ALMIXER_THREADS | 8947 #ifdef ENABLE_ALMIXER_THREADS |
8843 SDL_LockMutex(s_simpleLock); | 8948 SDL_LockMutex(s_simpleLock); |
8844 #endif | 8949 #endif |
8845 retval = Internal_SeekSource(source, msec); | 8950 retval = Internal_SeekSource(source, msec); |
8846 #ifdef ENABLE_ALMIXER_THREADS | 8951 #ifdef ENABLE_ALMIXER_THREADS |
8850 } | 8955 } |
8851 | 8956 |
8852 ALint ALmixer_FadeInChannelTimed(ALint channel, ALmixer_Data* data, ALint loops, ALuint fade_ticks, ALint expire_ticks) | 8957 ALint ALmixer_FadeInChannelTimed(ALint channel, ALmixer_Data* data, ALint loops, ALuint fade_ticks, ALint expire_ticks) |
8853 { | 8958 { |
8854 ALint retval; | 8959 ALint retval; |
8960 if(0 == ALmixer_Initialized) | |
8961 { | |
8962 return -1; | |
8963 } | |
8855 #ifdef ENABLE_ALMIXER_THREADS | 8964 #ifdef ENABLE_ALMIXER_THREADS |
8856 SDL_LockMutex(s_simpleLock); | 8965 SDL_LockMutex(s_simpleLock); |
8857 #endif | 8966 #endif |
8858 retval = Internal_FadeInChannelTimed(channel, data, loops, fade_ticks, expire_ticks); | 8967 retval = Internal_FadeInChannelTimed(channel, data, loops, fade_ticks, expire_ticks); |
8859 #ifdef ENABLE_ALMIXER_THREADS | 8968 #ifdef ENABLE_ALMIXER_THREADS |
8863 } | 8972 } |
8864 | 8973 |
8865 ALuint ALmixer_FadeInSourceTimed(ALuint source, ALmixer_Data* data, ALint loops, ALuint fade_ticks, ALint expire_ticks) | 8974 ALuint ALmixer_FadeInSourceTimed(ALuint source, ALmixer_Data* data, ALint loops, ALuint fade_ticks, ALint expire_ticks) |
8866 { | 8975 { |
8867 ALuint retval; | 8976 ALuint retval; |
8977 if(0 == ALmixer_Initialized) | |
8978 { | |
8979 return 0; | |
8980 } | |
8868 #ifdef ENABLE_ALMIXER_THREADS | 8981 #ifdef ENABLE_ALMIXER_THREADS |
8869 SDL_LockMutex(s_simpleLock); | 8982 SDL_LockMutex(s_simpleLock); |
8870 #endif | 8983 #endif |
8871 retval = Internal_FadeInSourceTimed(source, data, loops, fade_ticks, expire_ticks); | 8984 retval = Internal_FadeInSourceTimed(source, data, loops, fade_ticks, expire_ticks); |
8872 #ifdef ENABLE_ALMIXER_THREADS | 8985 #ifdef ENABLE_ALMIXER_THREADS |
8876 } | 8989 } |
8877 | 8990 |
8878 ALint ALmixer_FadeOutChannel(ALint channel, ALuint ticks) | 8991 ALint ALmixer_FadeOutChannel(ALint channel, ALuint ticks) |
8879 { | 8992 { |
8880 ALint retval; | 8993 ALint retval; |
8994 if(0 == ALmixer_Initialized) | |
8995 { | |
8996 return -1; | |
8997 } | |
8881 #ifdef ENABLE_ALMIXER_THREADS | 8998 #ifdef ENABLE_ALMIXER_THREADS |
8882 SDL_LockMutex(s_simpleLock); | 8999 SDL_LockMutex(s_simpleLock); |
8883 #endif | 9000 #endif |
8884 retval = Internal_FadeOutChannel(channel, ticks); | 9001 retval = Internal_FadeOutChannel(channel, ticks); |
8885 #ifdef ENABLE_ALMIXER_THREADS | 9002 #ifdef ENABLE_ALMIXER_THREADS |
8889 } | 9006 } |
8890 | 9007 |
8891 ALint ALmixer_FadeOutSource(ALuint source, ALuint ticks) | 9008 ALint ALmixer_FadeOutSource(ALuint source, ALuint ticks) |
8892 { | 9009 { |
8893 ALint retval; | 9010 ALint retval; |
9011 if(0 == ALmixer_Initialized) | |
9012 { | |
9013 return 0; | |
9014 } | |
8894 #ifdef ENABLE_ALMIXER_THREADS | 9015 #ifdef ENABLE_ALMIXER_THREADS |
8895 SDL_LockMutex(s_simpleLock); | 9016 SDL_LockMutex(s_simpleLock); |
8896 #endif | 9017 #endif |
8897 retval = Internal_FadeOutSource(source, ticks); | 9018 retval = Internal_FadeOutSource(source, ticks); |
8898 #ifdef ENABLE_ALMIXER_THREADS | 9019 #ifdef ENABLE_ALMIXER_THREADS |
8902 } | 9023 } |
8903 | 9024 |
8904 ALint ALmixer_FadeChannel(ALint channel, ALuint ticks, ALfloat volume) | 9025 ALint ALmixer_FadeChannel(ALint channel, ALuint ticks, ALfloat volume) |
8905 { | 9026 { |
8906 ALint retval; | 9027 ALint retval; |
9028 if(0 == ALmixer_Initialized) | |
9029 { | |
9030 return 0; | |
9031 } | |
8907 #ifdef ENABLE_ALMIXER_THREADS | 9032 #ifdef ENABLE_ALMIXER_THREADS |
8908 SDL_LockMutex(s_simpleLock); | 9033 SDL_LockMutex(s_simpleLock); |
8909 #endif | 9034 #endif |
8910 retval = Internal_FadeChannel(channel, ticks, volume); | 9035 retval = Internal_FadeChannel(channel, ticks, volume); |
8911 #ifdef ENABLE_ALMIXER_THREADS | 9036 #ifdef ENABLE_ALMIXER_THREADS |
8915 } | 9040 } |
8916 | 9041 |
8917 ALint ALmixer_FadeSource(ALuint source, ALuint ticks, ALfloat volume) | 9042 ALint ALmixer_FadeSource(ALuint source, ALuint ticks, ALfloat volume) |
8918 { | 9043 { |
8919 ALint retval; | 9044 ALint retval; |
9045 if(0 == ALmixer_Initialized) | |
9046 { | |
9047 return -1; | |
9048 } | |
8920 #ifdef ENABLE_ALMIXER_THREADS | 9049 #ifdef ENABLE_ALMIXER_THREADS |
8921 SDL_LockMutex(s_simpleLock); | 9050 SDL_LockMutex(s_simpleLock); |
8922 #endif | 9051 #endif |
8923 retval = Internal_FadeSource(source, ticks, volume); | 9052 retval = Internal_FadeSource(source, ticks, volume); |
8924 #ifdef ENABLE_ALMIXER_THREADS | 9053 #ifdef ENABLE_ALMIXER_THREADS |
8929 | 9058 |
8930 | 9059 |
8931 ALboolean ALmixer_SetVolumeChannel(ALint channel, ALfloat volume) | 9060 ALboolean ALmixer_SetVolumeChannel(ALint channel, ALfloat volume) |
8932 { | 9061 { |
8933 ALboolean retval; | 9062 ALboolean retval; |
9063 if(0 == ALmixer_Initialized) | |
9064 { | |
9065 return AL_FALSE; | |
9066 } | |
8934 #ifdef ENABLE_ALMIXER_THREADS | 9067 #ifdef ENABLE_ALMIXER_THREADS |
8935 SDL_LockMutex(s_simpleLock); | 9068 SDL_LockMutex(s_simpleLock); |
8936 #endif | 9069 #endif |
8937 retval = Internal_SetVolumeChannel(channel, volume); | 9070 retval = Internal_SetVolumeChannel(channel, volume); |
8938 #ifdef ENABLE_ALMIXER_THREADS | 9071 #ifdef ENABLE_ALMIXER_THREADS |
8942 } | 9075 } |
8943 | 9076 |
8944 ALboolean ALmixer_SetVolumeSource(ALuint source, ALfloat volume) | 9077 ALboolean ALmixer_SetVolumeSource(ALuint source, ALfloat volume) |
8945 { | 9078 { |
8946 ALboolean retval; | 9079 ALboolean retval; |
9080 if(0 == ALmixer_Initialized) | |
9081 { | |
9082 return AL_FALSE; | |
9083 } | |
8947 #ifdef ENABLE_ALMIXER_THREADS | 9084 #ifdef ENABLE_ALMIXER_THREADS |
8948 SDL_LockMutex(s_simpleLock); | 9085 SDL_LockMutex(s_simpleLock); |
8949 #endif | 9086 #endif |
8950 retval = Internal_SetVolumeSource(source, volume); | 9087 retval = Internal_SetVolumeSource(source, volume); |
8951 #ifdef ENABLE_ALMIXER_THREADS | 9088 #ifdef ENABLE_ALMIXER_THREADS |
8955 } | 9092 } |
8956 | 9093 |
8957 ALfloat ALmixer_GetVolumeChannel(ALint channel) | 9094 ALfloat ALmixer_GetVolumeChannel(ALint channel) |
8958 { | 9095 { |
8959 ALfloat retval; | 9096 ALfloat retval; |
9097 if(0 == ALmixer_Initialized) | |
9098 { | |
9099 return -1.0f; | |
9100 } | |
8960 #ifdef ENABLE_ALMIXER_THREADS | 9101 #ifdef ENABLE_ALMIXER_THREADS |
8961 SDL_LockMutex(s_simpleLock); | 9102 SDL_LockMutex(s_simpleLock); |
8962 #endif | 9103 #endif |
8963 retval = Internal_GetVolumeChannel(channel); | 9104 retval = Internal_GetVolumeChannel(channel); |
8964 #ifdef ENABLE_ALMIXER_THREADS | 9105 #ifdef ENABLE_ALMIXER_THREADS |
8968 } | 9109 } |
8969 | 9110 |
8970 ALfloat ALmixer_GetVolumeSource(ALuint source) | 9111 ALfloat ALmixer_GetVolumeSource(ALuint source) |
8971 { | 9112 { |
8972 ALfloat retval; | 9113 ALfloat retval; |
9114 if(0 == ALmixer_Initialized) | |
9115 { | |
9116 return -1.0f; | |
9117 } | |
8973 #ifdef ENABLE_ALMIXER_THREADS | 9118 #ifdef ENABLE_ALMIXER_THREADS |
8974 SDL_LockMutex(s_simpleLock); | 9119 SDL_LockMutex(s_simpleLock); |
8975 #endif | 9120 #endif |
8976 retval = Internal_GetVolumeSource(source); | 9121 retval = Internal_GetVolumeSource(source); |
8977 #ifdef ENABLE_ALMIXER_THREADS | 9122 #ifdef ENABLE_ALMIXER_THREADS |
8981 } | 9126 } |
8982 | 9127 |
8983 ALboolean ALmixer_SetMaxVolumeChannel(ALint channel, ALfloat volume) | 9128 ALboolean ALmixer_SetMaxVolumeChannel(ALint channel, ALfloat volume) |
8984 { | 9129 { |
8985 ALboolean retval; | 9130 ALboolean retval; |
9131 if(0 == ALmixer_Initialized) | |
9132 { | |
9133 return AL_FALSE; | |
9134 } | |
8986 #ifdef ENABLE_ALMIXER_THREADS | 9135 #ifdef ENABLE_ALMIXER_THREADS |
8987 SDL_LockMutex(s_simpleLock); | 9136 SDL_LockMutex(s_simpleLock); |
8988 #endif | 9137 #endif |
8989 retval = Internal_SetMaxVolumeChannel(channel, volume); | 9138 retval = Internal_SetMaxVolumeChannel(channel, volume); |
8990 #ifdef ENABLE_ALMIXER_THREADS | 9139 #ifdef ENABLE_ALMIXER_THREADS |
8994 } | 9143 } |
8995 | 9144 |
8996 ALboolean ALmixer_SetMaxVolumeSource(ALuint source, ALfloat volume) | 9145 ALboolean ALmixer_SetMaxVolumeSource(ALuint source, ALfloat volume) |
8997 { | 9146 { |
8998 ALboolean retval; | 9147 ALboolean retval; |
9148 if(0 == ALmixer_Initialized) | |
9149 { | |
9150 return AL_FALSE; | |
9151 } | |
8999 #ifdef ENABLE_ALMIXER_THREADS | 9152 #ifdef ENABLE_ALMIXER_THREADS |
9000 SDL_LockMutex(s_simpleLock); | 9153 SDL_LockMutex(s_simpleLock); |
9001 #endif | 9154 #endif |
9002 retval = Internal_SetMaxVolumeSource(source, volume); | 9155 retval = Internal_SetMaxVolumeSource(source, volume); |
9003 #ifdef ENABLE_ALMIXER_THREADS | 9156 #ifdef ENABLE_ALMIXER_THREADS |
9007 } | 9160 } |
9008 | 9161 |
9009 ALfloat ALmixer_GetMaxVolumeChannel(ALint channel) | 9162 ALfloat ALmixer_GetMaxVolumeChannel(ALint channel) |
9010 { | 9163 { |
9011 ALfloat retval; | 9164 ALfloat retval; |
9165 if(0 == ALmixer_Initialized) | |
9166 { | |
9167 return -1.0f; | |
9168 } | |
9012 #ifdef ENABLE_ALMIXER_THREADS | 9169 #ifdef ENABLE_ALMIXER_THREADS |
9013 SDL_LockMutex(s_simpleLock); | 9170 SDL_LockMutex(s_simpleLock); |
9014 #endif | 9171 #endif |
9015 retval = Internal_GetMaxVolumeChannel(channel); | 9172 retval = Internal_GetMaxVolumeChannel(channel); |
9016 #ifdef ENABLE_ALMIXER_THREADS | 9173 #ifdef ENABLE_ALMIXER_THREADS |
9020 } | 9177 } |
9021 | 9178 |
9022 ALfloat ALmixer_GetMaxVolumeSource(ALuint source) | 9179 ALfloat ALmixer_GetMaxVolumeSource(ALuint source) |
9023 { | 9180 { |
9024 ALfloat retval; | 9181 ALfloat retval; |
9182 if(0 == ALmixer_Initialized) | |
9183 { | |
9184 return -1.0f; | |
9185 } | |
9025 #ifdef ENABLE_ALMIXER_THREADS | 9186 #ifdef ENABLE_ALMIXER_THREADS |
9026 SDL_LockMutex(s_simpleLock); | 9187 SDL_LockMutex(s_simpleLock); |
9027 #endif | 9188 #endif |
9028 retval = Internal_GetMaxVolumeSource(source); | 9189 retval = Internal_GetMaxVolumeSource(source); |
9029 #ifdef ENABLE_ALMIXER_THREADS | 9190 #ifdef ENABLE_ALMIXER_THREADS |
9034 | 9195 |
9035 | 9196 |
9036 ALboolean ALmixer_SetMinVolumeChannel(ALint channel, ALfloat volume) | 9197 ALboolean ALmixer_SetMinVolumeChannel(ALint channel, ALfloat volume) |
9037 { | 9198 { |
9038 ALboolean retval; | 9199 ALboolean retval; |
9200 if(0 == ALmixer_Initialized) | |
9201 { | |
9202 return AL_FALSE; | |
9203 } | |
9039 #ifdef ENABLE_ALMIXER_THREADS | 9204 #ifdef ENABLE_ALMIXER_THREADS |
9040 SDL_LockMutex(s_simpleLock); | 9205 SDL_LockMutex(s_simpleLock); |
9041 #endif | 9206 #endif |
9042 retval = Internal_SetMinVolumeChannel(channel, volume); | 9207 retval = Internal_SetMinVolumeChannel(channel, volume); |
9043 #ifdef ENABLE_ALMIXER_THREADS | 9208 #ifdef ENABLE_ALMIXER_THREADS |
9047 } | 9212 } |
9048 | 9213 |
9049 ALboolean ALmixer_SetMinVolumeSource(ALuint source, ALfloat volume) | 9214 ALboolean ALmixer_SetMinVolumeSource(ALuint source, ALfloat volume) |
9050 { | 9215 { |
9051 ALboolean retval; | 9216 ALboolean retval; |
9217 if(0 == ALmixer_Initialized) | |
9218 { | |
9219 return AL_FALSE; | |
9220 } | |
9052 #ifdef ENABLE_ALMIXER_THREADS | 9221 #ifdef ENABLE_ALMIXER_THREADS |
9053 SDL_LockMutex(s_simpleLock); | 9222 SDL_LockMutex(s_simpleLock); |
9054 #endif | 9223 #endif |
9055 retval = Internal_SetMinVolumeSource(source, volume); | 9224 retval = Internal_SetMinVolumeSource(source, volume); |
9056 #ifdef ENABLE_ALMIXER_THREADS | 9225 #ifdef ENABLE_ALMIXER_THREADS |
9060 } | 9229 } |
9061 | 9230 |
9062 ALfloat ALmixer_GetMinVolumeChannel(ALint channel) | 9231 ALfloat ALmixer_GetMinVolumeChannel(ALint channel) |
9063 { | 9232 { |
9064 ALfloat retval; | 9233 ALfloat retval; |
9234 if(0 == ALmixer_Initialized) | |
9235 { | |
9236 return -1.0f; | |
9237 } | |
9065 #ifdef ENABLE_ALMIXER_THREADS | 9238 #ifdef ENABLE_ALMIXER_THREADS |
9066 SDL_LockMutex(s_simpleLock); | 9239 SDL_LockMutex(s_simpleLock); |
9067 #endif | 9240 #endif |
9068 retval = Internal_GetMinVolumeChannel(channel); | 9241 retval = Internal_GetMinVolumeChannel(channel); |
9069 #ifdef ENABLE_ALMIXER_THREADS | 9242 #ifdef ENABLE_ALMIXER_THREADS |
9073 } | 9246 } |
9074 | 9247 |
9075 ALfloat ALmixer_GetMinVolumeSource(ALuint source) | 9248 ALfloat ALmixer_GetMinVolumeSource(ALuint source) |
9076 { | 9249 { |
9077 ALfloat retval; | 9250 ALfloat retval; |
9251 if(0 == ALmixer_Initialized) | |
9252 { | |
9253 return -1.0f; | |
9254 } | |
9078 #ifdef ENABLE_ALMIXER_THREADS | 9255 #ifdef ENABLE_ALMIXER_THREADS |
9079 SDL_LockMutex(s_simpleLock); | 9256 SDL_LockMutex(s_simpleLock); |
9080 #endif | 9257 #endif |
9081 retval = Internal_GetMinVolumeSource(source); | 9258 retval = Internal_GetMinVolumeSource(source); |
9082 #ifdef ENABLE_ALMIXER_THREADS | 9259 #ifdef ENABLE_ALMIXER_THREADS |
9088 | 9265 |
9089 | 9266 |
9090 ALboolean ALmixer_SetMasterVolume(ALfloat volume) | 9267 ALboolean ALmixer_SetMasterVolume(ALfloat volume) |
9091 { | 9268 { |
9092 ALboolean retval; | 9269 ALboolean retval; |
9270 if(0 == ALmixer_Initialized) | |
9271 { | |
9272 return AL_FALSE; | |
9273 } | |
9093 #ifdef ENABLE_ALMIXER_THREADS | 9274 #ifdef ENABLE_ALMIXER_THREADS |
9094 SDL_LockMutex(s_simpleLock); | 9275 SDL_LockMutex(s_simpleLock); |
9095 #endif | 9276 #endif |
9096 retval = Internal_SetMasterVolume(volume); | 9277 retval = Internal_SetMasterVolume(volume); |
9097 #ifdef ENABLE_ALMIXER_THREADS | 9278 #ifdef ENABLE_ALMIXER_THREADS |
9101 } | 9282 } |
9102 | 9283 |
9103 ALfloat ALmixer_GetMasterVolume() | 9284 ALfloat ALmixer_GetMasterVolume() |
9104 { | 9285 { |
9105 ALfloat retval; | 9286 ALfloat retval; |
9287 if(0 == ALmixer_Initialized) | |
9288 { | |
9289 return -1.0f; | |
9290 } | |
9106 #ifdef ENABLE_ALMIXER_THREADS | 9291 #ifdef ENABLE_ALMIXER_THREADS |
9107 SDL_LockMutex(s_simpleLock); | 9292 SDL_LockMutex(s_simpleLock); |
9108 #endif | 9293 #endif |
9109 retval = Internal_GetMasterVolume(); | 9294 retval = Internal_GetMasterVolume(); |
9110 #ifdef ENABLE_ALMIXER_THREADS | 9295 #ifdef ENABLE_ALMIXER_THREADS |
9114 } | 9299 } |
9115 | 9300 |
9116 ALint ALmixer_ExpireChannel(ALint channel, ALint ticks) | 9301 ALint ALmixer_ExpireChannel(ALint channel, ALint ticks) |
9117 { | 9302 { |
9118 ALint retval; | 9303 ALint retval; |
9304 if(0 == ALmixer_Initialized) | |
9305 { | |
9306 return -1; | |
9307 } | |
9119 #ifdef ENABLE_ALMIXER_THREADS | 9308 #ifdef ENABLE_ALMIXER_THREADS |
9120 SDL_LockMutex(s_simpleLock); | 9309 SDL_LockMutex(s_simpleLock); |
9121 #endif | 9310 #endif |
9122 retval = Internal_ExpireChannel(channel, ticks); | 9311 retval = Internal_ExpireChannel(channel, ticks); |
9123 #ifdef ENABLE_ALMIXER_THREADS | 9312 #ifdef ENABLE_ALMIXER_THREADS |
9127 } | 9316 } |
9128 | 9317 |
9129 ALint ALmixer_ExpireSource(ALuint source, ALint ticks) | 9318 ALint ALmixer_ExpireSource(ALuint source, ALint ticks) |
9130 { | 9319 { |
9131 ALint retval; | 9320 ALint retval; |
9321 if(0 == ALmixer_Initialized) | |
9322 { | |
9323 return -1; | |
9324 } | |
9132 #ifdef ENABLE_ALMIXER_THREADS | 9325 #ifdef ENABLE_ALMIXER_THREADS |
9133 SDL_LockMutex(s_simpleLock); | 9326 SDL_LockMutex(s_simpleLock); |
9134 #endif | 9327 #endif |
9135 retval = Internal_ExpireSource(source, ticks); | 9328 retval = Internal_ExpireSource(source, ticks); |
9136 #ifdef ENABLE_ALMIXER_THREADS | 9329 #ifdef ENABLE_ALMIXER_THREADS |
9140 } | 9333 } |
9141 | 9334 |
9142 ALint ALmixer_IsActiveChannel(ALint channel) | 9335 ALint ALmixer_IsActiveChannel(ALint channel) |
9143 { | 9336 { |
9144 ALint retval; | 9337 ALint retval; |
9338 if(0 == ALmixer_Initialized) | |
9339 { | |
9340 return -1; | |
9341 } | |
9145 #ifdef ENABLE_ALMIXER_THREADS | 9342 #ifdef ENABLE_ALMIXER_THREADS |
9146 SDL_LockMutex(s_simpleLock); | 9343 SDL_LockMutex(s_simpleLock); |
9147 #endif | 9344 #endif |
9148 retval = Internal_QueryChannel(channel); | 9345 retval = Internal_QueryChannel(channel); |
9149 #ifdef ENABLE_ALMIXER_THREADS | 9346 #ifdef ENABLE_ALMIXER_THREADS |
9153 } | 9350 } |
9154 | 9351 |
9155 ALint ALmixer_IsActiveSource(ALuint source) | 9352 ALint ALmixer_IsActiveSource(ALuint source) |
9156 { | 9353 { |
9157 ALint retval; | 9354 ALint retval; |
9355 if(0 == ALmixer_Initialized) | |
9356 { | |
9357 return -1; | |
9358 } | |
9158 #ifdef ENABLE_ALMIXER_THREADS | 9359 #ifdef ENABLE_ALMIXER_THREADS |
9159 SDL_LockMutex(s_simpleLock); | 9360 SDL_LockMutex(s_simpleLock); |
9160 #endif | 9361 #endif |
9161 retval = Internal_QuerySource(source); | 9362 retval = Internal_QuerySource(source); |
9162 #ifdef ENABLE_ALMIXER_THREADS | 9363 #ifdef ENABLE_ALMIXER_THREADS |
9167 | 9368 |
9168 | 9369 |
9169 ALint ALmixer_IsPlayingChannel(ALint channel) | 9370 ALint ALmixer_IsPlayingChannel(ALint channel) |
9170 { | 9371 { |
9171 ALint retval; | 9372 ALint retval; |
9373 if(0 == ALmixer_Initialized) | |
9374 { | |
9375 return -1; | |
9376 } | |
9172 #ifdef ENABLE_ALMIXER_THREADS | 9377 #ifdef ENABLE_ALMIXER_THREADS |
9173 SDL_LockMutex(s_simpleLock); | 9378 SDL_LockMutex(s_simpleLock); |
9174 #endif | 9379 #endif |
9175 retval = Internal_PlayingChannel(channel); | 9380 retval = Internal_PlayingChannel(channel); |
9176 #ifdef ENABLE_ALMIXER_THREADS | 9381 #ifdef ENABLE_ALMIXER_THREADS |
9180 } | 9385 } |
9181 | 9386 |
9182 ALint ALmixer_IsPlayingSource(ALuint source) | 9387 ALint ALmixer_IsPlayingSource(ALuint source) |
9183 { | 9388 { |
9184 ALint retval; | 9389 ALint retval; |
9390 if(0 == ALmixer_Initialized) | |
9391 { | |
9392 return -1; | |
9393 } | |
9185 #ifdef ENABLE_ALMIXER_THREADS | 9394 #ifdef ENABLE_ALMIXER_THREADS |
9186 SDL_LockMutex(s_simpleLock); | 9395 SDL_LockMutex(s_simpleLock); |
9187 #endif | 9396 #endif |
9188 retval = Internal_PlayingSource(source); | 9397 retval = Internal_PlayingSource(source); |
9189 #ifdef ENABLE_ALMIXER_THREADS | 9398 #ifdef ENABLE_ALMIXER_THREADS |
9194 | 9403 |
9195 | 9404 |
9196 ALint ALmixer_IsPausedChannel(ALint channel) | 9405 ALint ALmixer_IsPausedChannel(ALint channel) |
9197 { | 9406 { |
9198 ALint retval; | 9407 ALint retval; |
9408 if(0 == ALmixer_Initialized) | |
9409 { | |
9410 return -1; | |
9411 } | |
9199 #ifdef ENABLE_ALMIXER_THREADS | 9412 #ifdef ENABLE_ALMIXER_THREADS |
9200 SDL_LockMutex(s_simpleLock); | 9413 SDL_LockMutex(s_simpleLock); |
9201 #endif | 9414 #endif |
9202 retval = Internal_PausedChannel(channel); | 9415 retval = Internal_PausedChannel(channel); |
9203 #ifdef ENABLE_ALMIXER_THREADS | 9416 #ifdef ENABLE_ALMIXER_THREADS |
9207 } | 9420 } |
9208 | 9421 |
9209 ALint ALmixer_IsPausedSource(ALuint source) | 9422 ALint ALmixer_IsPausedSource(ALuint source) |
9210 { | 9423 { |
9211 ALint retval; | 9424 ALint retval; |
9425 if(0 == ALmixer_Initialized) | |
9426 { | |
9427 return -1; | |
9428 } | |
9212 #ifdef ENABLE_ALMIXER_THREADS | 9429 #ifdef ENABLE_ALMIXER_THREADS |
9213 SDL_LockMutex(s_simpleLock); | 9430 SDL_LockMutex(s_simpleLock); |
9214 #endif | 9431 #endif |
9215 retval = Internal_PausedSource(source); | 9432 retval = Internal_PausedSource(source); |
9216 #ifdef ENABLE_ALMIXER_THREADS | 9433 #ifdef ENABLE_ALMIXER_THREADS |
9221 | 9438 |
9222 | 9439 |
9223 ALuint ALmixer_CountAllFreeChannels() | 9440 ALuint ALmixer_CountAllFreeChannels() |
9224 { | 9441 { |
9225 ALuint retval; | 9442 ALuint retval; |
9443 if(0 == ALmixer_Initialized) | |
9444 { | |
9445 return 0; | |
9446 } | |
9226 #ifdef ENABLE_ALMIXER_THREADS | 9447 #ifdef ENABLE_ALMIXER_THREADS |
9227 SDL_LockMutex(s_simpleLock); | 9448 SDL_LockMutex(s_simpleLock); |
9228 #endif | 9449 #endif |
9229 retval = Internal_CountAllFreeChannels(); | 9450 retval = Internal_CountAllFreeChannels(); |
9230 #ifdef ENABLE_ALMIXER_THREADS | 9451 #ifdef ENABLE_ALMIXER_THREADS |
9234 } | 9455 } |
9235 | 9456 |
9236 ALuint ALmixer_CountUnreservedFreeChannels() | 9457 ALuint ALmixer_CountUnreservedFreeChannels() |
9237 { | 9458 { |
9238 ALuint retval; | 9459 ALuint retval; |
9460 if(0 == ALmixer_Initialized) | |
9461 { | |
9462 return 0; | |
9463 } | |
9239 #ifdef ENABLE_ALMIXER_THREADS | 9464 #ifdef ENABLE_ALMIXER_THREADS |
9240 SDL_LockMutex(s_simpleLock); | 9465 SDL_LockMutex(s_simpleLock); |
9241 #endif | 9466 #endif |
9242 retval = Internal_CountUnreservedFreeChannels(); | 9467 retval = Internal_CountUnreservedFreeChannels(); |
9243 #ifdef ENABLE_ALMIXER_THREADS | 9468 #ifdef ENABLE_ALMIXER_THREADS |
9247 } | 9472 } |
9248 | 9473 |
9249 ALuint ALmixer_CountAllUsedChannels() | 9474 ALuint ALmixer_CountAllUsedChannels() |
9250 { | 9475 { |
9251 ALuint retval; | 9476 ALuint retval; |
9477 if(0 == ALmixer_Initialized) | |
9478 { | |
9479 return 0; | |
9480 } | |
9252 #ifdef ENABLE_ALMIXER_THREADS | 9481 #ifdef ENABLE_ALMIXER_THREADS |
9253 SDL_LockMutex(s_simpleLock); | 9482 SDL_LockMutex(s_simpleLock); |
9254 #endif | 9483 #endif |
9255 retval = Internal_CountAllUsedChannels(); | 9484 retval = Internal_CountAllUsedChannels(); |
9256 #ifdef ENABLE_ALMIXER_THREADS | 9485 #ifdef ENABLE_ALMIXER_THREADS |
9260 } | 9489 } |
9261 | 9490 |
9262 ALuint ALmixer_CountUnreservedUsedChannels() | 9491 ALuint ALmixer_CountUnreservedUsedChannels() |
9263 { | 9492 { |
9264 ALuint retval; | 9493 ALuint retval; |
9494 if(0 == ALmixer_Initialized) | |
9495 { | |
9496 return 0; | |
9497 } | |
9265 #ifdef ENABLE_ALMIXER_THREADS | 9498 #ifdef ENABLE_ALMIXER_THREADS |
9266 SDL_LockMutex(s_simpleLock); | 9499 SDL_LockMutex(s_simpleLock); |
9267 #endif | 9500 #endif |
9268 retval = Internal_CountUnreservedUsedChannels(); | 9501 retval = Internal_CountUnreservedUsedChannels(); |
9269 #ifdef ENABLE_ALMIXER_THREADS | 9502 #ifdef ENABLE_ALMIXER_THREADS |