|
1 | 1 | // Matches microbithal.h |
2 | 2 |
|
3 | | -import { EnumSensor, RangeSensor, Sensor } from "./sensors"; |
4 | | -import { clamp } from "./util"; |
5 | 3 | import svgText from "../microbit-drawing.svg"; |
6 | | -import playIcon from "../play.svg"; |
7 | | -import { MICROBIT_HAL_PIN_FACE } from "./constants"; |
8 | 4 | import { AudioUI } from "./audio"; |
9 | | -import { WebAssemblyOperations } from "./listener"; |
| 5 | +import { MICROBIT_HAL_PIN_FACE } from "./constants"; |
| 6 | +import { |
| 7 | + convertAccelerometerStringToNumber, |
| 8 | + convertSoundEventStringToNumber, |
| 9 | +} from "./conversions"; |
10 | 10 | import { FileSystem } from "./fs"; |
11 | | -import { convertAccelerometerStringToNumber } from "./conversions"; |
| 11 | +import { WebAssemblyOperations } from "./listener"; |
| 12 | +import { EnumSensor, RangeSensor, Sensor } from "./sensors"; |
| 13 | +import { clamp } from "./util"; |
12 | 14 |
|
13 | 15 | const stoppedOpactity = "0.5"; |
14 | 16 |
|
@@ -441,9 +443,9 @@ export class MicrophoneUI { |
441 | 443 | initialize(soundLevelCallback: (v: number) => void) { |
442 | 444 | this.soundLevel.onchange = (prev: number, curr: number) => { |
443 | 445 | if (prev > this.lowThreshold && curr <= this.lowThreshold) { |
444 | | - soundLevelCallback(convertAccelerometerStringToNumber("low")); |
| 446 | + soundLevelCallback(convertSoundEventStringToNumber("low")); |
445 | 447 | } else if (prev < this.highThreshold && curr >= this.highThreshold) { |
446 | | - soundLevelCallback(convertAccelerometerStringToNumber("high")); |
| 448 | + soundLevelCallback(convertSoundEventStringToNumber("high")); |
447 | 449 | } |
448 | 450 | }; |
449 | 451 | } |
|
0 commit comments