diff options
author | Ehsan Akhgari <ehsan.akhgari@gmail.com> | 2013-03-14 23:47:14 -0400 |
---|---|---|
committer | Alon Zakai <alonzakai@gmail.com> | 2013-03-15 11:53:16 -0700 |
commit | 0f5fa434cd21010ed731e544b6780e3fa53ac89a (patch) | |
tree | d8ba617ae835efbd09c4e39857e8bf2610117379 /src/library_openal.js | |
parent | 5d68f71fdbe3f07eb876b3f1d58c7559376a0101 (diff) |
Implement alDeleteBuffers
Diffstat (limited to 'src/library_openal.js')
-rw-r--r-- | src/library_openal.js | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/src/library_openal.js b/src/library_openal.js index f9d96f6f..e9dafd66 100644 --- a/src/library_openal.js +++ b/src/library_openal.js @@ -226,6 +226,25 @@ var LibraryOpenAL = { } }, + alDeleteBuffers: function(count, buffers) + { + if (!AL.currentContext) { + console.error("alDeleteBuffers called without a valid context"); + return; + } + for (var i = 0; i < count; ++i) { + var bufferIdx = {{{ makeGetValue('buffers', 'i', 'i32') }}} - 1; + var buffer = AL.currentContext.buf[bufferIdx].buf; + for (var j = 0; j < AL.currentContext.src.length; ++j) { + if (buffer == AL.currentContext.src[j].buffer) { + AL.currentContext.err = 0xA004 /* AL_INVALID_OPERATION */; + return; + } + } + delete AL.currentContext.buf[bufferIdx]; + } + }, + alGenBuffers: function(count, buffers) { if (!AL.currentContext) { console.error("alGenBuffers called without a valid context"); |