Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 1 addition & 7 deletions src/board/audio/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,13 +138,7 @@ export class Audio {
}
}

boardStopped() {
if (this.context) {
this.context.close();
this.context = undefined;
this.oscillator = undefined;
}
Comment on lines -142 to -146
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Previously thrown away when the board was stopped, but not re-initialised on a soft reboot. This is now thrown away when stop() is called.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can this mean we keep playing sounds? Would it be better to close/reinit the audio?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This doesn't appear to be the case. It may be safer, but we need to find a way to pass wrapped._microbit_hal_audio_ready_callback and wrapped._microbit_hal_audio_speech_ready_callback into an init function that is called on a soft reboot.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm fine with this approach if there aren't practical issues. It might be safer in other ways as the audio context creation will always tied to a user event so less likely to hit browser issues.

}
boardStopped() {}
}

class BufferedAudio {
Expand Down