Merge branch 'gfx-work' into sim

This commit is contained in:
milek7
2019-09-12 18:16:23 +02:00
3 changed files with 10 additions and 7 deletions

View File

@@ -62,12 +62,15 @@ 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)) {
alGetError();
alBufferData(id, AL_FORMAT_MONO16, buf, si.frames * 2, rate);
}
else {
id = null_resource;
ErrorLog("sound: failed to create AL buffer");
}
delete[] buf;
delete[] fbuf;