-
Notifications
You must be signed in to change notification settings - Fork 0
/
Audio3DError.h
105 lines (84 loc) · 2.23 KB
/
Audio3DError.h
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
93
94
95
96
97
98
99
100
101
102
103
104
105
#ifndef __CELESTIA__AUDIO_3D__ERROR__H__
#define __CELESTIA__AUDIO_3D__ERROR__H__
#include <AL/al.h>
#include <AL/alc.h>
#include <AL/alut.h>
#include <iostream>
#include <string>
namespace Audio3D
{
std::string alErrorToString(ALenum);
std::string alcErrorToString(ALenum);
std::string inline alutErrorToString(ALenum code) { return alutGetErrorString(code); }
void inline printAlError(ALenum code)
{
std::cerr << "AL error: " << alErrorToString(code) << std::endl;
}
void inline printAlcError(ALCenum code)
{
std::cerr << "ALC error: " << alcErrorToString(code) << std::endl;
}
void inline printAlutError(ALenum code)
{
std::cerr << "ALUT error: " << alutErrorToString(code) << std::endl;
}
void inline printErrorLocation(const char *fn, int line)
{
std::cerr << fn << ": " << line << ": ";
}
ALenum inline alError() { return alGetError(); }
ALenum inline alcError(ALCdevice *d) { return alcGetError(d); }
ALenum inline alutError() { return alutGetError(); }
void inline checkForAlError()
{
ALenum err = alError();
if (err != AL_NO_ERROR)
{
printAlError(err);
}
}
void inline checkForAlError(const char *f, int l)
{
ALenum err = alError();
if (err != AL_NO_ERROR)
{
printErrorLocation(f, l);
printAlError(err);
}
}
void inline checkForAlcError(ALCdevice *d)
{
ALenum err = alcError(d);
if (err != ALC_NO_ERROR)
{
printAlcError(err);
}
}
void inline checkForAlcError(ALCdevice *d, const char *f, int l)
{
ALenum err = alcError(d);
if (err != ALC_NO_ERROR)
{
printErrorLocation(f, l);
printAlcError(err);
}
}
void inline checkForAlutError()
{
ALenum err = alError();
if (err != AL_NO_ERROR)
{
printAlutError(err);
}
}
void inline checkForAlutError(const char *f, int l)
{
ALenum err = alError();
if (err != AL_NO_ERROR)
{
printErrorLocation(f, l);
printAlutError(err);
}
}
}
#endif