Skip to content

Commit 5bcd964

Browse files
authored
play widget (#4471)
1 parent d2654b0 commit 5bcd964

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

js/turtle-singer.js

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -667,10 +667,14 @@ class Singer {
667667
*/
668668
static setMasterVolume(logo, volume, blk) {
669669
const activity = logo.activity;
670-
const firstConnection = activity.logo.blockList[blk].connections[0];
671-
const lastConnection = last(activity.logo.blockList[blk].connections);
672670
volume = Math.min(Math.max(volume, 0), 100);
673-
logo.synth.setMasterVolume(volume, firstConnection, lastConnection);
671+
if (blk) {
672+
const firstConnection = activity.logo.blockList[blk].connections[0];
673+
const lastConnection = last(activity.logo.blockList[blk].connections);
674+
logo.synth.setMasterVolume(volume, firstConnection, lastConnection);
675+
} else {
676+
logo.synth.setMasterVolume(volume);
677+
}
674678
for (const turtle of activity.turtles.turtleList) {
675679
for (const synth in turtle.singer.synthVolume) {
676680
turtle.singer.synthVolume[synth].push(volume);

0 commit comments

Comments
 (0)