mirror of https://bitbucket.org/ausocean/av.git
audio-player: using correct js declarations
This commit is contained in:
parent
1de5438565
commit
0517e399d1
|
@ -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);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue