pxt-core 11.4.36 → 11.4.37

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/pxt.js CHANGED
@@ -160165,13 +160165,14 @@ var pxsim;
160165
160165
  return playing;
160166
160166
  }
160167
160167
  music.isSoundExpPlaying = isSoundExpPlaying;
160168
- function __playSoundExpression(notes, waitTillDone) {
160168
+ function __playSoundExpression(notes, waitTillDone, volume = 0.03) {
160169
160169
  if (!soundQueue)
160170
160170
  soundQueue = [];
160171
160171
  const cb = pxsim.getResume();
160172
160172
  const soundPromise = new Promise((resolve, reject) => {
160173
160173
  soundQueue.push({
160174
160174
  notes,
160175
+ volume,
160175
160176
  onStarted: () => {
160176
160177
  if (!waitTillDone)
160177
160178
  cb();
@@ -160195,7 +160196,7 @@ var pxsim;
160195
160196
  let currentToken = cancellationToken;
160196
160197
  try {
160197
160198
  sound.onStarted();
160198
- await playSoundExpressionAsync(sound.notes, () => currentToken.cancelled);
160199
+ await playSoundExpressionAsync(sound.notes, () => currentToken.cancelled, undefined, sound.volume);
160199
160200
  if (currentToken.cancelled) {
160200
160201
  sound.onCancelled();
160201
160202
  }
@@ -160220,7 +160221,7 @@ var pxsim;
160220
160221
  };
160221
160222
  }
160222
160223
  music.clearSoundQueue = clearSoundQueue;
160223
- function playSoundExpressionAsync(notes, isCancelled, onPull) {
160224
+ function playSoundExpressionAsync(notes, isCancelled, onPull, volume = 0.03) {
160224
160225
  const synth = new music.SoundEmojiSynthesizer(0);
160225
160226
  const soundEffects = parseSoundEffects(notes);
160226
160227
  synth.play(soundEffects);
@@ -160246,7 +160247,7 @@ var pxsim;
160246
160247
  arr[i] = ((buff[i] - 512) / 512);
160247
160248
  }
160248
160249
  return arr;
160249
- }, synth.sampleRate, 0.03, () => cancelled || (isCancelled && isCancelled()))
160250
+ }, synth.sampleRate, volume, () => cancelled || (isCancelled && isCancelled()))
160250
160251
  ]);
160251
160252
  }
160252
160253
  music.playSoundExpressionAsync = playSoundExpressionAsync;
package/built/pxtsim.d.ts CHANGED
@@ -1986,9 +1986,9 @@ declare namespace pxsim.codal.music {
1986
1986
  protected getValue(offset: number, length: number): number;
1987
1987
  }
1988
1988
  function isSoundExpPlaying(): boolean;
1989
- function __playSoundExpression(notes: string, waitTillDone: boolean): void;
1989
+ function __playSoundExpression(notes: string, waitTillDone: boolean, volume?: number): void;
1990
1990
  function clearSoundQueue(): void;
1991
- function playSoundExpressionAsync(notes: string, isCancelled?: () => boolean, onPull?: (freq: number, volume: number) => void): Promise<void>;
1991
+ function playSoundExpressionAsync(notes: string, isCancelled?: () => boolean, onPull?: (freq: number, volume: number) => void, volume?: number): Promise<void>;
1992
1992
  function __stopSoundExpressions(): void;
1993
1993
  interface TonePrint {
1994
1994
  tonePrint: (arg: number[], position: number) => number;
package/built/pxtsim.js CHANGED
@@ -9861,13 +9861,14 @@ var pxsim;
9861
9861
  return playing;
9862
9862
  }
9863
9863
  music.isSoundExpPlaying = isSoundExpPlaying;
9864
- function __playSoundExpression(notes, waitTillDone) {
9864
+ function __playSoundExpression(notes, waitTillDone, volume = 0.03) {
9865
9865
  if (!soundQueue)
9866
9866
  soundQueue = [];
9867
9867
  const cb = pxsim.getResume();
9868
9868
  const soundPromise = new Promise((resolve, reject) => {
9869
9869
  soundQueue.push({
9870
9870
  notes,
9871
+ volume,
9871
9872
  onStarted: () => {
9872
9873
  if (!waitTillDone)
9873
9874
  cb();
@@ -9891,7 +9892,7 @@ var pxsim;
9891
9892
  let currentToken = cancellationToken;
9892
9893
  try {
9893
9894
  sound.onStarted();
9894
- await playSoundExpressionAsync(sound.notes, () => currentToken.cancelled);
9895
+ await playSoundExpressionAsync(sound.notes, () => currentToken.cancelled, undefined, sound.volume);
9895
9896
  if (currentToken.cancelled) {
9896
9897
  sound.onCancelled();
9897
9898
  }
@@ -9916,7 +9917,7 @@ var pxsim;
9916
9917
  };
9917
9918
  }
9918
9919
  music.clearSoundQueue = clearSoundQueue;
9919
- function playSoundExpressionAsync(notes, isCancelled, onPull) {
9920
+ function playSoundExpressionAsync(notes, isCancelled, onPull, volume = 0.03) {
9920
9921
  const synth = new music.SoundEmojiSynthesizer(0);
9921
9922
  const soundEffects = parseSoundEffects(notes);
9922
9923
  synth.play(soundEffects);
@@ -9942,7 +9943,7 @@ var pxsim;
9942
9943
  arr[i] = ((buff[i] - 512) / 512);
9943
9944
  }
9944
9945
  return arr;
9945
- }, synth.sampleRate, 0.03, () => cancelled || (isCancelled && isCancelled()))
9946
+ }, synth.sampleRate, volume, () => cancelled || (isCancelled && isCancelled()))
9946
9947
  ]);
9947
9948
  }
9948
9949
  music.playSoundExpressionAsync = playSoundExpressionAsync;