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
test(audio): certify authored source playback after packaging
yhh4e32ff5cc4ab
diff --git a/CHANGELOG.md b/CHANGELOG.mdindex b2e35aadd..06a2e0dad 100644--- a/CHANGELOG.md+++ b/CHANGELOG.md@@ -16,6 +16,8 @@ published separately; it ships inside the editor.### Fixed+- **Authored sound is verified in a packaged game.** Audio-demo's existing spatial source starts through its authored Playing flag. A separate launch unlocks browser audio away from every sound control and reads all spectrum bars, proving output from the scene source while preserving the Beat toggle's independent API and fade demonstration. The golden registry requires this measured run before certifying authored sound.+- **Package verification resolves output folders consistently.** Relative work and screenshot paths are resolved before child tools launch, so the editor and package runners write into the same requested folder instead of resolving paths against their own working directories.- **Finite native tween loops hand off their sequences.** Restart and ping-pong loops now resume a paused successor when their finite count completes, just like non-looping tweens. Completion leaves cancelled successors cancelled instead of reviving them and writing their target for another frame.diff --git a/examples/audio-demo/assets/scenes/main.esscene b/examples/audio-demo/assets/scenes/main.essceneindex 5735b3c9b..ac7b69727 100644--- a/examples/audio-demo/assets/scenes/main.esscene+++ b/examples/audio-demo/assets/scenes/main.esscene@@ -339,7 +339,7 @@"components": [{ "type": "Transform", "data": { "position": { "x": 0, "y": -160, "z": 0 } } },{ "type": "ShapeRenderer", "data": { "size": { "x": 40, "y": 40 }, "color": { "r": 0.36, "g": 0.86, "b": 0.78, "a": 1 } } },- { "type": "AudioSource", "data": { "clip": "@uuid:b7c1d2e3-4f5a-4b6c-8d7e-9f0a1b2c3d4e", "bus": "sfx", "volume": 0.7, "loop": true, "playOnAwake": true, "spatial": true, "minDistance": 90, "maxDistance": 700 } },+ { "type": "AudioSource", "data": { "clip": "@uuid:b7c1d2e3-4f5a-4b6c-8d7e-9f0a1b2c3d4e", "bus": "sfx", "volume": 0.7, "loop": true, "playing": true, "playOnAwake": false, "spatial": true, "minDistance": 90, "maxDistance": 700 } },{ "type": "Orbiting", "data": { "radius": 320, "speed": 0.6 } }]}diff --git a/tools/check-golden.mjs b/tools/check-golden.mjsindex 920a89f09..6e72739e6 100644--- a/tools/check-golden.mjs+++ b/tools/check-golden.mjs@@ -59,6 +59,7 @@ function projectText(id) {const NEEDS_RUN = {'texture-atlas': 'atlas',audio: 'audio',+ 'authored-sound': 'authoredAudio','safe-area': 'safeArea','pause-resume': 'suspend','hot-update': 'runBy',diff --git a/tools/goldenProjects.mjs b/tools/goldenProjects.mjsindex e76865f6c..dace63e82 100644--- a/tools/goldenProjects.mjs+++ b/tools/goldenProjects.mjs@@ -700,10 +700,6 @@ export const KNOWN_GAPS = {// Present in the engine and shown by non-golden samples, but never carried// through the chain by a project the release argues from.settings: 'Celestial Heights persists language, effects and key bindings and reads them back at boot; volume waits on the game having sound',- // hot-update-demo ships one now, so the package SHAPE is a real project's.- // What no automated run reaches is the vendor mounting it: only a mini-game- // host implements the download, and none of the tiers builds for one.- 'authored-sound': 'AudioSource.playing is what a graph, a behaviour or a wire raises, and audio-demo still starts its loop from code through Res(Audio) — no golden project sounds a clip from authored data yet; audio-source-flag.test.ts holds the contract',};/**@@ -1059,7 +1055,7 @@ export const GOLDEN = [},{id: 'audio-demo',- certifies: ['audio'],+ certifies: ['audio', 'authored-sound'],targets: ['web', 'desktop'],tier: 'release',interactGap: 'a pad plays a sound and draws nothing of its own — the audio block below is the run that reads the result',@@ -1067,6 +1063,7 @@ export const GOLDEN = [// way. Click for a SUSTAINED source (a one-shot ends before the capture), then// read the bar the visualizer writes from an analyser bin.audio: { toggle: { x: 0.5, y: 0.41 }, bar: 'Bar0', floor: 6, frames: 60 },+ authoredAudio: { unlock: { x: 0.02, y: 0.02 }, bars: Array.from({ length: 16 }, (_, i) => `Bar${i}`), floor: 6, frames: 60 },},];@@ -1108,7 +1105,7 @@ export function atTier(tier) {*/export function sharesOf(projects, n, owned) {const weight = (g) => g.targets.filter((t) => owned.has(t)).length- * (1 + [interactFor(g), audioFor(g), safeAreaFor(g), atlasFor(g)].filter(Boolean).length + (suspendFor(g) ? 3 : 0));+ * (1 + [interactFor(g), audioFor(g), g.authoredAudio, safeAreaFor(g), atlasFor(g)].filter(Boolean).length + (suspendFor(g) ? 3 : 0));const bins = Array.from({ length: n }, () => ({ projects: [], load: 0 }));for (const g of [...projects].sort((a, b) => weight(b) - weight(a))) {const bin = bins.reduce((least, b) => (b.load < least.load ? b : least));diff --git a/tools/releaseNotes.mjs b/tools/releaseNotes.mjsindex 8e21d99ab..d49657dfe 100644--- a/tools/releaseNotes.mjs+++ b/tools/releaseNotes.mjs@@ -28,6 +28,8 @@ export const NOTES_FLOOR = 'v0.65.0';* the reader recognises anyway.*/export const NOTED = {+ 'test(audio): certify authored source playback after packaging':+ { note: 'Authored sound is verified in a packaged game.' },'fix(test): resolve golden output paths before spawning tools':{ note: 'Package verification resolves output folders consistently.' },'fix(animation): hand off completed native tween loops':diff --git a/tools/verify-golden.mjs b/tools/verify-golden.mjsindex 15b811a3e..817d403f7 100644--- a/tools/verify-golden.mjs+++ b/tools/verify-golden.mjs@@ -423,6 +423,32 @@ for (const { id, target } of pairs) {// that starts the sound redraws itself either way. So drive the toggle and read// the height the game wrote from an analyser bin — silence leaves it on its floor.const audio = audioFor(golden);+ const authoredAudio = golden.authoredAudio;+ if (authoredAudio && target === 'web') {+ // This gesture only unlocks browser audio. It avoids every pad and the+ // music toggle, so only the scene's authored source can drive the spectrum.+ const probed = launchPackage(id, target, [+ '--dir', out,+ ...(timeoutMs ? ['--timeout', String(timeoutMs)] : []),+ '--input', JSON.stringify({ pointer: authoredAudio.unlock, frames: authoredAudio.frames ?? 60 }),+ '--probe', authoredAudio.bars.join(','),+ ]);+ const found = /probe: (\{.*\})/.exec(probed.stdout || '');+ let heights = [];+ try {+ const at = found ? JSON.parse(found[1]).at : null;+ heights = authoredAudio.bars.map(name => at?.[name]?.h);+ } catch { heights = []; }+ const complete = heights.length === authoredAudio.bars.length && heights.length > 0+ && heights.every(height => typeof height === 'number' && Number.isFinite(height));+ const peak = complete ? Math.max(...heights) : null;+ const ok = probed.status === 0 && peak !== null && peak > authoredAudio.floor;+ results.push({ id, target, stage: 'authored-audio', ok,+ why: ok ? '' : probed.status !== 0 ? `authored audio probe exited with ${probed.status ?? 'no status'}`+ : peak === null ? 'authored source spectrum bars were not readable'+ : `authored source spectrum stayed at ${peak} (floor ${authoredAudio.floor})` });+ console.log(`${ok ? '✓' : '✗'} ${id} ${target} — authored audio: peak ${peak ?? 'unreadable'} (silent floor ${authoredAudio.floor})`);+ }if (audio && target === 'web') {const probed = launchPackage(id, target, ['--dir', out,