Skip to content

Commit 0f5fa43

Browse files
ehsankripken
authored andcommitted
Implement alDeleteBuffers
1 parent 5d68f71 commit 0f5fa43

File tree

1 file changed

+19
-0
lines changed

1 file changed

+19
-0
lines changed

src/library_openal.js

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -226,6 +226,25 @@ var LibraryOpenAL = {
226226
}
227227
},
228228

229+
alDeleteBuffers: function(count, buffers)
230+
{
231+
if (!AL.currentContext) {
232+
console.error("alDeleteBuffers called without a valid context");
233+
return;
234+
}
235+
for (var i = 0; i < count; ++i) {
236+
var bufferIdx = {{{ makeGetValue('buffers', 'i', 'i32') }}} - 1;
237+
var buffer = AL.currentContext.buf[bufferIdx].buf;
238+
for (var j = 0; j < AL.currentContext.src.length; ++j) {
239+
if (buffer == AL.currentContext.src[j].buffer) {
240+
AL.currentContext.err = 0xA004 /* AL_INVALID_OPERATION */;
241+
return;
242+
}
243+
}
244+
delete AL.currentContext.buf[bufferIdx];
245+
}
246+
},
247+
229248
alGenBuffers: function(count, buffers) {
230249
if (!AL.currentContext) {
231250
console.error("alGenBuffers called without a valid context");

0 commit comments

Comments
 (0)