Skip to content

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.

fix(audio): a voice cap is a policy, and travels without a bus to carry it

esengined7e4579c67e2
diff --git a/pipeline/src/project/format.ts b/pipeline/src/project/format.ts
index 404f3eb5c..2a46f4856 100644
--- a/pipeline/src/project/format.ts
+++ b/pipeline/src/project/format.ts
@@ -621,7 +621,9 @@ export function parseManifest(raw: unknown): ProjectManifest {
}
if (f.audio && typeof f.audio === 'object') {
const audio = parseAudioProjectConfig(f.audio);
- if (audio.buses) features.audio = audio;
+ // A voice cap is a policy on its own: keeping this to `buses` dropped a
+ // project that asked for one and shipped the default instead, silently.
+ if (audio.buses || audio.maxVoices !== undefined) features.audio = audio;
}
if (f.ui && typeof f.ui === 'object') {
const u = f.ui as Record<string, unknown>;
diff --git a/pipeline/src/project/runtimeConfig.ts b/pipeline/src/project/runtimeConfig.ts
index a881bb026..4859b9773 100644
--- a/pipeline/src/project/runtimeConfig.ts
+++ b/pipeline/src/project/runtimeConfig.ts
@@ -199,7 +199,8 @@ export function packagedRuntimeFields(rc: RuntimeProjectConfig): PackagedRuntime
// this would have spelled out.
...(rc.physicsEnabled ? { physicsEnabled: true } : {}),
...(isDefaultPhysics(rc.physicsConfig) ? {} : { physicsConfig: rc.physicsConfig }),
- ...(rc.audioConfig.buses?.length ? { audioConfig: rc.audioConfig } : {}),
+ ...(rc.audioConfig.buses?.length || rc.audioConfig.maxVoices !== undefined
+ ? { audioConfig: rc.audioConfig } : {}),
...(rc.achievements.length ? { achievements: rc.achievements } : {}),
...(rc.steamAppId > 0 ? { steamAppId: rc.steamAppId } : {}),
};
diff --git a/pipeline/src/runtime/gameHost.ts b/pipeline/src/runtime/gameHost.ts
index bb16568aa..2a81779be 100644
--- a/pipeline/src/runtime/gameHost.ts
+++ b/pipeline/src/runtime/gameHost.ts
@@ -19,7 +19,7 @@ import {
acquireWebGPUDevice, ThirdPersonCamera, CharacterController3D, AnimatorController,
Animator, TPC_SPEED, TPC_GROUNDED, Particle, MeleeAttack, Health,
Hunter, NavAgent, Perception, AnimatorRootMotion, Playthrough, Name,
- worldResidencyReport, PostProcess, Renderer,
+ worldResidencyReport, PostProcess, Renderer, Audio,
} from 'esengine';
import type {
SceneData, AddressableManifest, PackagedGameConfig, RenderSurfaceSource, WorldManifest,
@@ -604,6 +604,24 @@ async function boot(): Promise<void> {
shadow: Renderer.shadowStatus(entity),
};
},
+ /**
+ * The project's own configuration, as the SHIPPING runtime holds it: what
+ * the package carries beside what the runtime ended up with. A manifest
+ * proving itself proves only that the packager wrote what it wrote.
+ */
+ configFacts(busNames: string[] = []): Record<string, unknown> {
+ const audio = app.hasResource(Audio) ? app.getResource(Audio) : null;
+ const names = new Set([...busNames, ...(cfg.audioConfig?.buses ?? []).map((b) => b.name)]);
+ return {
+ carried: { audioConfig: cfg.audioConfig ?? null },
+ audio: audio ? {
+ maxVoices: audio.maxVoices,
+ buses: Object.fromEntries([...names].map((n) => [n, {
+ volume: audio.getBusVolume(n), muted: audio.isBusMuted(n),
+ }])),
+ } : null,
+ };
+ },
/**
* Take the GPU away, and read what the renderer says about itself after.
*
diff --git a/tools/launchers/residency-run.mjs b/tools/launchers/residency-run.mjs
index 3e893316b..d34378a3d 100644
--- a/tools/launchers/residency-run.mjs
+++ b/tools/launchers/residency-run.mjs
@@ -21,7 +21,8 @@
* A script is a list of steps: {do:"read",as}, {do:"walkTo",x,z},
* {do:"tap",key}, {do:"step",frames}, {do:"stream",as,key,count},
* {do:"loseDevice",as}, {do:"readiness",as,cell}, {do:"counters",as},
- * {do:"renderFacts",as}, {do:"decisions",as,name}. Each read prints one JSON line.
+ * {do:"renderFacts",as}, {do:"decisions",as,name}, {do:"configFacts",as,buses}.
+ * Each read prints one JSON line.
*/
import { app, BrowserWindow } from 'electron';
import http from 'node:http';
@@ -253,6 +254,13 @@ async function main() {
console.log(`readiness ${step.as}: ${JSON.stringify({ claim, device })}`);
continue;
}
+ if (step.do === 'configFacts') {
+ await settle();
+ const f = await exec(
+ `window.__estellaCooked.configFacts(${JSON.stringify(step.buses ?? [])})`);
+ console.log(`reading ${step.as}: ${JSON.stringify(f)}`);
+ continue;
+ }
if (step.do === 'renderFacts') {
await settle();
const facts = await exec('window.__estellaCooked.renderFacts()');