• Main Page
  • Namespaces
  • Classes
  • Files
  • File List
  • File Members

src/audio/src/util/alutError.cpp

Go to the documentation of this file.
00001 #include "alutInternal.h"
00002 #include <stdio.h>
00003 
00004 static ALenum lastError = ALUT_ERROR_NO_ERROR;
00005 
00006 void
00007 _alutSetError (ALenum err)
00008 {
00009   /* print a message to stderr if ALUT_DEBUG environment variable is defined */
00010   if (getenv ("ALUT_DEBUG"))
00011     {
00012       fprintf (stderr, "ALUT error: %s\n", alutGetErrorString (err));
00013     }
00014 
00015   if (lastError == ALUT_ERROR_NO_ERROR)
00016     {
00017       lastError = err;
00018     }
00019 }
00020 
00021 ALenum
00022 alutGetError (void)
00023 {
00024   ALint ret = lastError;
00025   lastError = ALUT_ERROR_NO_ERROR;
00026   return ret;
00027 }
00028 
00029 const char *
00030 alutGetErrorString (ALenum error)
00031 {
00032   switch (error)
00033     {
00034     case ALUT_ERROR_NO_ERROR:
00035       return "No ALUT error found";
00036 
00037     case ALUT_ERROR_OUT_OF_MEMORY:
00038       return "ALUT ran out of memory";
00039 
00040     case ALUT_ERROR_INVALID_ENUM:
00041       return "ALUT was given an invalid enumeration token";
00042 
00043     case ALUT_ERROR_INVALID_VALUE:
00044       return "ALUT was given an invalid value";
00045 
00046     case ALUT_ERROR_INVALID_OPERATION:
00047       return "The operation was invalid in the current ALUT state";
00048 
00049     case ALUT_ERROR_NO_CURRENT_CONTEXT:
00050       return "There is no current AL context";
00051 
00052     case ALUT_ERROR_AL_ERROR_ON_ENTRY:
00053       return "There was already an AL error on entry to an ALUT function";
00054 
00055     case ALUT_ERROR_ALC_ERROR_ON_ENTRY:
00056       return "There was already an ALC error on entry to an ALUT function";
00057 
00058     case ALUT_ERROR_OPEN_DEVICE:
00059       return "There was an error opening the ALC device";
00060 
00061     case ALUT_ERROR_CLOSE_DEVICE:
00062       return "There was an error closing the ALC device";
00063 
00064     case ALUT_ERROR_CREATE_CONTEXT:
00065       return "There was an error creating an ALC context";
00066 
00067     case ALUT_ERROR_MAKE_CONTEXT_CURRENT:
00068       return "Could not change the current ALC context";
00069 
00070     case ALUT_ERROR_DESTROY_CONTEXT:
00071       return "There was an error destroying the ALC context";
00072 
00073     case ALUT_ERROR_GEN_BUFFERS:
00074       return "There was an error generating an AL buffer";
00075 
00076     case ALUT_ERROR_BUFFER_DATA:
00077       return "There was an error passing buffer data to AL";
00078 
00079     case ALUT_ERROR_IO_ERROR:
00080       return "I/O error";
00081 
00082     case ALUT_ERROR_UNSUPPORTED_FILE_TYPE:
00083       return "Unsupported file type";
00084 
00085     case ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE:
00086       return "Unsupported mode within an otherwise usable file type";
00087 
00088     case ALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA:
00089       return "The sound data was corrupt or truncated";
00090 
00091     default:
00092       return "An impossible ALUT error condition was reported?!?";
00093     }
00094 }

Generated on Fri Jun 18 2010 17:48:39 for Cannonball by  doxygen 1.7.0