openalbridge/openalbridge.c
changeset 2421 a4b039ee2eb0
parent 2419 dbaaba09146d
child 2437 10e4b5fc0d93
equal deleted inserted replaced
2420:b7390a3040f8 2421:a4b039ee2eb0
    72                 ALCdevice *device;
    72                 ALCdevice *device;
    73                 const ALCchar *default_device;
    73                 const ALCchar *default_device;
    74                 
    74                 
    75                 prog = programname;
    75                 prog = programname;
    76                 
    76                 
    77                 
       
    78                 /*Position of the listener*/
    77                 /*Position of the listener*/
    79                 ALfloat ListenerPos[] = { 0.0, 0.0, 0.0 };
    78                 ALfloat ListenerPos[] = { 0.0, 0.0, 0.0 };
    80                 /*Velocity of the listener*/
    79                 /*Velocity of the listener*/
    81                 ALfloat ListenerVel[] = { 0.0, 0.0, 0.0 };
    80                 ALfloat ListenerVel[] = { 0.0, 0.0, 0.0 };
    82                 /*Orientation of the listener. (first 3 elements are "at", second 3 are "up")*/
    81                 /*Orientation of the listener. (first 3 elements are "at", second 3 are "up")*/
    86                         errno = EPERM;                
    85                         errno = EPERM;                
    87                         err_ret("(%s) WARN - OpenAL already initialized", prog);
    86                         err_ret("(%s) WARN - OpenAL already initialized", prog);
    88                         return AL_FALSE;
    87                         return AL_FALSE;
    89                 }
    88                 }
    90                 
    89                 
    91                 if (usehardware)
    90                 if (usehardware = AL_TRUE)
    92                         device = alcOpenDevice(NULL);
    91                         device = alcOpenDevice(NULL);
    93                 else
    92                 else
    94                         device = alcOpenDevice("Generic Software");
    93                         device = alcOpenDevice("Generic Software");
    95                 
    94                 
    96                 if (device == NULL) {
    95                 if (device == NULL) {
   271                         err_ret("(%s) WARN - OpenAL not initialized", prog);
   270                         err_ret("(%s) WARN - OpenAL not initialized", prog);
   272                         return AL_FALSE;
   271                         return AL_FALSE;
   273                 }
   272                 }
   274                 
   273                 
   275                 /*Set volume for sound number index*/
   274                 /*Set volume for sound number index*/
   276                 if (index >= globalindex) {
   275                 if (index >= globalsize) {
   277                         fprintf(stderr, "ERROR 'openal_setvolume()': index out of bounds (got %d, max %d)\n", index, globalindex);
   276                         errno = EINVAL;
       
   277                         err_ret("(%s) ERROR - Index out of bounds (got %d, max %d)", prog, index, globalindex);
   278                         return AL_FALSE;
   278                         return AL_FALSE;
   279                 }
   279                 }
   280                 
   280                 
   281                 if (percentage > 100)
   281                 if (percentage > 100)
   282                         percentage = 100;
   282                         percentage = 100;