16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-19 20:19:18 +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;
}
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;