diff --git a/audio.cpp b/audio.cpp index 2bf0a08e..5a824de1 100644 --- a/audio.cpp +++ b/audio.cpp @@ -62,12 +62,13 @@ openal_buffer::openal_buffer( std::string const &Filename ) : buf[i] = val; } - id = 0; alGenBuffers(1, &id); - if (!id) - throw std::runtime_error("sound: cannot generate buffer"); - - alBufferData(id, AL_FORMAT_MONO16, buf, si.frames * 2, rate); + if (id != null_resource && alIsBuffer(id)) { + alBufferData(id, AL_FORMAT_MONO16, buf, si.frames * 2, rate); + } + else { + ErrorLog("sound: failed to create AL buffer"); + } delete[] buf; delete[] fbuf;