blob: 57e2957520006421dc90ea9eff7acda0d6361bf1 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
|
#include "alutInternal.h"
#include <stdio.h>
static ALenum lastError = ALUT_ERROR_NO_ERROR;
void _alutSetError(ALenum err)
{
/* print a message to stderr if ALUT_DEBUG environment variable is defined */
if (getenv("ALUT_DEBUG"))
{
fprintf(stderr, "ALUT error: %s\n", alutGetErrorString(err));
}
if (lastError == ALUT_ERROR_NO_ERROR)
{
lastError = err;
}
}
ALenum alutGetError(void)
{
ALint ret = lastError;
lastError = ALUT_ERROR_NO_ERROR;
return ret;
}
const char *alutGetErrorString(ALenum error)
{
switch (error)
{
case ALUT_ERROR_NO_ERROR:
return "No ALUT error found";
case ALUT_ERROR_OUT_OF_MEMORY:
return "ALUT ran out of memory";
case ALUT_ERROR_INVALID_ENUM:
return "ALUT was given an invalid enumeration token";
case ALUT_ERROR_INVALID_VALUE:
return "ALUT was given an invalid value";
case ALUT_ERROR_INVALID_OPERATION:
return "The operation was invalid in the current ALUT state";
case ALUT_ERROR_NO_CURRENT_CONTEXT:
return "There is no current AL context";
case ALUT_ERROR_AL_ERROR_ON_ENTRY:
return "There was already an AL error on entry to an ALUT function";
case ALUT_ERROR_ALC_ERROR_ON_ENTRY:
return "There was already an ALC error on entry to an ALUT function";
case ALUT_ERROR_OPEN_DEVICE:
return "There was an error opening the ALC device";
case ALUT_ERROR_CLOSE_DEVICE:
return "There was an error closing the ALC device";
case ALUT_ERROR_CREATE_CONTEXT:
return "There was an error creating an ALC context";
case ALUT_ERROR_MAKE_CONTEXT_CURRENT:
return "Could not change the current ALC context";
case ALUT_ERROR_DESTROY_CONTEXT:
return "There was an error destroying the ALC context";
case ALUT_ERROR_GEN_BUFFERS:
return "There was an error generating an AL buffer";
case ALUT_ERROR_BUFFER_DATA:
return "There was an error passing buffer data to AL";
case ALUT_ERROR_IO_ERROR:
return "I/O error";
case ALUT_ERROR_UNSUPPORTED_FILE_TYPE:
return "Unsupported file type";
case ALUT_ERROR_UNSUPPORTED_FILE_SUBTYPE:
return "Unsupported mode within an otherwise usable file type";
case ALUT_ERROR_CORRUPT_OR_TRUNCATED_DATA:
return "The sound data was corrupt or truncated";
default:
return "An impossible ALUT error condition was reported?!?";
}
}
|