A fast 2D and 3D game engine — TypeScript SDK, C++/WebAssembly core, visual editor. Ship one project to web, desktop, WeChat MiniGames, playable ads, and native Android / iOS.
TypeScript 2d-game-engine3d3d-game-engineandroidcppecsgame-editorgame-enginegamedeviostypescriptwebassemblywebglwebgpuwechat-minigame
fix(audio): stop all tracked voices during device disposal
yhhd1efad9493b0
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex 4e6ae5d19..80ff7869b 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -14,6 +14,10 @@ published separately; it ships inside the editor.## [Unreleased]+### Fixed++- **Stopping editor Play stops game audio.** Single-player Stop now releases the game App and its plugins while keeping the engine renderer warm for re-Play. BGM and scripted/source voices are stopped, pending audio loads cannot resume playback, and a Stop during startup cancels the realm. This applies to both the editor UI and MCP (`set_play: stopped`).+## [0.77.0] - 2026-10-10### Addeddiff --git a/desktop b/desktopindex de04b6350..7caf339be 160000--- a/desktop+++ b/desktop@@ -1 +1 @@-Subproject commit de04b63500fff9715086bebb8bcba49398e199e7+Subproject commit 7caf339be459eae0fc443a0fe1c3cb81eb586faddiff --git a/sdk/src/audio/Audio.ts b/sdk/src/audio/Audio.tsindex 3d9d18ea7..53b7d9fa6 100644--- a/sdk/src/audio/Audio.ts+++ b/sdk/src/audio/Audio.ts@@ -718,6 +718,11 @@ export class AudioAPI {this.bgmHandle_.stop();this.bgmHandle_ = null;}+ // Scripted effects and AudioSource voices also belong to this device.+ // Closing a Web Audio context alone leaves their handles marked playing,+ // and a different backend may require explicit stops before disposal.+ for (const voice of this.softVoices_) voice.handle.stop();+ this.softVoices_ = [];for (const entry of this.bufferCache_.values()) {this.backend_?.unloadBuffer(entry.handle);}diff --git a/sdk/tests/audio-api.test.ts b/sdk/tests/audio-api.test.tsindex f3cbef852..a74b1d878 100644--- a/sdk/tests/audio-api.test.ts+++ b/sdk/tests/audio-api.test.ts@@ -295,6 +295,19 @@ describe('AudioAPI', () => {});describe('dispose', () => {+ it('stops scripted and looping source voices before disposing the device', async () => {+ await audio.preload('tone.wav');+ const effect = createMockHandle(), source = createMockHandle();+ const stopped: string[] = [];+ effect.stop = vi.fn(() => { stopped.push('effect'); });+ source.stop = vi.fn(() => { stopped.push('source'); });+ backend.dispose = vi.fn(() => { stopped.push('device'); });+ vi.mocked(backend.play).mockReturnValueOnce(effect).mockReturnValueOnce(source);+ audio.playSFX('tone.wav');+ audio.playBuffer(audio.getBufferHandle('tone.wav')!, { loop: true });+ audio.dispose();+ expect(stopped).toEqual(['effect', 'source', 'device']);+ });it('should stop BGM and dispose backend', async () => {await audio.preload('bgm.mp3');const mockHandle = createMockHandle();