Skip to content

Commit 5d68f71

Browse files
ehsankripken
authored andcommitted
Implement alSourceUnqueueBuffers
1 parent ff46d95 commit 5d68f71

File tree

1 file changed

+26
-0
lines changed

1 file changed

+26
-0
lines changed

src/library_openal.js

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,32 @@ var LibraryOpenAL = {
200200
}
201201
},
202202

203+
alSourceUnqueueBuffers: function(source, count, buffers)
204+
{
205+
if (!AL.currentContext) {
206+
console.error("alSourceUnqueueBuffers called without a valid context");
207+
return;
208+
}
209+
if (source > AL.currentContext.src.length) {
210+
console.error("alSourceUnqueueBuffers called with an invalid source");
211+
return;
212+
}
213+
if (count != 1) {
214+
console.error("Queuing multiple buffers using alSourceUnqueueBuffers is not supported yet");
215+
return;
216+
}
217+
for (var i = 0; i < count; ++i) {
218+
var buffer = AL.currentContext.src[source - 1].buffer;
219+
for (var j = 0; j < AL.currentContext.buf.length; ++j) {
220+
if (buffer == AL.currentContext.buf[j].buf) {
221+
{{{ makeSetValue('buffers', 'i', 'j+1', 'i32') }}};
222+
AL.currentContext.src[source - 1].buffer = null;
223+
break;
224+
}
225+
}
226+
}
227+
},
228+
203229
alGenBuffers: function(count, buffers) {
204230
if (!AL.currentContext) {
205231
console.error("alGenBuffers called without a valid context");

0 commit comments

Comments
 (0)