Skip to content

Commit 0fe3de8

Browse files
committed
🐛 Fixed sound source creation on disabled bug
1 parent 2724852 commit 0fe3de8

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/framework/controllers/soundscape.ts

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,8 +136,11 @@ class Soundscape {
136136
source.buffer = this.sounds[handle].buffer;
137137
source.connect(this.sounds[handle].gain);
138138
source.loop = loop;
139-
if (!this.soundState?.[handle]?.isEnable) return null;
140139
source.start(0);
140+
if (!this.soundState?.[handle]?.isEnable) {
141+
this.sounds[handle].ctx.suspend();
142+
return null;
143+
}
141144
return source;
142145
}
143146

0 commit comments

Comments
 (0)