16
0
mirror of https://github.com/MaSzyna-EU07/maszyna.git synced 2026-07-20 05:39:18 +02:00

tweaks in buffer handling after failure

This commit is contained in:
milek7
2019-09-12 18:15:28 +02:00
parent f457ad8dc4
commit be5312493f
2 changed files with 3 additions and 1 deletions

View File

@@ -64,9 +64,11 @@ openal_buffer::openal_buffer( std::string const &Filename ) :
alGenBuffers(1, &id);
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");
}

View File

@@ -175,7 +175,7 @@ openal_source::bind( sound_source *Controller, uint32_sequence Sounds, Iterator_
First, Last,
[&]( audio::buffer_handle const &bufferhandle ) {
auto const &buffer { audio::renderer.buffer( bufferhandle ) };
buffers.emplace_back( buffer.id ); } );
if (buffer.id != null_resource) buffers.emplace_back( buffer.id ); } );
if( id != audio::null_resource ) {
::alSourceQueueBuffers( id, static_cast<ALsizei>( buffers.size() ), buffers.data() );