openalbridge/wrappers.c
changeset 2494 1e10a47cabea
parent 2444 ace11b7d8eab
child 2515 51d3f4b6293a
equal deleted inserted replaced
2493:08313e4080e4 2494:1e10a47cabea
    18 
    18 
    19 #include "wrappers.h"
    19 #include "wrappers.h"
    20 
    20 
    21 extern char *prog;
    21 extern char *prog;
    22 
    22 
    23 //extern ALint *Sources;
    23 extern ALint Sources[MAX_SOURCES];
    24 
    24 
    25 void *Malloc (size_t nbytes) {
    25 void *Malloc (size_t nbytes) {
    26         void *aptr;
    26         void *aptr;
    27         
    27         
    28         if ((aptr = malloc(nbytes)) == NULL)
    28         if ((aptr = malloc(nbytes)) == NULL)
    73                 return error;
    73                 return error;
    74         } else 
    74         } else 
    75                 return AL_TRUE;
    75                 return AL_TRUE;
    76 }
    76 }
    77 
    77 
    78 /*       void *helper_fadein(void *tmp) {
    78        void *helper_fadein(void *tmp) {
    79                 ALfloat gain;
    79                 ALfloat gain;
    80                 ALfloat target_gain;
    80                 ALfloat target_gain;
    81                 fade_t *fade;
    81                 fade_t *fade;
    82                 uint32_t index; 
    82                 uint32_t index; 
    83                 uint16_t quantity; 
    83                 uint16_t quantity; 
    89                 
    89                 
    90 #ifdef DEBUG
    90 #ifdef DEBUG
    91                 err_msg("(%s) INFO - Fade-in in progress [index %d quantity %d]", prog, index, quantity);
    91                 err_msg("(%s) INFO - Fade-in in progress [index %d quantity %d]", prog, index, quantity);
    92 #endif
    92 #endif
    93                 
    93                 
    94                 /*save the volume desired after the fade
    94                 /*save the volume desired after the fade*/
    95                 alGetSourcef(Sources[index], AL_GAIN, &target_gain);
    95                 alGetSourcef(Sources[index], AL_GAIN, &target_gain);
    96                 if (target_gain > 1.0f || target_gain <= 0.0f)
    96                 if (target_gain > 1.0f || target_gain <= 0.0f)
    97                         target_gain = 1.0f;
    97                         target_gain = 1.0f;
    98                 
    98                 
    99                 alSourcePlay(Sources[index]);
    99                 alSourcePlay(Sources[index]);
   142                         usleep(10000);
   142                         usleep(10000);
   143                 }
   143                 }
   144                 
   144                 
   145                 AlGetError("(%s) WARN - Failed to set fade-out volume level");
   145                 AlGetError("(%s) WARN - Failed to set fade-out volume level");
   146                 
   146                 
   147                 /*stop that sound and reset its volume
   147                 /*stop that sound and reset its volume*/
   148                 alSourceStop (Sources[index]);
   148                 alSourceStop (Sources[index]);
   149                 alSourcef (Sources[index], AL_GAIN, old_gain);	
   149                 alSourcef (Sources[index], AL_GAIN, old_gain);	
   150                 
   150                 
   151 #ifndef _WIN32
   151 #ifndef _WIN32
   152                 pthread_exit(NULL);
   152                 pthread_exit(NULL);
   154                 _endthread();
   154                 _endthread();
   155 #endif
   155 #endif
   156                 return 0;
   156                 return 0;
   157         }
   157         }
   158         
   158         
   159         */