pxt
pxt copied to clipboard
volume for sound expressions in simulator
fixes https://github.com/microsoft/pxt-microbit/issues/5193
This pull request introduces support for specifying volume in sound expressions. The changes primarily focus on updating the playSoundExpressionAsync and related methods to include a volume parameter, and ensuring compatibility with existing components that utilize these methods.
Enhancements to sound expression functionality:
pxtsim/sound/soundexpression.ts: Added avolumeproperty to thePendingSoundinterface and updated the__playSoundExpressionandplaySoundExpressionAsyncmethods to accept avolumeparameter. Adjusted the internal logic to pass thevolumevalue through the sound playback pipeline. [1] [2] [3] [4] [5]
Updates to components using sound expressions:
webapp/src/components/soundEffectEditor/SoundEffectEditor.tsx: Updated the call toplaySoundExpressionAsyncto include a default volume value of127.webapp/src/components/soundEffectEditor/SoundGallery.tsx: Modified the call toplaySoundExpressionAsyncto include a default volume value of127.