speaker-calibration 2.0.0 → 2.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.eslintignore +72 -0
- package/.eslintrc.json +40 -0
- package/.gitignore +78 -0
- package/.prettierignore +70 -0
- package/.prettierrc +15 -0
- package/LICENSE +20 -20
- package/README.md +133 -133
- package/__mocks__/fileMock.js +1 -0
- package/__mocks__/styleMock.js +1 -0
- package/babel.config.js +3 -0
- package/coverage/clover.xml +71 -0
- package/coverage/coverage-final.json +224 -0
- package/coverage/lcov-report/PythonServerInterface.js.html +265 -0
- package/coverage/lcov-report/base.css +354 -0
- package/coverage/lcov-report/block-navigation.js +82 -0
- package/coverage/lcov-report/favicon.png +0 -0
- package/coverage/lcov-report/index.html +123 -0
- package/coverage/lcov-report/prettify.css +101 -0
- package/coverage/lcov-report/prettify.js +937 -0
- package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
- package/coverage/lcov-report/sorter.js +189 -0
- package/coverage/lcov-report/src/index.html +121 -0
- package/coverage/lcov-report/src/server/PythonServerInterface.js.html +268 -0
- package/coverage/lcov-report/src/server/index.html +123 -0
- package/coverage/lcov-report/src/tasks/audioCalibrator.js.html +499 -0
- package/coverage/lcov-report/src/tasks/audioRecorder.js.html +412 -0
- package/coverage/lcov-report/src/tasks/index.html +143 -0
- package/coverage/lcov-report/src/tasks/volume/index.html +123 -0
- package/coverage/lcov-report/src/tasks/volume/volume.js.html +409 -0
- package/coverage/lcov-report/src/utils.js.html +172 -0
- package/coverage/lcov.info +91 -0
- package/dist/example/Queen-Bohemian_Rhapsody.wav +0 -0
- package/dist/example/Queen-Bohemian_Rhapsody_g_filtered.wav +0 -0
- package/dist/example/index.html +47 -0
- package/dist/example/listener.html +89 -0
- package/dist/example/server.js +49 -0
- package/dist/example/speaker.html +126 -0
- package/dist/example/speakerUI.js +217 -0
- package/dist/example/styles.css +40 -0
- package/dist/main.js +913 -1
- package/dist/mlsGen.js +6814 -6814
- package/dist/mlsGen.wasm +0 -0
- package/doc/AudioCalibrator.html +417 -0
- package/doc/AudioPeer.html +251 -0
- package/doc/AudioRecorder.html +195 -0
- package/doc/ImpulseResponse.html +215 -0
- package/doc/Listener.html +308 -0
- package/doc/MlsGenInterface.html +226 -0
- package/doc/MyEventEmitter.html +274 -0
- package/doc/PythonServerAPI.html +109 -0
- package/doc/Speaker-Calibration-UML-Diagram.png +0 -0
- package/doc/Speaker.html +276 -0
- package/doc/Takes%20a%20target%20element%20where%20html%20elements%20will%20be%20appended..html +128 -0
- package/doc/Takes%20the%20url%20of%20the%20current%20site%0Aand%20a%20target%20element%20where%20html%20elements%20will%20be%20appended..html +138 -0
- package/doc/Takes%20the%20url%20of%20the%20current%20site%20and%20a%20target%20element%20where%20html%20elements%20will%20be%20appended..html +137 -0
- package/doc/Volume.html +88 -0
- package/doc/audioCalibrator.js.html +179 -0
- package/doc/audioPeer.js.html +175 -0
- package/doc/audioRecorder.js.html +163 -0
- package/doc/creates%20a%20new%20AudioRecorder%20instance.%20%0ASets%20up%20the%20audio%20context%20and%20file%20reader..html +114 -0
- package/doc/fonts/OpenSans-Bold-webfont.eot +0 -0
- package/doc/fonts/OpenSans-Bold-webfont.svg +1830 -0
- package/doc/fonts/OpenSans-Bold-webfont.woff +0 -0
- package/doc/fonts/OpenSans-BoldItalic-webfont.eot +0 -0
- package/doc/fonts/OpenSans-BoldItalic-webfont.svg +1830 -0
- package/doc/fonts/OpenSans-BoldItalic-webfont.woff +0 -0
- package/doc/fonts/OpenSans-Italic-webfont.eot +0 -0
- package/doc/fonts/OpenSans-Italic-webfont.svg +1830 -0
- package/doc/fonts/OpenSans-Italic-webfont.woff +0 -0
- package/doc/fonts/OpenSans-Light-webfont.eot +0 -0
- package/doc/fonts/OpenSans-Light-webfont.svg +1831 -0
- package/doc/fonts/OpenSans-Light-webfont.woff +0 -0
- package/doc/fonts/OpenSans-LightItalic-webfont.eot +0 -0
- package/doc/fonts/OpenSans-LightItalic-webfont.svg +1835 -0
- package/doc/fonts/OpenSans-LightItalic-webfont.woff +0 -0
- package/doc/fonts/OpenSans-Regular-webfont.eot +0 -0
- package/doc/fonts/OpenSans-Regular-webfont.svg +1831 -0
- package/doc/fonts/OpenSans-Regular-webfont.woff +0 -0
- package/doc/global.html +308 -0
- package/doc/index.html +58 -0
- package/doc/listener.js.html +170 -0
- package/doc/mlsGen_mlsGenInterface.js.html +117 -0
- package/doc/myEventEmitter.js.html +124 -0
- package/doc/peer-connection_audioPeer.js.html +188 -0
- package/doc/peer-connection_listener.js.html +311 -0
- package/doc/peer-connection_speaker.js.html +381 -0
- package/doc/sc-activity-diagram.png +0 -0
- package/doc/scripts/linenumber.js +25 -0
- package/doc/scripts/prettify/Apache-License-2.0.txt +202 -0
- package/doc/scripts/prettify/lang-css.js +24 -0
- package/doc/scripts/prettify/prettify.js +640 -0
- package/doc/server_PythonServerAPI.js.html +160 -0
- package/doc/speaker.js.html +248 -0
- package/doc/styles/jsdoc-default.css +371 -0
- package/doc/styles/prettify-jsdoc.css +111 -0
- package/doc/styles/prettify-tomorrow.css +163 -0
- package/doc/tasks_audioCalibrator.js.html +207 -0
- package/doc/tasks_audioRecorder.js.html +190 -0
- package/doc/tasks_impulse-response_impulseResponse.js.html +442 -0
- package/doc/tasks_impulse-response_mlsGen_mlsGenInterface.js.html +175 -0
- package/doc/tasks_volume_volume.js.html +185 -0
- package/doc/utils.js.html +105 -0
- package/jest.config.js +173 -0
- package/netlify.toml +27 -0
- package/package.json +67 -66
- package/src/index.html +21 -0
- package/src/main.js +21 -0
- package/src/myEventEmitter.js +83 -0
- package/src/peer-connection/audioPeer.js +151 -0
- package/src/peer-connection/listener.js +251 -0
- package/src/peer-connection/peerErrors.js +25 -0
- package/src/peer-connection/speaker.js +346 -0
- package/src/server/PythonServerAPI.js +155 -0
- package/src/tasks/audioCalibrator.js +218 -0
- package/src/tasks/audioRecorder.js +148 -0
- package/src/tasks/impulse-response/impulseResponse.js +436 -0
- package/src/tasks/impulse-response/mlsGen/mlsGen.cpp +99 -0
- package/src/tasks/impulse-response/mlsGen/mlsGen.hpp +304 -0
- package/src/tasks/impulse-response/mlsGen/mlsGenInterface.js +131 -0
- package/src/tasks/impulse-response/mlsGen/mlsGenTest.cpp +181 -0
- package/src/tasks/volume/volume.cpp +3 -0
- package/src/tasks/volume/volume.hpp +23 -0
- package/src/tasks/volume/volume.js +174 -0
- package/src/utils.js +55 -0
- package/webpack.config.js +37 -0
- package/README +0 -3
|
Binary file
|
package/doc/global.html
ADDED
|
@@ -0,0 +1,308 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>JSDoc: Global</title>
|
|
6
|
+
|
|
7
|
+
<script src="scripts/prettify/prettify.js"></script>
|
|
8
|
+
<script src="scripts/prettify/lang-css.js"></script>
|
|
9
|
+
<!--[if lt IE 9]>
|
|
10
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
+
<![endif]-->
|
|
12
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css" />
|
|
13
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css" />
|
|
14
|
+
</head>
|
|
15
|
+
|
|
16
|
+
<body>
|
|
17
|
+
<div id="main">
|
|
18
|
+
<h1 class="page-title">Global</h1>
|
|
19
|
+
|
|
20
|
+
<section>
|
|
21
|
+
<header>
|
|
22
|
+
<h2></h2>
|
|
23
|
+
</header>
|
|
24
|
+
|
|
25
|
+
<article>
|
|
26
|
+
<div class="container-overview">
|
|
27
|
+
<dl class="details"></dl>
|
|
28
|
+
</div>
|
|
29
|
+
|
|
30
|
+
<h3 class="subsection-title">Methods</h3>
|
|
31
|
+
|
|
32
|
+
<h4 class="name" id="csvToArray">
|
|
33
|
+
<span class="type-signature"></span>csvToArray<span class="signature"
|
|
34
|
+
>(csvString, delimiter)</span
|
|
35
|
+
><span class="type-signature"></span>
|
|
36
|
+
</h4>
|
|
37
|
+
|
|
38
|
+
<div class="description">Utility function to create a buffer from a CSV file</div>
|
|
39
|
+
|
|
40
|
+
<h5>Parameters:</h5>
|
|
41
|
+
|
|
42
|
+
<table class="params">
|
|
43
|
+
<thead>
|
|
44
|
+
<tr>
|
|
45
|
+
<th>Name</th>
|
|
46
|
+
|
|
47
|
+
<th>Type</th>
|
|
48
|
+
|
|
49
|
+
<th>Default</th>
|
|
50
|
+
|
|
51
|
+
<th class="last">Description</th>
|
|
52
|
+
</tr>
|
|
53
|
+
</thead>
|
|
54
|
+
|
|
55
|
+
<tbody>
|
|
56
|
+
<tr>
|
|
57
|
+
<td class="name"><code>csvString</code></td>
|
|
58
|
+
|
|
59
|
+
<td class="type">
|
|
60
|
+
<span class="param-type">*</span>
|
|
61
|
+
</td>
|
|
62
|
+
|
|
63
|
+
<td class="default"></td>
|
|
64
|
+
|
|
65
|
+
<td class="description last"></td>
|
|
66
|
+
</tr>
|
|
67
|
+
|
|
68
|
+
<tr>
|
|
69
|
+
<td class="name"><code>delimiter</code></td>
|
|
70
|
+
|
|
71
|
+
<td class="type">
|
|
72
|
+
<span class="param-type">*</span>
|
|
73
|
+
</td>
|
|
74
|
+
|
|
75
|
+
<td class="default">,</td>
|
|
76
|
+
|
|
77
|
+
<td class="description last"></td>
|
|
78
|
+
</tr>
|
|
79
|
+
</tbody>
|
|
80
|
+
</table>
|
|
81
|
+
|
|
82
|
+
<dl class="details">
|
|
83
|
+
<dt class="tag-source">Source:</dt>
|
|
84
|
+
<dd class="tag-source">
|
|
85
|
+
<ul class="dummy">
|
|
86
|
+
<li>
|
|
87
|
+
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line37">line 37</a>
|
|
88
|
+
</li>
|
|
89
|
+
</ul>
|
|
90
|
+
</dd>
|
|
91
|
+
</dl>
|
|
92
|
+
|
|
93
|
+
<h5>Returns:</h5>
|
|
94
|
+
|
|
95
|
+
<h4 class="name" id="saveToCSV">
|
|
96
|
+
<span class="type-signature"></span>saveToCSV<span class="signature"
|
|
97
|
+
>(data, filename)</span
|
|
98
|
+
><span class="type-signature"></span>
|
|
99
|
+
</h4>
|
|
100
|
+
|
|
101
|
+
<div class="description">
|
|
102
|
+
Uiltity function to create and save a CSV file from a buffer
|
|
103
|
+
</div>
|
|
104
|
+
|
|
105
|
+
<h5>Parameters:</h5>
|
|
106
|
+
|
|
107
|
+
<table class="params">
|
|
108
|
+
<thead>
|
|
109
|
+
<tr>
|
|
110
|
+
<th>Name</th>
|
|
111
|
+
|
|
112
|
+
<th>Type</th>
|
|
113
|
+
|
|
114
|
+
<th>Default</th>
|
|
115
|
+
|
|
116
|
+
<th class="last">Description</th>
|
|
117
|
+
</tr>
|
|
118
|
+
</thead>
|
|
119
|
+
|
|
120
|
+
<tbody>
|
|
121
|
+
<tr>
|
|
122
|
+
<td class="name"><code>data</code></td>
|
|
123
|
+
|
|
124
|
+
<td class="type">
|
|
125
|
+
<span class="param-type">*</span>
|
|
126
|
+
</td>
|
|
127
|
+
|
|
128
|
+
<td class="default"></td>
|
|
129
|
+
|
|
130
|
+
<td class="description last"></td>
|
|
131
|
+
</tr>
|
|
132
|
+
|
|
133
|
+
<tr>
|
|
134
|
+
<td class="name"><code>filename</code></td>
|
|
135
|
+
|
|
136
|
+
<td class="type">
|
|
137
|
+
<span class="param-type">*</span>
|
|
138
|
+
</td>
|
|
139
|
+
|
|
140
|
+
<td class="default">recordedMLSignal.csv</td>
|
|
141
|
+
|
|
142
|
+
<td class="description last"></td>
|
|
143
|
+
</tr>
|
|
144
|
+
</tbody>
|
|
145
|
+
</table>
|
|
146
|
+
|
|
147
|
+
<dl class="details">
|
|
148
|
+
<dt class="tag-source">Source:</dt>
|
|
149
|
+
<dd class="tag-source">
|
|
150
|
+
<ul class="dummy">
|
|
151
|
+
<li>
|
|
152
|
+
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line16">line 16</a>
|
|
153
|
+
</li>
|
|
154
|
+
</ul>
|
|
155
|
+
</dd>
|
|
156
|
+
</dl>
|
|
157
|
+
|
|
158
|
+
<h4 class="name" id="sleep">
|
|
159
|
+
<span class="type-signature"></span>sleep<span class="signature">(seconds)</span
|
|
160
|
+
><span class="type-signature"> → {Promise}</span>
|
|
161
|
+
</h4>
|
|
162
|
+
|
|
163
|
+
<div class="description">Utlity function to pause execution for a given time</div>
|
|
164
|
+
|
|
165
|
+
<h5>Parameters:</h5>
|
|
166
|
+
|
|
167
|
+
<table class="params">
|
|
168
|
+
<thead>
|
|
169
|
+
<tr>
|
|
170
|
+
<th>Name</th>
|
|
171
|
+
|
|
172
|
+
<th>Type</th>
|
|
173
|
+
|
|
174
|
+
<th class="last">Description</th>
|
|
175
|
+
</tr>
|
|
176
|
+
</thead>
|
|
177
|
+
|
|
178
|
+
<tbody>
|
|
179
|
+
<tr>
|
|
180
|
+
<td class="name"><code>seconds</code></td>
|
|
181
|
+
|
|
182
|
+
<td class="type">
|
|
183
|
+
<span class="param-type">number</span>
|
|
184
|
+
</td>
|
|
185
|
+
|
|
186
|
+
<td class="description last"></td>
|
|
187
|
+
</tr>
|
|
188
|
+
</tbody>
|
|
189
|
+
</table>
|
|
190
|
+
|
|
191
|
+
<dl class="details">
|
|
192
|
+
<dt class="tag-source">Source:</dt>
|
|
193
|
+
<dd class="tag-source">
|
|
194
|
+
<ul class="dummy">
|
|
195
|
+
<li>
|
|
196
|
+
<a href="utils.js.html">utils.js</a>, <a href="utils.js.html#line6">line 6</a>
|
|
197
|
+
</li>
|
|
198
|
+
</ul>
|
|
199
|
+
</dd>
|
|
200
|
+
</dl>
|
|
201
|
+
|
|
202
|
+
<h5>Returns:</h5>
|
|
203
|
+
|
|
204
|
+
<dl>
|
|
205
|
+
<dt>Type</dt>
|
|
206
|
+
<dd>
|
|
207
|
+
<span class="param-type">Promise</span>
|
|
208
|
+
</dd>
|
|
209
|
+
</dl>
|
|
210
|
+
|
|
211
|
+
<h3 class="subsection-title">Type Definitions</h3>
|
|
212
|
+
|
|
213
|
+
<h4 class="name" id="initParameters">initParameters</h4>
|
|
214
|
+
|
|
215
|
+
<h5>Type:</h5>
|
|
216
|
+
<ul>
|
|
217
|
+
<li>
|
|
218
|
+
<span class="param-type">object</span>
|
|
219
|
+
</li>
|
|
220
|
+
</ul>
|
|
221
|
+
|
|
222
|
+
<h5 class="subsection-title">Properties:</h5>
|
|
223
|
+
|
|
224
|
+
<table class="props">
|
|
225
|
+
<thead>
|
|
226
|
+
<tr>
|
|
227
|
+
<th>Name</th>
|
|
228
|
+
|
|
229
|
+
<th>Type</th>
|
|
230
|
+
|
|
231
|
+
<th class="last">Description</th>
|
|
232
|
+
</tr>
|
|
233
|
+
</thead>
|
|
234
|
+
|
|
235
|
+
<tbody>
|
|
236
|
+
<tr>
|
|
237
|
+
<td class="name"><code>targetElementId</code></td>
|
|
238
|
+
|
|
239
|
+
<td class="type">
|
|
240
|
+
<span class="param-type">string</span>
|
|
241
|
+
</td>
|
|
242
|
+
|
|
243
|
+
<td class="description last">target element where new elements will be appended</td>
|
|
244
|
+
</tr>
|
|
245
|
+
|
|
246
|
+
<tr>
|
|
247
|
+
<td class="name"><code>siteUrl:</code></td>
|
|
248
|
+
|
|
249
|
+
<td class="type">
|
|
250
|
+
<span class="param-type">string</span>
|
|
251
|
+
</td>
|
|
252
|
+
|
|
253
|
+
<td class="description last">the url of the current site</td>
|
|
254
|
+
</tr>
|
|
255
|
+
</tbody>
|
|
256
|
+
</table>
|
|
257
|
+
|
|
258
|
+
<dl class="details">
|
|
259
|
+
<dt class="tag-source">Source:</dt>
|
|
260
|
+
<dd class="tag-source">
|
|
261
|
+
<ul class="dummy">
|
|
262
|
+
<li>
|
|
263
|
+
<a href="peer-connection_audioPeer.js.html">peer-connection/audioPeer.js</a>,
|
|
264
|
+
<a href="peer-connection_audioPeer.js.html#line7">line 7</a>
|
|
265
|
+
</li>
|
|
266
|
+
</ul>
|
|
267
|
+
</dd>
|
|
268
|
+
</dl>
|
|
269
|
+
</article>
|
|
270
|
+
</section>
|
|
271
|
+
</div>
|
|
272
|
+
|
|
273
|
+
<nav>
|
|
274
|
+
<h2><a href="index.html">Home</a></h2>
|
|
275
|
+
<h3>Classes</h3>
|
|
276
|
+
<ul>
|
|
277
|
+
<li><a href="AudioCalibrator.html">AudioCalibrator</a></li>
|
|
278
|
+
<li><a href="AudioPeer.html">AudioPeer</a></li>
|
|
279
|
+
<li><a href="AudioRecorder.html">AudioRecorder</a></li>
|
|
280
|
+
<li><a href="ImpulseResponse.html">ImpulseResponse</a></li>
|
|
281
|
+
<li><a href="Listener.html">Listener</a></li>
|
|
282
|
+
<li><a href="MlsGenInterface.html">MlsGenInterface</a></li>
|
|
283
|
+
<li><a href="MyEventEmitter.html">MyEventEmitter</a></li>
|
|
284
|
+
<li><a href="PythonServerAPI.html">PythonServerAPI</a></li>
|
|
285
|
+
<li><a href="Speaker.html">Speaker</a></li>
|
|
286
|
+
<li><a href="Volume.html">Volume</a></li>
|
|
287
|
+
</ul>
|
|
288
|
+
<h3>Global</h3>
|
|
289
|
+
<ul>
|
|
290
|
+
<li><a href="global.html#csvToArray">csvToArray</a></li>
|
|
291
|
+
<li><a href="global.html#saveToCSV">saveToCSV</a></li>
|
|
292
|
+
<li><a href="global.html#sleep">sleep</a></li>
|
|
293
|
+
</ul>
|
|
294
|
+
</nav>
|
|
295
|
+
|
|
296
|
+
<br class="clear" />
|
|
297
|
+
|
|
298
|
+
<footer>
|
|
299
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri
|
|
300
|
+
Jul 29 2022 15:09:48 GMT-0400 (Eastern Daylight Time)
|
|
301
|
+
</footer>
|
|
302
|
+
|
|
303
|
+
<script>
|
|
304
|
+
prettyPrint();
|
|
305
|
+
</script>
|
|
306
|
+
<script src="scripts/linenumber.js"></script>
|
|
307
|
+
</body>
|
|
308
|
+
</html>
|
package/doc/index.html
ADDED
|
@@ -0,0 +1,58 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>JSDoc: Home</title>
|
|
6
|
+
|
|
7
|
+
<script src="scripts/prettify/prettify.js"></script>
|
|
8
|
+
<script src="scripts/prettify/lang-css.js"></script>
|
|
9
|
+
<!--[if lt IE 9]>
|
|
10
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
+
<![endif]-->
|
|
12
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css" />
|
|
13
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css" />
|
|
14
|
+
</head>
|
|
15
|
+
|
|
16
|
+
<body>
|
|
17
|
+
<div id="main">
|
|
18
|
+
<h1 class="page-title">Home</h1>
|
|
19
|
+
|
|
20
|
+
<h3></h3>
|
|
21
|
+
</div>
|
|
22
|
+
|
|
23
|
+
<nav>
|
|
24
|
+
<h2><a href="index.html">Home</a></h2>
|
|
25
|
+
<h3>Classes</h3>
|
|
26
|
+
<ul>
|
|
27
|
+
<li><a href="AudioCalibrator.html">AudioCalibrator</a></li>
|
|
28
|
+
<li><a href="AudioPeer.html">AudioPeer</a></li>
|
|
29
|
+
<li><a href="AudioRecorder.html">AudioRecorder</a></li>
|
|
30
|
+
<li><a href="ImpulseResponse.html">ImpulseResponse</a></li>
|
|
31
|
+
<li><a href="Listener.html">Listener</a></li>
|
|
32
|
+
<li><a href="MlsGenInterface.html">MlsGenInterface</a></li>
|
|
33
|
+
<li><a href="MyEventEmitter.html">MyEventEmitter</a></li>
|
|
34
|
+
<li><a href="PythonServerAPI.html">PythonServerAPI</a></li>
|
|
35
|
+
<li><a href="Speaker.html">Speaker</a></li>
|
|
36
|
+
<li><a href="Volume.html">Volume</a></li>
|
|
37
|
+
</ul>
|
|
38
|
+
<h3>Global</h3>
|
|
39
|
+
<ul>
|
|
40
|
+
<li><a href="global.html#csvToArray">csvToArray</a></li>
|
|
41
|
+
<li><a href="global.html#saveToCSV">saveToCSV</a></li>
|
|
42
|
+
<li><a href="global.html#sleep">sleep</a></li>
|
|
43
|
+
</ul>
|
|
44
|
+
</nav>
|
|
45
|
+
|
|
46
|
+
<br class="clear" />
|
|
47
|
+
|
|
48
|
+
<footer>
|
|
49
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Fri
|
|
50
|
+
Jul 29 2022 15:09:48 GMT-0400 (Eastern Daylight Time)
|
|
51
|
+
</footer>
|
|
52
|
+
|
|
53
|
+
<script>
|
|
54
|
+
prettyPrint();
|
|
55
|
+
</script>
|
|
56
|
+
<script src="scripts/linenumber.js"></script>
|
|
57
|
+
</body>
|
|
58
|
+
</html>
|
|
@@ -0,0 +1,170 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>JSDoc: Source: listener.js</title>
|
|
6
|
+
|
|
7
|
+
<script src="scripts/prettify/prettify.js"></script>
|
|
8
|
+
<script src="scripts/prettify/lang-css.js"></script>
|
|
9
|
+
<!--[if lt IE 9]>
|
|
10
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
+
<![endif]-->
|
|
12
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css" />
|
|
13
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css" />
|
|
14
|
+
</head>
|
|
15
|
+
|
|
16
|
+
<body>
|
|
17
|
+
<div id="main">
|
|
18
|
+
<h1 class="page-title">Source: listener.js</h1>
|
|
19
|
+
|
|
20
|
+
<section>
|
|
21
|
+
<article>
|
|
22
|
+
<pre class="prettyprint source linenums"><code>import './listener.css';
|
|
23
|
+
import AudioPeer from './audioPeer';
|
|
24
|
+
|
|
25
|
+
/**
|
|
26
|
+
* @class Handles the listener's side of the connection. Responsible for getting access to user's microphone,
|
|
27
|
+
* and initiating a call to the Speaker.
|
|
28
|
+
* @extends AudioPeer
|
|
29
|
+
*/
|
|
30
|
+
class Listener extends AudioPeer {
|
|
31
|
+
/**
|
|
32
|
+
* Takes a target element where html elements will be appended.
|
|
33
|
+
* @param {initParameters} params - see type definition for initParameters
|
|
34
|
+
*/
|
|
35
|
+
constructor(params) {
|
|
36
|
+
super(params);
|
|
37
|
+
|
|
38
|
+
this.startTime = Date.now();
|
|
39
|
+
this.receiverPeerId = null;
|
|
40
|
+
|
|
41
|
+
const urlParameters = this.parseURLSearchParams();
|
|
42
|
+
this.speakerPeerId = urlParameters.speakerPeerId;
|
|
43
|
+
|
|
44
|
+
this.peer.on('open', this.onPeerOpen);
|
|
45
|
+
this.peer.on('connection', this.onPeerConnection);
|
|
46
|
+
this.peer.on('disconnected', this.onPeerDisconnected);
|
|
47
|
+
this.peer.on('close', this.onPeerClose);
|
|
48
|
+
this.peer.on('error', this.onPeerError);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
onPeerOpen = id => {
|
|
52
|
+
console.log('Listener - onPeerOpen');
|
|
53
|
+
// Workaround for peer.reconnect deleting previous id
|
|
54
|
+
if (id === null) {
|
|
55
|
+
console.log('Received null id from peer open');
|
|
56
|
+
this.peer.id = this.lastPeerId;
|
|
57
|
+
} else {
|
|
58
|
+
this.lastPeerId = this.peer.id;
|
|
59
|
+
}
|
|
60
|
+
this.join();
|
|
61
|
+
};
|
|
62
|
+
|
|
63
|
+
onPeerConnection = connection => {
|
|
64
|
+
console.log('Listener - onPeerConnection');
|
|
65
|
+
// Disallow incoming connections
|
|
66
|
+
connection.on('open', () => {
|
|
67
|
+
connection.send('Sender does not accept incoming connections');
|
|
68
|
+
setTimeout(() => {
|
|
69
|
+
connection.close();
|
|
70
|
+
}, 500);
|
|
71
|
+
});
|
|
72
|
+
};
|
|
73
|
+
|
|
74
|
+
onConnData = data => {
|
|
75
|
+
console.log('Listener - onConnData');
|
|
76
|
+
// Keypad has received data, namely instructions to update the keypad
|
|
77
|
+
// TODO generalize to a list of properies
|
|
78
|
+
const hasSpeakerID = Object.prototype.hasOwnProperty.call(data, 'speakerPeerId');
|
|
79
|
+
if (!hasSpeakerID) {
|
|
80
|
+
console.error('Error in parsing data received! Must set "speakerPeerId" properties');
|
|
81
|
+
} else {
|
|
82
|
+
// this.conn.close();
|
|
83
|
+
console.log(this.speakerPeerId);
|
|
84
|
+
this.speakerPeerId = data.speakerPeerId;
|
|
85
|
+
const newParams = {
|
|
86
|
+
speakerPeerId: this.speakerPeerId,
|
|
87
|
+
};
|
|
88
|
+
/*
|
|
89
|
+
FUTURE does this limit usable environments?
|
|
90
|
+
ie does this work if internet is lost after initial page load?
|
|
91
|
+
*/
|
|
92
|
+
window.location.search = this.queryStringFromObject(newParams); // Redirect to correctly constructed keypad page
|
|
93
|
+
}
|
|
94
|
+
};
|
|
95
|
+
|
|
96
|
+
join = () => {
|
|
97
|
+
console.log('Listener - join');
|
|
98
|
+
/**
|
|
99
|
+
* Create the connection between the two Peers.
|
|
100
|
+
*
|
|
101
|
+
* Sets up callbacks that handle any events related to the
|
|
102
|
+
* connection and data received on it.
|
|
103
|
+
*/
|
|
104
|
+
// Close old connection
|
|
105
|
+
if (this.conn) {
|
|
106
|
+
this.conn.close();
|
|
107
|
+
}
|
|
108
|
+
// Create connection to destination peer specified by the query param
|
|
109
|
+
this.conn = this.peer.connect(this.speakerPeerId, {
|
|
110
|
+
reliable: true,
|
|
111
|
+
});
|
|
112
|
+
|
|
113
|
+
this.conn.on('open', () => {
|
|
114
|
+
// console.log("TODO Implement real on connection fn");
|
|
115
|
+
this.openAudioStream();
|
|
116
|
+
});
|
|
117
|
+
|
|
118
|
+
// Handle incoming data (messages only since this is the signal sender)
|
|
119
|
+
this.conn.on('data', this.onConnData);
|
|
120
|
+
this.conn.on('close', () => {
|
|
121
|
+
console.log('Connection closed');
|
|
122
|
+
});
|
|
123
|
+
};
|
|
124
|
+
|
|
125
|
+
openAudioStream = async () => {
|
|
126
|
+
navigator.mediaDevices
|
|
127
|
+
.getUserMedia({video: false, audio: true})
|
|
128
|
+
.then(stream => {
|
|
129
|
+
this.peer.call(this.speakerPeerId, stream); // one-way call
|
|
130
|
+
console.log('Listener - openAudioStream');
|
|
131
|
+
})
|
|
132
|
+
.catch(err => {
|
|
133
|
+
console.log(`u got an error:${err}`);
|
|
134
|
+
});
|
|
135
|
+
};
|
|
136
|
+
}
|
|
137
|
+
|
|
138
|
+
export default Listener;
|
|
139
|
+
</code></pre>
|
|
140
|
+
</article>
|
|
141
|
+
</section>
|
|
142
|
+
</div>
|
|
143
|
+
|
|
144
|
+
<nav>
|
|
145
|
+
<h2><a href="index.html">Home</a></h2>
|
|
146
|
+
<h3>Classes</h3>
|
|
147
|
+
<ul>
|
|
148
|
+
<li><a href="AudioCalibrator.html">AudioCalibrator</a></li>
|
|
149
|
+
<li><a href="AudioPeer.html">AudioPeer</a></li>
|
|
150
|
+
<li><a href="AudioRecorder.html">AudioRecorder</a></li>
|
|
151
|
+
<li><a href="Listener.html">Listener</a></li>
|
|
152
|
+
<li><a href="MlsGenInterface.html">MlsGenInterface</a></li>
|
|
153
|
+
<li><a href="Speaker.html">Speaker</a></li>
|
|
154
|
+
</ul>
|
|
155
|
+
<h3><a href="global.html">Global</a></h3>
|
|
156
|
+
</nav>
|
|
157
|
+
|
|
158
|
+
<br class="clear" />
|
|
159
|
+
|
|
160
|
+
<footer>
|
|
161
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue
|
|
162
|
+
Mar 01 2022 12:39:42 GMT-0500 (Eastern Standard Time)
|
|
163
|
+
</footer>
|
|
164
|
+
|
|
165
|
+
<script>
|
|
166
|
+
prettyPrint();
|
|
167
|
+
</script>
|
|
168
|
+
<script src="scripts/linenumber.js"></script>
|
|
169
|
+
</body>
|
|
170
|
+
</html>
|
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
<!DOCTYPE html>
|
|
2
|
+
<html lang="en">
|
|
3
|
+
<head>
|
|
4
|
+
<meta charset="utf-8" />
|
|
5
|
+
<title>JSDoc: Source: mlsGen/mlsGenInterface.js</title>
|
|
6
|
+
|
|
7
|
+
<script src="scripts/prettify/prettify.js"></script>
|
|
8
|
+
<script src="scripts/prettify/lang-css.js"></script>
|
|
9
|
+
<!--[if lt IE 9]>
|
|
10
|
+
<script src="//html5shiv.googlecode.com/svn/trunk/html5.js"></script>
|
|
11
|
+
<![endif]-->
|
|
12
|
+
<link type="text/css" rel="stylesheet" href="styles/prettify-tomorrow.css" />
|
|
13
|
+
<link type="text/css" rel="stylesheet" href="styles/jsdoc-default.css" />
|
|
14
|
+
</head>
|
|
15
|
+
|
|
16
|
+
<body>
|
|
17
|
+
<div id="main">
|
|
18
|
+
<h1 class="page-title">Source: mlsGen/mlsGenInterface.js</h1>
|
|
19
|
+
|
|
20
|
+
<section>
|
|
21
|
+
<article>
|
|
22
|
+
<pre
|
|
23
|
+
class="prettyprint source linenums"
|
|
24
|
+
><code>// eslint-disable-next-line import/extensions
|
|
25
|
+
const createMLSGenModule = require('../../dist/mlsGen.js');
|
|
26
|
+
|
|
27
|
+
/**
|
|
28
|
+
* MLSGenInterface provides a class for interfacing with the MLSGen WASM module.
|
|
29
|
+
*/
|
|
30
|
+
class MlsGenInterface {
|
|
31
|
+
/** @private */
|
|
32
|
+
#N = 18;
|
|
33
|
+
|
|
34
|
+
/** @private */
|
|
35
|
+
// eslint-disable-next-line no-bitwise
|
|
36
|
+
#P = (1 << 18) - 1;
|
|
37
|
+
|
|
38
|
+
/** @private */
|
|
39
|
+
#MLSGen;
|
|
40
|
+
|
|
41
|
+
/** @private */
|
|
42
|
+
#WASMInstance;
|
|
43
|
+
|
|
44
|
+
/**
|
|
45
|
+
* Creates an instance of MlsGenInterface.
|
|
46
|
+
* Makes a call to the WASM glue code to load the WASM module.
|
|
47
|
+
*/
|
|
48
|
+
constructor() {
|
|
49
|
+
// load the WASM module and save the instance.
|
|
50
|
+
createMLSGenModule().then((instance) => {
|
|
51
|
+
this.#WASMInstance = instance;
|
|
52
|
+
this.#MLSGen = new instance.MLSGen(this.N);
|
|
53
|
+
console.log(this.#MLSGen);
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
|
|
57
|
+
/*
|
|
58
|
+
TODO: Figure out the best way to interact with this module.
|
|
59
|
+
1. Return the MLS signal (as an array), appears problematic with the pointer bindings
|
|
60
|
+
2. Pass a buffer to the function to be filled with the MLS, I did this before but need
|
|
61
|
+
to go back and look at how it was done. Currently throwing an error.
|
|
62
|
+
3. Circumvent this all together by calling the webAudio API in the CPP code directly.
|
|
63
|
+
*/
|
|
64
|
+
getMls = () => {
|
|
65
|
+
/**
|
|
66
|
+
* Calculate the Maximum Length Sequence (MLS) with period P = 2^N - 1
|
|
67
|
+
* using the MLSGen WASM module.
|
|
68
|
+
* @param {Number} N
|
|
69
|
+
*/
|
|
70
|
+
// Get function.
|
|
71
|
+
const { HEAPU8 } = this.#WASMInstance;
|
|
72
|
+
|
|
73
|
+
// Create the arrays.
|
|
74
|
+
// eslint-disable-next-line no-bitwise
|
|
75
|
+
const offset = 0;
|
|
76
|
+
const result = new Uint8Array(HEAPU8.buffer, offset, this.#P);
|
|
77
|
+
|
|
78
|
+
// Call the function.
|
|
79
|
+
this.#MLSGen.getMls(result.byteOffset, this.#N, this.#P);
|
|
80
|
+
|
|
81
|
+
console.log(result);
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
|
|
85
|
+
export default MlsGenInterface;
|
|
86
|
+
</code></pre>
|
|
87
|
+
</article>
|
|
88
|
+
</section>
|
|
89
|
+
</div>
|
|
90
|
+
|
|
91
|
+
<nav>
|
|
92
|
+
<h2><a href="index.html">Home</a></h2>
|
|
93
|
+
<h3>Classes</h3>
|
|
94
|
+
<ul>
|
|
95
|
+
<li><a href="AudioCalibrator.html">AudioCalibrator</a></li>
|
|
96
|
+
<li><a href="AudioPeer.html">AudioPeer</a></li>
|
|
97
|
+
<li><a href="AudioRecorder.html">AudioRecorder</a></li>
|
|
98
|
+
<li><a href="Listener.html">Listener</a></li>
|
|
99
|
+
<li><a href="MlsGenInterface.html">MlsGenInterface</a></li>
|
|
100
|
+
<li><a href="Speaker.html">Speaker</a></li>
|
|
101
|
+
</ul>
|
|
102
|
+
<h3><a href="global.html">Global</a></h3>
|
|
103
|
+
</nav>
|
|
104
|
+
|
|
105
|
+
<br class="clear" />
|
|
106
|
+
|
|
107
|
+
<footer>
|
|
108
|
+
Documentation generated by <a href="https://github.com/jsdoc/jsdoc">JSDoc 3.6.10</a> on Tue
|
|
109
|
+
Mar 01 2022 12:39:42 GMT-0500 (Eastern Standard Time)
|
|
110
|
+
</footer>
|
|
111
|
+
|
|
112
|
+
<script>
|
|
113
|
+
prettyPrint();
|
|
114
|
+
</script>
|
|
115
|
+
<script src="scripts/linenumber.js"></script>
|
|
116
|
+
</body>
|
|
117
|
+
</html>
|