pxt-microbit 7.1.47 → 7.1.50
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/block-tests.js +1 -1
- package/built/sim.d.ts +1 -0
- package/built/sim.js +25 -7
- package/built/target.js +1 -1
- package/built/target.json +1 -1
- package/built/targetlight.js +1 -1
- package/built/targetlight.json +1 -1
- package/built/web/blockly.css +1 -1
- package/built/web/react-common-authcode.css +1 -1
- package/built/web/react-common-multiplayer.css +1 -1
- package/built/web/react-common-skillmap.css +1 -1
- package/built/web/rtlblockly.css +1 -1
- package/built/web/rtlreact-common-authcode.css +1 -1
- package/built/web/rtlreact-common-multiplayer.css +1 -1
- package/built/web/rtlreact-common-skillmap.css +1 -1
- package/built/web/rtlsemantic.css +2 -2
- package/built/web/semantic.css +2 -2
- package/package.json +6 -6
package/built/sim.js
CHANGED
|
@@ -2233,6 +2233,10 @@ var pxsim;
|
|
|
2233
2233
|
this.value = pxsim.Math_.randomRange(0, 1023);
|
|
2234
2234
|
break;
|
|
2235
2235
|
}
|
|
2236
|
+
// stop continuous servo if moving; 90 degrees represents a speed of 0
|
|
2237
|
+
if (this.servoContinuous && pull == 2 /* PinPullMode.PullNone */ && this.mode & PinFlags.Digital) {
|
|
2238
|
+
this.servoAngle = 90;
|
|
2239
|
+
}
|
|
2236
2240
|
}
|
|
2237
2241
|
analogReadPin() {
|
|
2238
2242
|
this.mode = PinFlags.Analog | PinFlags.Input;
|
|
@@ -3421,6 +3425,7 @@ var pxsim;
|
|
|
3421
3425
|
class RecordingState {
|
|
3422
3426
|
constructor() {
|
|
3423
3427
|
this.currentlyRecording = false;
|
|
3428
|
+
this.audioClippingThreshold = 0.08;
|
|
3424
3429
|
this.audioPlaying = false;
|
|
3425
3430
|
this.inputBitRate = pxsim.record.defaultBitRate();
|
|
3426
3431
|
this.outputBitRate = pxsim.record.defaultBitRate();
|
|
@@ -3449,8 +3454,8 @@ var pxsim;
|
|
|
3449
3454
|
const MAX_BIT_RATE = 256000;
|
|
3450
3455
|
const MAX_SAMPLE_RATE = 22000;
|
|
3451
3456
|
const MIN_SAMPLE_RATE = 1000;
|
|
3452
|
-
const MIN_RECORDING_TIME =
|
|
3453
|
-
const MAX_RECORDING_TIME =
|
|
3457
|
+
const MIN_RECORDING_TIME = 2000;
|
|
3458
|
+
const MAX_RECORDING_TIME = 10000;
|
|
3454
3459
|
let _initialized = false;
|
|
3455
3460
|
function init() {
|
|
3456
3461
|
if (!_initialized) {
|
|
@@ -3480,8 +3485,6 @@ var pxsim;
|
|
|
3480
3485
|
const recordingType = pxsim.isSafari() ? "audio/mp4" : "audio/ogg; codecs=opus";
|
|
3481
3486
|
const blob = new Blob(state.chunks, { type: recordingType });
|
|
3482
3487
|
state.audioURL = window.URL.createObjectURL(blob);
|
|
3483
|
-
state.recording = new Audio(state.audioURL);
|
|
3484
|
-
state.initListeners();
|
|
3485
3488
|
}
|
|
3486
3489
|
state.currentlyRecording = false;
|
|
3487
3490
|
state.recorder = null;
|
|
@@ -3562,12 +3565,13 @@ var pxsim;
|
|
|
3562
3565
|
init();
|
|
3563
3566
|
stopAudio();
|
|
3564
3567
|
const state = b.recordingState;
|
|
3568
|
+
const volume = pxsim.AudioContextManager.isMuted() ? 0 : Math.round((pxsim.music.volume() / 0xff) * 100) / 100;
|
|
3569
|
+
state.recording = pxsim.AudioContextManager.createAudioSourceNode(state.audioURL, state.audioClippingThreshold, volume);
|
|
3570
|
+
state.initListeners();
|
|
3565
3571
|
state.audioPlaying = true;
|
|
3566
3572
|
setTimeout(async () => {
|
|
3567
3573
|
if (!state.currentlyErasing && state.recording) {
|
|
3568
3574
|
try {
|
|
3569
|
-
const volume = pxsim.AudioContextManager.isMuted() ? 0 : 1;
|
|
3570
|
-
state.recording.volume = volume;
|
|
3571
3575
|
const minPlaybackRate = 0.15;
|
|
3572
3576
|
// 15 is the maximum playback rate that still produced sound in Chrome on Windows.
|
|
3573
3577
|
// In Firefox, it seems like 8 is the max. Higher numbers silently fail.
|
|
@@ -3628,6 +3632,19 @@ var pxsim;
|
|
|
3628
3632
|
}
|
|
3629
3633
|
record_1.erase = erase;
|
|
3630
3634
|
function setMicrophoneGain(gain) {
|
|
3635
|
+
const b = pxsim.board();
|
|
3636
|
+
if (!b)
|
|
3637
|
+
return;
|
|
3638
|
+
const tolerance = 0.1 * Number.EPSILON;
|
|
3639
|
+
if (gain - 0.079 < tolerance) { // low mic sensitivity
|
|
3640
|
+
b.recordingState.audioClippingThreshold = 0.08;
|
|
3641
|
+
}
|
|
3642
|
+
else if (gain - 0.2 < tolerance) { // mid mic sensitivity
|
|
3643
|
+
b.recordingState.audioClippingThreshold = 0.03;
|
|
3644
|
+
}
|
|
3645
|
+
else if (gain - 1.0 < tolerance) { // high mic sensitivity
|
|
3646
|
+
b.recordingState.audioClippingThreshold = 0.01;
|
|
3647
|
+
}
|
|
3631
3648
|
}
|
|
3632
3649
|
record_1.setMicrophoneGain = setMicrophoneGain;
|
|
3633
3650
|
function audioDuration(sampleRate) {
|
|
@@ -3809,7 +3826,8 @@ var pxsim;
|
|
|
3809
3826
|
//%
|
|
3810
3827
|
function __playSoundExpression(notes, waitTillDone) {
|
|
3811
3828
|
notes = lookupBuiltIn(notes);
|
|
3812
|
-
pxsim.
|
|
3829
|
+
const volume = pxsim.music.volume() / 0xff;
|
|
3830
|
+
pxsim.codal.music.__playSoundExpression(notes, waitTillDone, volume);
|
|
3813
3831
|
}
|
|
3814
3832
|
music.__playSoundExpression = __playSoundExpression;
|
|
3815
3833
|
function __stopSoundExpressions() {
|