Cafu Engine
OpenALIncl.hpp
1 /*
2 Cafu Engine, http://www.cafu.de/
3 Copyright (c) Carsten Fuchs and other contributors.
4 This project is licensed under the terms of the MIT license.
5 */
6 
7 #ifndef CAFU_SOUNDSYS_OPENAL_INCL_HPP_INCLUDED
8 #define CAFU_SOUNDSYS_OPENAL_INCL_HPP_INCLUDED
9 
10 // Include the OpenAL related header files like "alut" does:
11 // apparently the subdirectory is not standardized across the platforms yet.
12 #if defined(_WIN32)
13 #include <alc.h>
14 #include <al.h>
15 #elif defined(__APPLE__)
16 #include <OpenAL/alc.h>
17 #include <OpenAL/al.h>
18 #else
19 #include <AL/alc.h>
20 #include <AL/al.h>
21 #include <AL/alext.h>
22 #endif
23 
24 #include <string>
25 
26 
27 /// A helper function to tranlate OpenAL error codes into a string.
28 inline std::string TranslateErrorCode(ALenum ErrorCode)
29 {
30  switch (ErrorCode)
31  {
32  case AL_INVALID_NAME:
33  return "A bad name (ID) was passed to an OpenAL function.";
34 
35  case AL_INVALID_ENUM:
36  return "An invalid enum value was passed to an OpenAL function.";
37 
38  case AL_INVALID_VALUE:
39  return "An invalid value was passed to an OpenAL function.";
40 
41  case AL_INVALID_OPERATION:
42  return "The requested operation is not valid.";
43 
44  case AL_OUT_OF_MEMORY:
45  return "The requested operation resulted in OpenAL running out of memory.";
46  }
47 
48  return "There is currently no error.";
49 }
50 
51 #endif