Skip to content

Commit

Permalink
prevent fadeArrays() edge case failure
Browse files Browse the repository at this point in the history
  • Loading branch information
nnirror committed Nov 28, 2023
1 parent d046b13 commit d21f3cc
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions js/FacetPattern.js
Original file line number Diff line number Diff line change
Expand Up @@ -3420,7 +3420,9 @@ rechunk (numChunks, probability = 1) {
// since this is to smooth clicks in audio data, don't crossfade any "data" patterns with <= 1024 values
let totalLength = 0;
for (let i = 0; i < array.length; i++) {
totalLength += array[i].length;
if (array[i] != undefined) {
totalLength += array[i].length;
}
}
if ( totalLength <= 1024 ) {
return array;
Expand Down Expand Up @@ -3450,7 +3452,9 @@ rechunk (numChunks, probability = 1) {
// since this is to smooth clicks in audio data, don't crossfade any "data" patterns with <= 1024 values
let totalLength = 0;
for (let i = 0; i < arrays.length; i++) {
totalLength += arrays[i].length;
if (arrays[i] != undefined) {
totalLength += arrays[i].length;
}
}
if ( totalLength <= 1024 ) {
return arrays;
Expand Down

0 comments on commit d21f3cc

Please sign in to comment.