Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/library_openal.js
Original file line number Diff line number Diff line change
Expand Up @@ -1450,7 +1450,7 @@ var LibraryOpenAL = {
if (srcLen > 0.0) {
var frequency;
for (var bufId in src.bufQueue) {

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

hmm, is this even the right loop? these look like arrays of ints, so we should do of instead of in in modern JS. For backwards compatibility we can do for (var i = 0; i < src.bufQueue.length; i++) etc., but that's larger...

The current loops are confusing, but not horrible I guess.

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does work, but agreed, if there are people who imbue arrays with custom properties, this has the problem of also iterating over them.

I am hesitant to go changing any behavior for this now though, since not focused on AL at the moment (and I think this is a bit deprecated-ish library anyway as it is non-multithreading friendly)

if (bufId !== 0) {
if (bufId) {
frequency = src.bufQueue[bufId].frequency;
break;
}
Expand All @@ -1472,7 +1472,7 @@ var LibraryOpenAL = {
if (srcLen > 0.0) {
var bytesPerSec;
for (var bufId in src.bufQueue) {
if (bufId !== 0) {
if (bufId) {
var buf = src.bufQueue[bufId];
bytesPerSec = buf.frequency * buf.bytesPerSample * buf.channels;
break;
Expand Down