From 9211a0fad5d77c195f6e5f697ab6099d44bb4578 Mon Sep 17 00:00:00 2001 From: Anindya Kundu Date: Mon, 15 Feb 2021 11:26:38 +0530 Subject: [PATCH] fix: hack fix to stop chord playing on widget close --- js/widgets/pitchstaircase.js | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/js/widgets/pitchstaircase.js b/js/widgets/pitchstaircase.js index 629072aa5b..2709436106 100644 --- a/js/widgets/pitchstaircase.js +++ b/js/widgets/pitchstaircase.js @@ -351,6 +351,8 @@ class PitchStaircase { * @returns {void} */ _playNext(index, next) { + if (this.closed) return; + if (index === this.Stairs.length) { setTimeout(() => { for (let i = 0; i < this.Stairs.length; i++) { @@ -609,10 +611,12 @@ class PitchStaircase { widgetWindow.show(); widgetWindow.onclose = () => { logo.synth.setMasterVolume(0); - logo.synth.stop(); + this.closed = true; widgetWindow.destroy(); }; + this.closed = false; + widgetWindow.addButton( "play-chord.svg", PitchStaircase.ICONSIZE,