From dc72371e745ba651b1a2960db376beeecc7c6eb4 Mon Sep 17 00:00:00 2001 From: Trek H Date: Sun, 11 Aug 2019 16:30:13 +0930 Subject: [PATCH] audio-player: comments for byte conversions --- cmd/audio-player/adpcm.js | 3 +++ 1 file changed, 3 insertions(+) diff --git a/cmd/audio-player/adpcm.js b/cmd/audio-player/adpcm.js index 32d66d6b..9df0128c 100644 --- a/cmd/audio-player/adpcm.js +++ b/cmd/audio-player/adpcm.js @@ -127,14 +127,17 @@ function decode(b) { return result; } +// int16ToBytes takes a number assumed to be an int 16 and converts it to an array containing bytes (Little Endian). function int16ToBytes(num) { return [(num & 0x00ff), (num & 0xff00) >> 8]; } +// bytesToInt16 takes an array of bytes (assumed to be values between 0 and 255), interprates them as little endian and converts it to an int16. function bytesToInt16(b) { return (b[0] | (b[1] << 8)); } +// bytesToInt32 takes an array of bytes (assumed to be values between 0 and 255), interprates them as little endian and converts it to an int32. function bytesToInt32(b) { return (b[0] | (b[1] << 8) |