mirror of
https://github.com/MihailRis/voxelcore.git
synced 2026-10-04 18:41:51 +00:00
44 lines
1.4 KiB
C++
44 lines
1.4 KiB
C++
#include "alutil.h"
|
|
|
|
#include <iostream>
|
|
#include <fstream>
|
|
#include <cstring>
|
|
#include <memory>
|
|
#include <type_traits>
|
|
|
|
#ifdef __APPLE__
|
|
#include <OpenAL/al.h>
|
|
#include <OpenAL/alc.h>
|
|
#else
|
|
#include <AL/al.h>
|
|
#include <AL/alc.h>
|
|
#endif
|
|
|
|
bool AL::check_errors(const std::string& filename, const std::uint_fast32_t line){
|
|
ALenum error = alGetError();
|
|
if(error != AL_NO_ERROR){
|
|
std::cerr << "OpenAL ERROR (" << filename << ": " << line << ")\n" ;
|
|
switch(error){
|
|
case AL_INVALID_NAME:
|
|
std::cerr << "AL_INVALID_NAME: a bad name (ID) was passed to an OpenAL function";
|
|
break;
|
|
case AL_INVALID_ENUM:
|
|
std::cerr << "AL_INVALID_ENUM: an invalid enum value was passed to an OpenAL function";
|
|
break;
|
|
case AL_INVALID_VALUE:
|
|
std::cerr << "AL_INVALID_VALUE: an invalid value was passed to an OpenAL function";
|
|
break;
|
|
case AL_INVALID_OPERATION:
|
|
std::cerr << "AL_INVALID_OPERATION: the requested operation is not valid";
|
|
break;
|
|
case AL_OUT_OF_MEMORY:
|
|
std::cerr << "AL_OUT_OF_MEMORY: the requested operation resulted in OpenAL running out of memory";
|
|
break;
|
|
default:
|
|
std::cerr << "UNKNOWN AL ERROR: " << error;
|
|
}
|
|
std::cerr << std::endl;
|
|
return false;
|
|
}
|
|
return true;
|
|
}
|