Skip to content

Commit

Permalink
fix: hack fix to stop chord playing on widget close
Browse files Browse the repository at this point in the history
  • Loading branch information
meganindya committed Feb 15, 2021
1 parent bf67af5 commit 9211a0f
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion js/widgets/pitchstaircase.js
Original file line number Diff line number Diff line change
Expand Up @@ -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++) {
Expand Down Expand Up @@ -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,
Expand Down

0 comments on commit 9211a0f

Please sign in to comment.