microsoft / microsoft/pxt-microbit

Strange async behavior for play sound on hardware

Open
#4,109 2 comments 0 reactions 1 assignee View on GitHub

@abchatra is already working on this.

Since Feb 24, 2022.

hardware music P2 v2hardware
Dominant language
TypeScript
Stars
804
Forks
721
Avg merge
2d 9h
Merged PRs (30d)
2

Description

If you call the synchronous play sound immediately after a call to the asynchronous play sound, the program waits for the first to complete but not the second. In this program:

Screen Shot 2021-05-25 at 12 39 27 PM

When you press the B button, the icon shows after the first sound finishes instead of the second. This might be a DAL issue, but i'm not 100% sure

To Reproduce
Steps to reproduce the behavior:

  1. Download this program onto a microbit: https://makecode.microbit.org/_Az5FYmUtsDL9
  2. Press the A button, note the correct behavior
  3. Press the B button, note that the icon shows after the first (async) sound stops playing when it should only show after the second sound finishes

Expected behavior

Should wait until both sounds finish

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.