From 38e89ee5a5e138ffb75360b5d9b8e53d58f650ab Mon Sep 17 00:00:00 2001 From: xwizard Date: Fri, 15 Jul 2022 15:50:12 +0200 Subject: [PATCH] Fixes OpenAL crash and adds extra OpenAL error logging. --- audio.cpp | 2 +- audiorenderer_extra.h | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/audio.cpp b/audio.cpp index 93e34058..8dc98f8f 100644 --- a/audio.cpp +++ b/audio.cpp @@ -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; diff --git a/audiorenderer_extra.h b/audiorenderer_extra.h index 79a2f20e..69bc2a34 100644 --- a/audiorenderer_extra.h +++ b/audiorenderer_extra.h @@ -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( buffers.size() ), buffers.data() ); ::alSourceRewind( id ); // sound controller can potentially request playback to start from certain buffer point