7 #include "../../Types.h"
8 #include "../../Exceptions.h"
24 case AL_NO_ERROR :
return;
27 const char* errdesc = (
const char *)alGetString(
error);
29 char s_errcode_buf[32];
30 const char *s_errcode;
31 sprintf(s_lineno,
"%d", lineno);
34 case ALC_INVALID_DEVICE: s_errcode =
"(Invalid device)";
break;
35 case ALC_INVALID_CONTEXT:s_errcode =
"(Invalid context id)";
break;
36 case ALC_INVALID_ENUM: s_errcode =
"(Bad enum)";
break;
37 case ALC_INVALID_VALUE: s_errcode =
"(Bad value)";
break;
38 case ALC_OUT_OF_MEMORY: s_errcode =
"(Out of memory)";
break;
40 sprintf(s_errcode_buf,
"(0x%x)",
error);
41 s_errcode = s_errcode_buf;
44 std::string
error(
"OpenAL error: ");
45 error += std::string(errdesc ? errdesc :
"unknown") + s_errcode +
" at " + filename +
":" + s_lineno;
46 fprintf(stderr,
"%s\n", error.c_str());
62 switch(format.bitsPerSample) {
64 switch(format.channels) {
65 case 1: alformat = AL_FORMAT_MONO8;
break;
66 case 2: alformat = AL_FORMAT_STEREO8;
break;
67 default:
throw Exception(
"internal error - unexpected number of channels");
71 switch(format.channels) {
72 case 1: alformat = AL_FORMAT_MONO16;
break;
73 case 2: alformat = AL_FORMAT_STEREO16;
break;
74 default:
throw Exception(
"internal error - unexpected number of channels");
78 throw Exception(
"internal error - unexpected bit depth");