mirror of https://bitbucket.org/ausocean/av.git
audio-player: comments for byte conversions
This commit is contained in:
parent
e6697b9de9
commit
dc72371e74
|
@ -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) |
|
||||
|
|
Loading…
Reference in New Issue