Planet
navi homePPSaboutscreenshotsdownloaddevelopmentforum

Changeset 6849 in orxonox.OLD for trunk/src/lib/sound


Ignore:
Timestamp:
Jan 30, 2006, 2:57:55 AM (19 years ago)
Author:
bensch
Message:

trunk: alc-stuff

Location:
trunk/src/lib/sound
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/lib/sound/sound_engine.cc

    r6847 r6849  
    311311    alcMakeContextCurrent(this->context);
    312312  #else*/
    313   printf("!!!!!!!!!!!!!!!!!!%d\n", __LINE__);
    314313  this->device = alcOpenDevice(NULL);
    315   printf("!!!!!!!!!!!!!!!!!!%d\n", __LINE__);
    316   SoundEngine::checkError("Error opening Device", __LINE__);
    317   printf("!!!!!!!!!!!!!!!!!!%d\n", __LINE__);
     314  this->checkError("Error opening Device", __LINE__);
     315
    318316  this->context = alcCreateContext(this->device, NULL);
    319   printf("!!!!!!!!!!!!!!!!!!%d\n", __LINE__);
    320   SoundEngine::checkError("Error creating Context", __LINE__);
    321   //alcMakeContextCurrent(this->context);
    322   printf("!!!!!!!!!!!!!!!!!!%d\n", __LINE__);
    323   this->checkError("Making Context Current", __LINE__);
     317  this->checkALCError("Error creating Context", __LINE__);
     318
     319  alcMakeContextCurrent(this->context);
     320  this->checkALCError("Making Context Current", __LINE__);
    324321  // #endif
    325322
     
    376373  else
    377374    return true;
     375}
     376
     377bool SoundEngine::checkALCError(const char* error, unsigned int line)
     378{
     379  ALenum errorCode;
     380  if ((errorCode = alcGetError(this->device)) != ALC_NO_ERROR)
     381  {
     382    PRINTF(1)("Error %s (line:%d): '%s'\n", error, line, SoundEngine::getALCErrorString(errorCode));
     383    return false;
     384  }
     385  else
     386    return true;
     387}
     388
     389
     390
     391void SoundEngine::listDevices()
     392{
     393  printf("%s\n",(const char*)alcGetString(NULL, ALC_DEVICE_SPECIFIER));
    378394}
    379395
     
    401417}
    402418
    403 void SoundEngine::listDevices()
    404 {
    405   printf("%s\n",(const char*)alcGetString(NULL, ALC_DEVICE_SPECIFIER));
    406 }
    407 
    408419
    409420const char* SoundEngine::getALCErrorString(ALenum err)
     
    412423    {
    413424    case ALC_NO_ERROR:
    414       return ("AL_NO_ERROR\n");
     425      return ("AL_NO_ERROR");
    415426    case ALC_INVALID_DEVICE:
    416       return ("ALC_INVALID_DEVICE\n");
     427      return ("ALC_INVALID_DEVICE");
    417428    case ALC_INVALID_CONTEXT:
    418       return("ALC_INVALID_CONTEXT\n");
     429      return("ALC_INVALID_CONTEXT");
    419430    case ALC_INVALID_ENUM:
    420       return("ALC_INVALID_ENUM\n");
     431      return("ALC_INVALID_ENUM");
    421432    case ALC_INVALID_VALUE:
    422       return ("ALC_INVALID_VALUE\n");
     433      return ("ALC_INVALID_VALUE");
    423434    case ALC_OUT_OF_MEMORY:
    424       return("ALC_OUT_OF_MEMORY\n");
     435      return("ALC_OUT_OF_MEMORY");
    425436    };
    426437}
  • trunk/src/lib/sound/sound_engine.h

    r6847 r6849  
    6060  // error handling:
    6161    static bool checkError(const char* error, unsigned int line);
    62     static bool checkALCError(const char* error, unsigned int line);
     62    bool checkALCError(const char* error, unsigned int line);
    6363    static const char* getALErrorString(ALenum err);
    6464    static const char* getALCErrorString(ALenum err);
Note: See TracChangeset for help on using the changeset viewer.