1
#include "alutInternal.h"
4
static ALenum lastError = ALUT_ERROR_NO_ERROR;
6
void _alutSetError(ALenum err)
8
/* print a message to stderr if ALUT_DEBUG environment variable is defined */
9
if (getenv("ALUT_DEBUG"))
11
fprintf(stderr, "ALUT error: %s\n", alutGetErrorString(err));
14
if (lastError == ALUT_ERROR_NO_ERROR)
20
ALenum alutGetError(void)
22
ALint ret = lastError;
24
lastError = ALUT_ERROR_NO_ERROR;
28
const char *alutGetErrorString(ALenum error)
32
case ALUT_ERROR_NO_ERROR:
33
return "No ALUT error found";
35
case ALUT_ERROR_OUT_OF_MEMORY:
36
return "ALUT ran out of memory";
38
case ALUT_ERROR_INVALID_ENUM:
39
return "ALUT was given an invalid enumeration token";
41
case ALUT_ERROR_INVALID_VALUE:
42
return "ALUT was given an invalid value";
44
case ALUT_ERROR_INVALID_OPERATION:
45
return "The operation was invalid in the current ALUT state";
47
case ALUT_ERROR_NO_CURRENT_CONTEXT:
48
return "There is no current AL context";
50
case ALUT_ERROR_AL_ERROR_ON_ENTRY:
51
return "There was already an AL error on entry to an ALUT function";
53
case ALUT_ERROR_ALC_ERROR_ON_ENTRY:
54
return "There was already an ALC error on entry to an ALUT function";
56
case ALUT_ERROR_OPEN_DEVICE:
57
return "There was an error opening the ALC device";
59
case ALUT_ERROR_CLOSE_DEVICE:
60
return "There was an error closing the ALC device";
62
case ALUT_ERROR_CREATE_CONTEXT:
63
return "There was an error creating an ALC context";
65
case ALUT_ERROR_MAKE_CONTEXT_CURRENT:
66
return "Could not change the current ALC context";
68
case ALUT_ERROR_DESTROY_CONTEXT:
69
return "There was an error destroying the ALC context";
71
case ALUT_ERROR_GEN_BUFFERS:
72
return "There was an error generating an AL buffer";
74
case ALUT_ERROR_BUFFER_DATA:
75
return "There was an error passing buffer data to AL";
77
case ALUT_ERROR_IO_ERROR:
80
case ALUT_ERROR_UNSUPPORTED_FILE_TYPE:
81
return "Unsupported file type";
83
case ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE:
84
return "Unsupported mode within an otherwise usable file type";
86
case ALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA:
87
return "The sound data was corrupt or truncated";
90
return "An impossible ALUT error condition was reported?!?";