diff --git a/cmd/audio-player/adpcm.js b/cmd/audio-player/adpcm.js index c3424944..396f2b5a 100644 --- a/cmd/audio-player/adpcm.js +++ b/cmd/audio-player/adpcm.js @@ -93,8 +93,8 @@ function decodeSample(nibble) { function decode(b) { // Iterate over each chunk and decode it. let chunkLen; - var result = []; - for (var off = 0; off + headSize <= b.length; off += chunkLen) { + let result = []; + for (let off = 0; off + headSize <= b.length; off += chunkLen) { // Read length of chunk and check if whole chunk exists. chunkLen = bytesToInt32(b.slice(off, off + chunkLenSize)) if (off + chunkLen > b.length) { @@ -108,20 +108,20 @@ function decode(b) { result.push(...b.slice(off + chunkLenSize, off + chunkLenSize + byteDepth)); - for (var i = off + headSize; i < off + chunkLen - b[off + chunkLenSize + 3]; i++) { - var twoNibs = b[i]; - var nib2 = twoNibs >> 4; - var nib1 = (nib2 << 4) ^ twoNibs; + for (let i = off + headSize; i < off + chunkLen - b[off + chunkLenSize + 3]; i++) { + let twoNibs = b[i]; + let nib2 = twoNibs >> 4; + let nib1 = (nib2 << 4) ^ twoNibs; - var sample1 = int16ToBytes(decodeSample(nib1)); + let sample1 = int16ToBytes(decodeSample(nib1)); result.push(...sample1); - var sample2 = int16ToBytes(decodeSample(nib2)); + let sample2 = int16ToBytes(decodeSample(nib2)); result.push(...sample2); } if (b[off + chunkLenSize + 3] == 1) { - var padNib = b[off + chunkLen - 1]; - var sample = int16ToBytes(decodeSample(padNib)); + let padNib = b[off + chunkLen - 1]; + let sample = int16ToBytes(decodeSample(padNib)); result.push(...sample); } }