Skip to content

Commit

Permalink
Check for invalid loop points (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
ic-scm committed Nov 8, 2020
1 parent c094681 commit 152d84f
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/brstm/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -364,6 +364,13 @@ export class Brstm {
this.endianness
),
};

// Check if loop point is valid
if (metadata.loopStartSample >= metadata.totalSamples) {
metadata.loopFlag = 0;
metadata.loopStartSample = 0;
console.warn('The loop start sample in this file is invalid.');
}

return metadata;
}
Expand Down

0 comments on commit 152d84f

Please sign in to comment.