diff --git a/multiplayer/src/services/simHost.ts b/multiplayer/src/services/simHost.ts index aaff752ecae1..be52c0706446 100644 --- a/multiplayer/src/services/simHost.ts +++ b/multiplayer/src/services/simHost.ts @@ -372,7 +372,6 @@ export async function simulateAsync( driver.options.onSimulatorCommand = msg => { if (msg.command === "restart") { runOptions.storedState = getStoredState(runOpts); - driver.stopSound(); driver.run(js, runOptions); } if (msg.command == "setstate") { diff --git a/pxtrunner/runner.ts b/pxtrunner/runner.ts index ef6394b16a62..7bb57b15a349 100644 --- a/pxtrunner/runner.ts +++ b/pxtrunner/runner.ts @@ -388,7 +388,6 @@ namespace pxt.runner { simDriver.options.onSimulatorCommand = msg => { if (msg.command === "restart") { runOptions.storedState = getStoredState(simOptions.id) - simDriver.stopSound(); simDriver.run(js, runOptions); } if (msg.command == "setstate") { diff --git a/pxtsim/simdriver.ts b/pxtsim/simdriver.ts index 0c7126e914cc..e9ffe6dcc38f 100644 --- a/pxtsim/simdriver.ts +++ b/pxtsim/simdriver.ts @@ -512,6 +512,7 @@ namespace pxsim { public stop(unload = false, starting = false) { this.clearDebugger(); + this.stopSound(); this.postMessage({ type: 'stop', source: MESSAGE_SOURCE }); this.setState(starting ? SimulatorState.Starting : SimulatorState.Stopped); if (unload) @@ -519,6 +520,7 @@ namespace pxsim { } public suspend() { + this.stopSound(); this.postMessage({ type: 'stop', source: MESSAGE_SOURCE }); this.setState(SimulatorState.Suspended); } @@ -695,6 +697,7 @@ namespace pxsim { activePlayer: opts.activePlayer, theme: opts.theme, } + this.stopSound(); this.start(); } diff --git a/webapp/src/app.tsx b/webapp/src/app.tsx index 00c9fc7b9cc7..985eb3f7aae0 100644 --- a/webapp/src/app.tsx +++ b/webapp/src/app.tsx @@ -3645,7 +3645,6 @@ export class ProjectView || this.debugOptionsChanged()) { this.startSimulator(); } else { - simulator.driver.stopSound(); simulator.driver.restart(); // fast restart } simulator.driver.focus() diff --git a/webapp/src/simulator.ts b/webapp/src/simulator.ts index 12b7010a11cc..01d09e8618c6 100644 --- a/webapp/src/simulator.ts +++ b/webapp/src/simulator.ts @@ -350,7 +350,6 @@ export function mute(mute: boolean) { export function stop(unload?: boolean, starting?: boolean) { if (!driver) return; - driver.stopSound(); driver.stop(unload, starting); }