diff options
author | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2013-03-14 21:36:55 -0400 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-15 11:53:16 -0700 |
commit | 5d68f71fdbe3f07eb876b3f1d58c7559376a0101 (patch) | |
tree | 048f45fc5f05741217abfac01926082aab3fed42 | |
parent | ff46d95e04588f0d328ef8c49b12ebaa99a782a0 (diff) |
Implement alSourceUnqueueBuffers
-rw-r--r-- | src/library_openal.js | 26 |
1 files changed, 26 insertions, 0 deletions
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"); |