16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-22 13:59:19 +02:00

make buffer create failure not fatal

This commit is contained in:
milek7
2019-09-12 18:12:15 +02:00
parent 0c64f71aff
commit f457ad8dc4

View File

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