Fixes OpenAL crash and adds extra OpenAL error logging.

This commit is contained in:
xwizard
2022-07-15 15:50:12 +02:00
parent 1860e46d4b
commit 38e89ee5a5
2 changed files with 2 additions and 2 deletions

View File

@@ -69,7 +69,7 @@ openal_buffer::openal_buffer( std::string const &Filename ) :
}
else {
id = null_resource;
ErrorLog("sound: failed to create AL buffer");
ErrorLog("sound: failed to create AL buffer: " + std::string(alGetString(alGetError())));
}
delete[] buf;

View File

@@ -17,7 +17,7 @@ openal_source::bind( sound_source *Controller, uint32_sequence Sounds, Iterator_
is_multipart = ( buffers.size() > 1 );
if( id != audio::null_resource ) {
if( id != audio::null_resource && !buffers.empty()) {
::alSourceQueueBuffers( id, static_cast<ALsizei>( buffers.size() ), buffers.data() );
::alSourceRewind( id );
// sound controller can potentially request playback to start from certain buffer point