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) {
|
function decode(b) {
|
||||||
// Iterate over each chunk and decode it.
|
// Iterate over each chunk and decode it.
|
||||||
let chunkLen;
|
let chunkLen;
|
||||||
var result = [];
|
let result = [];
|
||||||
for (var off = 0; off + headSize <= b.length; off += chunkLen) {
|
for (let off = 0; off + headSize <= b.length; off += chunkLen) {
|
||||||
// Read length of chunk and check if whole chunk exists.
|
// Read length of chunk and check if whole chunk exists.
|
||||||
chunkLen = bytesToInt32(b.slice(off, off + chunkLenSize))
|
chunkLen = bytesToInt32(b.slice(off, off + chunkLenSize))
|
||||||
if (off + chunkLen > b.length) {
|
if (off + chunkLen > b.length) {
|
||||||
|
@ -108,20 +108,20 @@ function decode(b) {
|
||||||
|
|
||||||
result.push(...b.slice(off + chunkLenSize, off + chunkLenSize + byteDepth));
|
result.push(...b.slice(off + chunkLenSize, off + chunkLenSize + byteDepth));
|
||||||
|
|
||||||
for (var i = off + headSize; i < off + chunkLen - b[off + chunkLenSize + 3]; i++) {
|
for (let i = off + headSize; i < off + chunkLen - b[off + chunkLenSize + 3]; i++) {
|
||||||
var twoNibs = b[i];
|
let twoNibs = b[i];
|
||||||
var nib2 = twoNibs >> 4;
|
let nib2 = twoNibs >> 4;
|
||||||
var nib1 = (nib2 << 4) ^ twoNibs;
|
let nib1 = (nib2 << 4) ^ twoNibs;
|
||||||
|
|
||||||
var sample1 = int16ToBytes(decodeSample(nib1));
|
let sample1 = int16ToBytes(decodeSample(nib1));
|
||||||
result.push(...sample1);
|
result.push(...sample1);
|
||||||
|
|
||||||
var sample2 = int16ToBytes(decodeSample(nib2));
|
let sample2 = int16ToBytes(decodeSample(nib2));
|
||||||
result.push(...sample2);
|
result.push(...sample2);
|
||||||
}
|
}
|
||||||
if (b[off + chunkLenSize + 3] == 1) {
|
if (b[off + chunkLenSize + 3] == 1) {
|
||||||
var padNib = b[off + chunkLen - 1];
|
let padNib = b[off + chunkLen - 1];
|
||||||
var sample = int16ToBytes(decodeSample(padNib));
|
let sample = int16ToBytes(decodeSample(padNib));
|
||||||
result.push(...sample);
|
result.push(...sample);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue