speaker-calibration 2.2.4 → 2.2.6
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/dist/example/i18n.js +136 -136
- package/dist/main.js +13 -2
- package/package.json +1 -1
- package/src/peer-connection/speaker.js +23 -0
- package/src/tasks/combination/combination.js +7 -2
package/package.json
CHANGED
|
@@ -9,6 +9,7 @@ import {
|
|
|
9
9
|
|
|
10
10
|
import database from '../config/firebase';
|
|
11
11
|
import {ref, set, get, child} from 'firebase/database';
|
|
12
|
+
import {phrases} from '../../dist/example/i18n';
|
|
12
13
|
|
|
13
14
|
/**
|
|
14
15
|
* @class Handles the speaker's side of the connection. Responsible for initiating the connection,
|
|
@@ -33,6 +34,7 @@ class Speaker extends AudioPeer {
|
|
|
33
34
|
this.isSmartPhone = params?.isSmartPhone ?? false;
|
|
34
35
|
this.instructionDisplayId = params?.instructionDisplayId ?? '';
|
|
35
36
|
this.titleDisplayId = params?.titleDisplayId ?? '';
|
|
37
|
+
this.timeToCalibrate = params?.timeToCalibrate ?? 10;
|
|
36
38
|
|
|
37
39
|
/* Set up callbacks that handle any events related to our peer object. */
|
|
38
40
|
this.peer.on('open', this.#onPeerOpen);
|
|
@@ -220,8 +222,27 @@ class Speaker extends AudioPeer {
|
|
|
220
222
|
|
|
221
223
|
// clear instructionDisplay
|
|
222
224
|
const instructionDisplay = document.getElementById(this.instructionDisplayId);
|
|
225
|
+
const background = document.getElementById('background'); // todo: get background id from params
|
|
223
226
|
if (instructionDisplay) {
|
|
224
227
|
instructionDisplay.innerHTML = '';
|
|
228
|
+
instructionDisplay.style.whiteSpace = 'nowrap';
|
|
229
|
+
instructionDisplay.style.fontWeight = 'bold';
|
|
230
|
+
instructionDisplay.style.width = 'fit-content';
|
|
231
|
+
instructionDisplay.innerHTML = phrases.RC_soundRecording['en-US'];
|
|
232
|
+
let fontSize = 100;
|
|
233
|
+
instructionDisplay.style.fontSize = fontSize + 'px';
|
|
234
|
+
while (instructionDisplay.scrollWidth > background.scrollWidth * 0.9 && fontSize > 10) {
|
|
235
|
+
fontSize--;
|
|
236
|
+
instructionDisplay.style.fontSize = fontSize + 'px';
|
|
237
|
+
}
|
|
238
|
+
const p = document.createElement('p');
|
|
239
|
+
// font size
|
|
240
|
+
p.style.fontSize = '1.1rem';
|
|
241
|
+
p.style.fontWeight = 'normal';
|
|
242
|
+
p.style.paddingTop = '20px';
|
|
243
|
+
const timeToCalibrateText = phrases.RC_howLongToCalibrate['en-US'];
|
|
244
|
+
p.innerHTML = timeToCalibrateText.replace('111', this.timeToCalibrate);
|
|
245
|
+
instructionDisplay.appendChild(p);
|
|
225
246
|
}
|
|
226
247
|
|
|
227
248
|
// Update title - titleDisplayId
|
|
@@ -229,6 +250,8 @@ class Speaker extends AudioPeer {
|
|
|
229
250
|
if (titleDisplay) {
|
|
230
251
|
// replace 2 with 3
|
|
231
252
|
titleDisplay.innerHTML = titleDisplay.innerHTML.replace('2', '3');
|
|
253
|
+
// replace 1 with 3
|
|
254
|
+
titleDisplay.innerHTML = titleDisplay.innerHTML.replace('1', '3');
|
|
232
255
|
}
|
|
233
256
|
};
|
|
234
257
|
|
|
@@ -342,7 +342,9 @@ class Combination extends AudioCalibrator {
|
|
|
342
342
|
this.stepNum += 1;
|
|
343
343
|
console.log('await desired length ' + this.stepNum);
|
|
344
344
|
this.status =
|
|
345
|
-
`All Hz Calibration: sampling the calibration signal...`.toString() +
|
|
345
|
+
`All Hz Calibration: sampling the calibration signal...`.toString() +
|
|
346
|
+
`\n iteration Count: ${this.stepNum}` +
|
|
347
|
+
this.generateTemplate();
|
|
346
348
|
this.emit('update', {
|
|
347
349
|
message: this.status,
|
|
348
350
|
});
|
|
@@ -356,7 +358,10 @@ class Combination extends AudioCalibrator {
|
|
|
356
358
|
this.stepNum += 1;
|
|
357
359
|
console.log('await desired length ' + this.stepNum);
|
|
358
360
|
this.status =
|
|
359
|
-
`All Hz Calibration: sampling the calibration signal...`.toString() +
|
|
361
|
+
`All Hz Calibration: sampling the calibration signal...`.toString() +
|
|
362
|
+
`\n iteration Count: ${this.stepNum}`;
|
|
363
|
+
+this.generateTemplate();
|
|
364
|
+
|
|
360
365
|
this.emit('update', {
|
|
361
366
|
message: this.status,
|
|
362
367
|
});
|