openalbridge/wrappers.c
changeset 2443 fececcbc2189
parent 2419 dbaaba09146d
child 2444 ace11b7d8eab
equal deleted inserted replaced
2442:228757f6c54d 2443:fececcbc2189
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  */
    17  */
    18 
    18 
    19 #include "wrappers.h"
    19 #include "wrappers.h"
    20 
    20 
       
    21 extern char *prog;
    21 
    22 
    22 #ifdef __CPLUSPLUS
    23 #ifdef __CPLUSPLUS
    23 extern "C" {
    24 extern "C" {
    24 #endif 
    25 #endif 
    25         
    26         
    76                         return error;
    77                         return error;
    77                 } else 
    78                 } else 
    78                         return AL_TRUE;
    79                         return AL_TRUE;
    79         }
    80         }
    80         
    81         
    81         void *helper_fadein(void *tmp) {
    82  /*       void *helper_fadein(void *tmp) {
    82                 ALfloat gain;
    83                 ALfloat gain;
    83                 ALfloat target_gain;
    84                 ALfloat target_gain;
    84                 fade_t *fade;
    85                 fade_t *fade;
    85                 uint32_t index; 
    86                 uint32_t index; 
    86                 uint16_t quantity; 
    87                 uint16_t quantity; 
    92                 
    93                 
    93 #ifdef DEBUG
    94 #ifdef DEBUG
    94                 err_msg("(%s) INFO - Fade-in in progress [index %d quantity %d]", prog, index, quantity);
    95                 err_msg("(%s) INFO - Fade-in in progress [index %d quantity %d]", prog, index, quantity);
    95 #endif
    96 #endif
    96                 
    97                 
    97                 /*save the volume desired after the fade*/
    98                 /*save the volume desired after the fade
    98                 alGetSourcef(Sources[index], AL_GAIN, &target_gain);
    99                 alGetSourcef(Sources[index], AL_GAIN, &target_gain);
    99                 if (target_gain > 1.0f || target_gain <= 0.0f)
   100                 if (target_gain > 1.0f || target_gain <= 0.0f)
   100                         target_gain = 1.0f;
   101                         target_gain = 1.0f;
   101                 
   102                 
   102                 alSourcePlay(Sources[index]);
   103                 alSourcePlay(Sources[index]);
   145                         usleep(10000);
   146                         usleep(10000);
   146                 }
   147                 }
   147                 
   148                 
   148                 AlGetError("(%s) WARN - Failed to set fade-out volume level");
   149                 AlGetError("(%s) WARN - Failed to set fade-out volume level");
   149                 
   150                 
   150                 /*stop that sound and reset its volume*/
   151                 /*stop that sound and reset its volume
   151                 alSourceStop (Sources[index]);
   152                 alSourceStop (Sources[index]);
   152                 alSourcef (Sources[index], AL_GAIN, old_gain);	
   153                 alSourcef (Sources[index], AL_GAIN, old_gain);	
   153                 
   154                 
   154 #ifndef _WIN32
   155 #ifndef _WIN32
   155                 pthread_exit(NULL);
   156                 pthread_exit(NULL);
   157                 _endthread();
   158                 _endthread();
   158 #endif
   159 #endif
   159                 return 0;
   160                 return 0;
   160         }
   161         }
   161         
   162         
   162         
   163         */
   163 #ifdef __CPLUSPLUS
   164 #ifdef __CPLUSPLUS
   164 }
   165 }
   165 #endif
   166 #endif