Skip to content

Commit 6b9f290

Browse files
committed
fix: only pop instrumentNames if setTimbre pushed it
Signed-off-by: Ady0333 <adityashinde1525@gmail.com>
1 parent f488f0b commit 6b9f290

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

js/turtleactions/ToneActions.js

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,10 @@ function setupToneActions(activity) {
8888
activity.logo.phraseMaker._instrumentName = synth;
8989
}
9090

91+
let pushed = false;
9192
if (!tur.singer.instrumentNames.includes(synth)) {
9293
tur.singer.instrumentNames.push(synth);
94+
pushed = true;
9395
activity.logo.synth.loadSynth(turtle, synth);
9496

9597
if (tur.singer.synthVolume[synth] === undefined) {
@@ -113,7 +115,9 @@ function setupToneActions(activity) {
113115

114116
const __listener = () => {
115117
tur.inSetTimbre = false;
116-
tur.singer.instrumentNames.pop();
118+
if (pushed) {
119+
tur.singer.instrumentNames.pop();
120+
}
117121
};
118122

119123
activity.logo.setTurtleListener(turtle, listenerName, __listener);

0 commit comments

Comments
 (0)