src/platform/openal/OpenAlPlayer.cpp
// Note: when used in destructor set abortOnError to true, to avoid throwing in destructor
when used in destructor set abortOnError to true, to avoid throwing in destructor
when used in destructor set abortOnError to true to avoid throwing in destructor
void checkAlcError(ALCdevice *device, std::string const& tag, bool abortOnError = false) {
	auto errorCode = alcGetError(device);
	if (errorCode == ALC_NO_ERROR) {
		return;
	}
	std::string errorLabel;	
	switch (errorCode) {
	case ALC_INVALID_DEVICE:
		errorLabel = "ALC_INVALID_DEVICE";
		break;
	case ALC_INVALID_CONTEXT:
		errorLabel = "ALC_INVALID_CONTEXT";
		break;
	case ALC_INVALID_ENUM:
		errorLabel = "ALC_INVALID_ENUM";
		break;
	case ALC_INVALID_VALUE:
		errorLabel = "ALC_INVALID_VALUE";
		break;
	case ALC_OUT_OF_MEMORY:
		errorLabel = "ALC_OUT_OF_MEMORY";
		break;
	default:
		errorLabel = "UNSPECIFIED ERROR";
		break;
	}
	std::string errorMsg = (boost::format("ALC error, %s %s (%d)") 
			% tag % errorLabel % errorCode).str();
	LOGE(errorMsg);
	if (abortOnError) {
		std::abort();
	} else {
		throw std::runtime_error(errorMsg);
	}
}
void checkAlcError ( ALCdevice * device , std :: string const & tag , bool abortOnError = false ) { auto errorCode = alcGetError ( device ) ; if ( errorCode == ALC_NO_ERROR ) { return ; } std :: string errorLabel ; switch ( errorCode ) { case ALC_INVALID_DEVICE : errorLabel = " " ; break ; case ALC_INVALID_CONTEXT : errorLabel = " " ; break ; case ALC_INVALID_ENUM : errorLabel = " " ; break ; case ALC_INVALID_VALUE : errorLabel = " " ; break ; case ALC_OUT_OF_MEMORY : errorLabel = " " ; break ; default : errorLabel = " " ; break ; } std :: string errorMsg = ( boost :: format ( " " ) % tag % errorLabel % errorCode ) . str ( ) ; LOGE ( errorMsg ) ; if ( abortOnError ) { std :: abort ( ) ; } else { throw std :: runtime_error ( errorMsg ) ; } }
Note: when used in destructor set abortOnError to true, to avoid throwing in destructor
Note : when used in destructor set abortOnError to true to avoid throwing in destructor