From 2839e92ce4263749b1915053a17cdee20aa4716a Mon Sep 17 00:00:00 2001 From: Aaron Culliney Date: Sat, 20 Jun 2015 13:16:24 -0700 Subject: [PATCH] Refactor : simplify check for available buffers --- src/audio/soundcore-openal.c | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/src/audio/soundcore-openal.c b/src/audio/soundcore-openal.c index b6d17d64..9b95a83b 100644 --- a/src/audio/soundcore-openal.c +++ b/src/audio/soundcore-openal.c @@ -326,17 +326,9 @@ static long ALUnlockBuffer(AudioBuffer_s *_this, unsigned long audio_bytes) { break; } - { - bool queued_buffers_count = 0; - ALPlayBuf *node = voice->queued_buffers; - while (node) { - ++queued_buffers_count; - node = node->next; - } - if (queued_buffers_count >= OPENAL_NUM_BUFFERS) { - //LOG("no free audio buffers"); // keep accumulating ... - break; - } + if (voice->avail_buffers == NULL) { + LOG("no free audio buffers"); // keep accumulating ... + break; } // Submit working buffer to OpenAL