From 5d68f71fdbe3f07eb876b3f1d58c7559376a0101 Mon Sep 17 00:00:00 2001 From: Ehsan Akhgari Date: Thu, 14 Mar 2013 21:36:55 -0400 Subject: Implement alSourceUnqueueBuffers --- src/library_openal.js | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/src/library_openal.js b/src/library_openal.js index 992b2557..f9d96f6f 100644 --- a/src/library_openal.js +++ b/src/library_openal.js @@ -200,6 +200,32 @@ var LibraryOpenAL = { } }, + alSourceUnqueueBuffers: function(source, count, buffers) + { + if (!AL.currentContext) { + console.error("alSourceUnqueueBuffers called without a valid context"); + return; + } + if (source > AL.currentContext.src.length) { + console.error("alSourceUnqueueBuffers called with an invalid source"); + return; + } + if (count != 1) { + console.error("Queuing multiple buffers using alSourceUnqueueBuffers is not supported yet"); + return; + } + for (var i = 0; i < count; ++i) { + var buffer = AL.currentContext.src[source - 1].buffer; + for (var j = 0; j < AL.currentContext.buf.length; ++j) { + if (buffer == AL.currentContext.buf[j].buf) { + {{{ makeSetValue('buffers', 'i', 'j+1', 'i32') }}}; + AL.currentContext.src[source - 1].buffer = null; + break; + } + } + } + }, + alGenBuffers: function(count, buffers) { if (!AL.currentContext) { console.error("alGenBuffers called without a valid context"); -- cgit v1.2.3-18-g5258