1
|
|
|
/* |
2
|
|
|
* Copyright (c) 2018-2019 Rafael da Silva Rocha. |
3
|
|
|
* |
4
|
|
|
* Permission is hereby granted, free of charge, to any person obtaining |
5
|
|
|
* a copy of this software and associated documentation files (the |
6
|
|
|
* "Software"), to deal in the Software without restriction, including |
7
|
|
|
* without limitation the rights to use, copy, modify, merge, publish, |
8
|
|
|
* distribute, sublicense, and/or sell copies of the Software, and to |
9
|
|
|
* permit persons to whom the Software is furnished to do so, subject to |
10
|
|
|
* the following conditions: |
11
|
|
|
* |
12
|
|
|
* The above copyright notice and this permission notice shall be |
13
|
|
|
* included in all copies or substantial portions of the Software. |
14
|
|
|
* |
15
|
|
|
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
16
|
|
|
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
17
|
|
|
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND |
18
|
|
|
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE |
19
|
|
|
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION |
20
|
|
|
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION |
21
|
|
|
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
22
|
|
|
* |
23
|
|
|
*/ |
24
|
|
|
|
25
|
|
|
/** |
26
|
|
|
* @fileoverview Externs for alawmulaw 5.0 |
27
|
|
|
* |
28
|
|
|
* @see https://github.com/rochars/alawmulaw |
29
|
|
|
* @externs |
30
|
|
|
*/ |
31
|
|
|
|
32
|
|
|
var alawmulaw = {}; |
33
|
|
|
var alaw = {}; |
34
|
|
|
var mulaw = {}; |
35
|
|
|
|
36
|
|
|
// A-Law |
37
|
|
|
/** |
38
|
|
|
* Encode a 16-bit linear PCM sample as 8-bit A-Law. |
39
|
|
|
* @param {number} sample A 16-bit PCM sample |
40
|
|
|
* @return {number} |
41
|
|
|
*/ |
42
|
|
|
alaw.encodeSample = function(sample) {} |
43
|
|
|
|
44
|
|
|
/** |
45
|
|
|
* Decode a 8-bit A-Law sample as 16-bit PCM. |
46
|
|
|
* @param {number} aLawSample The 8-bit A-Law sample |
47
|
|
|
* @return {number} |
48
|
|
|
*/ |
49
|
|
|
alaw.decodeSample = function(aLawSample) {} |
50
|
|
|
|
51
|
|
|
/** |
52
|
|
|
* Encode 16-bit linear PCM samples as 8-bit A-Law samples. |
53
|
|
|
* @param {!Int16Array} samples A array of 16-bit PCM samples. |
54
|
|
|
* @return {!Uint8Array} |
55
|
|
|
*/ |
56
|
|
|
alaw.encode = function(samples) {} |
57
|
|
|
|
58
|
|
|
/** |
59
|
|
|
* Decode 8-bit A-Law samples into 16-bit linear PCM samples. |
60
|
|
|
* @param {!Uint8Array} samples A array of 8-bit A-Law samples. |
61
|
|
|
* @return {!Int16Array} |
62
|
|
|
*/ |
63
|
|
|
alaw.decode = function(samples) {} |
64
|
|
|
|
65
|
|
|
// mu-Law |
66
|
|
|
/** |
67
|
|
|
* Encode a 16-bit linear PCM sample as 8-bit mu-Law. |
68
|
|
|
* @param {number} sample A 16-bit PCM sample |
69
|
|
|
* @return {number} |
70
|
|
|
*/ |
71
|
|
|
mulaw.encodeSample = function(sample) {} |
72
|
|
|
|
73
|
|
|
/** |
74
|
|
|
* Decode a 8-bit mu-Law sample as 16-bit PCM. |
75
|
|
|
* @param {number} muLawSample The 8-bit mu-Law sample |
76
|
|
|
* @return {number} |
77
|
|
|
*/ |
78
|
|
|
mulaw.decodeSample = function(muLawSample) {} |
79
|
|
|
|
80
|
|
|
/** |
81
|
|
|
* Encode 16-bit linear PCM samples into 8-bit mu-Law samples. |
82
|
|
|
* @param {!Int16Array} samples A array of 16-bit PCM samples. |
83
|
|
|
* @return {!Uint8Array} |
84
|
|
|
*/ |
85
|
|
|
mulaw.encode = function(samples) {} |
86
|
|
|
|
87
|
|
|
/** |
88
|
|
|
* Decode 8-bit mu-Law samples into 16-bit PCM samples. |
89
|
|
|
* @param {!Uint8Array} samples A array of 8-bit mu-Law samples. |
90
|
|
|
* @return {!Int16Array} |
91
|
|
|
*/ |
92
|
|
|
mulaw.decode = function(samples) {} |