pxt-common-packages 10.4.8 → 10.4.10
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/built/common-sim.d.ts +8 -2
- package/built/common-sim.js +21 -0
- package/libs/game/animation.ts +1 -1
- package/libs/microphone/sim/state.ts +22 -1
- package/libs/radio/radio.ts +1 -1
- package/package.json +2 -2
package/built/common-sim.d.ts
CHANGED
|
@@ -938,9 +938,15 @@ declare namespace pxsim.input {
|
|
|
938
938
|
}
|
|
939
939
|
declare namespace pxsim {
|
|
940
940
|
interface MicrophoneBoard {
|
|
941
|
-
microphoneState:
|
|
941
|
+
microphoneState: MicrophoneState;
|
|
942
942
|
}
|
|
943
|
-
|
|
943
|
+
class MicrophoneState extends AnalogSensorState {
|
|
944
|
+
onSoundRegistered: boolean;
|
|
945
|
+
soundLevelRequested: boolean;
|
|
946
|
+
private pingUsed;
|
|
947
|
+
pingSoundLevel: () => void;
|
|
948
|
+
}
|
|
949
|
+
function microphoneState(): MicrophoneState;
|
|
944
950
|
}
|
|
945
951
|
declare namespace pxsim.music {
|
|
946
952
|
function playInstructions(b: RefBuffer): Promise<void>;
|
package/built/common-sim.js
CHANGED
|
@@ -3181,6 +3181,27 @@ var pxsim;
|
|
|
3181
3181
|
})(pxsim || (pxsim = {}));
|
|
3182
3182
|
var pxsim;
|
|
3183
3183
|
(function (pxsim) {
|
|
3184
|
+
class MicrophoneState extends pxsim.AnalogSensorState {
|
|
3185
|
+
constructor() {
|
|
3186
|
+
super(...arguments);
|
|
3187
|
+
this.onSoundRegistered = false;
|
|
3188
|
+
this.soundLevelRequested = false;
|
|
3189
|
+
this.pingSoundLevel = () => {
|
|
3190
|
+
if (this.onSoundRegistered) {
|
|
3191
|
+
return;
|
|
3192
|
+
}
|
|
3193
|
+
this.soundLevelRequested = true;
|
|
3194
|
+
pxsim.runtime.queueDisplayUpdate();
|
|
3195
|
+
clearTimeout(this.pingUsed);
|
|
3196
|
+
this.pingUsed = setTimeout(() => {
|
|
3197
|
+
this.soundLevelRequested = false;
|
|
3198
|
+
pxsim.runtime.queueDisplayUpdate();
|
|
3199
|
+
this.pingUsed = undefined;
|
|
3200
|
+
}, 100);
|
|
3201
|
+
};
|
|
3202
|
+
}
|
|
3203
|
+
}
|
|
3204
|
+
pxsim.MicrophoneState = MicrophoneState;
|
|
3184
3205
|
function microphoneState() {
|
|
3185
3206
|
return pxsim.board().microphoneState;
|
|
3186
3207
|
}
|
package/libs/game/animation.ts
CHANGED
|
@@ -1,6 +1,27 @@
|
|
|
1
1
|
namespace pxsim {
|
|
2
2
|
export interface MicrophoneBoard {
|
|
3
|
-
microphoneState:
|
|
3
|
+
microphoneState: MicrophoneState;
|
|
4
|
+
}
|
|
5
|
+
|
|
6
|
+
export class MicrophoneState extends AnalogSensorState {
|
|
7
|
+
public onSoundRegistered: boolean = false;
|
|
8
|
+
public soundLevelRequested: boolean = false;
|
|
9
|
+
private pingUsed: ReturnType<typeof setTimeout>;
|
|
10
|
+
|
|
11
|
+
public pingSoundLevel = () => {
|
|
12
|
+
if (this.onSoundRegistered) {
|
|
13
|
+
return;
|
|
14
|
+
}
|
|
15
|
+
this.soundLevelRequested = true;
|
|
16
|
+
runtime.queueDisplayUpdate();
|
|
17
|
+
clearTimeout(this.pingUsed);
|
|
18
|
+
this.pingUsed = setTimeout(() => {
|
|
19
|
+
this.soundLevelRequested = false;
|
|
20
|
+
runtime.queueDisplayUpdate();
|
|
21
|
+
this.pingUsed = undefined;
|
|
22
|
+
}, 100);
|
|
23
|
+
}
|
|
24
|
+
|
|
4
25
|
}
|
|
5
26
|
|
|
6
27
|
export function microphoneState() {
|
package/libs/radio/radio.ts
CHANGED
|
@@ -395,7 +395,7 @@ namespace radio {
|
|
|
395
395
|
function getMaxStringLength(packetType: number) {
|
|
396
396
|
switch (packetType) {
|
|
397
397
|
case PACKET_TYPE_STRING:
|
|
398
|
-
return MAX_PAYLOAD_LENGTH -
|
|
398
|
+
return MAX_PAYLOAD_LENGTH - 1;
|
|
399
399
|
case PACKET_TYPE_VALUE:
|
|
400
400
|
case PACKET_TYPE_DOUBLE_VALUE:
|
|
401
401
|
return MAX_FIELD_DOUBLE_NAME_LENGTH;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "pxt-common-packages",
|
|
3
|
-
"version": "10.4.
|
|
3
|
+
"version": "10.4.10",
|
|
4
4
|
"description": "Microsoft MakeCode (PXT) common packages",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MakeCode",
|
|
@@ -24,7 +24,7 @@
|
|
|
24
24
|
"libs/**/*"
|
|
25
25
|
],
|
|
26
26
|
"dependencies": {
|
|
27
|
-
"pxt-core": "8.6.
|
|
27
|
+
"pxt-core": "8.6.32"
|
|
28
28
|
},
|
|
29
29
|
"devDependencies": {
|
|
30
30
|
"typescript": "^4.2.3"
|