core
soundstage's shared plumbing: the per-frame tick the other modules register with, the auto-spawned host, kit-owned Audio voices, the world and player stores (swappable for tests), the listener position, and position conversion. Game code rarely needs it directly.
core
soundstage's shared plumbing: the per-frame tick the other modules register with, the auto-spawned host, kit-owned Audio voices, the world and player stores (swappable for tests), the listener position, and position conversion. Game code rarely needs it directly.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2soundstage internals shared by every part of the kit: the local host entity that ticks the kit in play, the long-lived voices (Audio sources) it owns, the shared stores, a clock and the random source. Game code uses `soundstage.music` / `sfx` / `footsteps` / `ambience` / `mix`; this module is what they stand on.
nextRand( ) → number
now( ) → number
Seconds the kit's clock has advanced (play time the host has ticked).
inPlay( ) → boolean
True in play mode (or while a test forces it).
_playScope(on: boolean?) → void
Tests only: force play mode on or off (nil = follow engine.mode).
| arg | type | description |
|---|---|---|
| on | boolean? |
random(lo: number, hi: number) → number
A uniform random number in [lo, hi).
| arg | type | description |
|---|---|---|
| lo | number | |
| hi | number |
randomInt(lo: number, hi: number) → number
A random whole number in [lo, hi].
| arg | type | description |
|---|---|---|
| lo | number | |
| hi | number |
_seed(n: number) → void
Tests only: reseed the random source so a run repeats.
| arg | type | description |
|---|---|---|
| n | number |
onTick(name: string, fn: (number) → void
Register a per-frame step under a name (re-registering the name replaces it).
| arg | type | description |
|---|---|---|
| name | string | |
| fn | (number |
tick(dt: number) → void
Advance the kit by dt seconds: the clock, then every registered step in order.
| arg | type | description |
|---|---|---|
| dt | number |
hostComponent( ) → string
ensureHost( ) → void
Make sure the local host entity that ticks the kit exists (play mode only). Every public call that needs time to pass calls this, so a game never places it by hand.
_attach(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
_detach(id: string) → void
| arg | type | description |
|---|---|---|
| id | string |
host( ) → string
The host entity id, or nil when none is running.
realVoice(name: string, fields: { [string]: any }, at: vector?) → any
| arg | type | description |
|---|---|---|
| name | string | |
| fields | { [string]: any } | |
| at | vector? |
comp( ) → any
setVolume(x: number) → void
| arg | type | description |
|---|---|---|
| x | number |
setClip(clip: any) → void
| arg | type | description |
|---|---|---|
| clip | any |
play( ) → void
stop( ) → void
destroy( ) → void
oneShot(clip: any, o: any?) → void
| arg | type | description |
|---|---|---|
| clip | any | |
| o | any? |
moveTo(p: vector) → void
| arg | type | description |
|---|---|---|
| p | vector |
isReady( ) → boolean
the mixer is playing this voice's clip: a streamed clip spends its first frames loading, and a fade that rises over those frames is a fade nobody hears
voiceReady(v: any) → boolean
Whether a voice is really sounding yet (a voice that cannot tell counts as ready).
| arg | type | description |
|---|---|---|
| v | any |
voice(name: string, fields: { [string]: any }, at: vector?) → any
Spawn a kit-owned voice: `fields` are Audio component fields, `at` an optional position.
| arg | type | description |
|---|---|---|
| name | string | |
| fields | { [string]: any } | |
| at | vector? |
_useVoiceFactory(fn: any) → void
Tests only: build voices with `fn(name, fields, at)` instead of spawning entities (nil = real).
| arg | type | description |
|---|---|---|
| fn | any |
worldStore( ) → any
The world-wide shared store (runtime_data.world, or a test stand-in).
playerStore(id: string) → any
A player's store (runtime_data.player(id), or a test stand-in).
| arg | type | description |
|---|---|---|
| id | string |
localId( ) → string
This client's player id, or nil when it has none.
_useStores(world: any, player: any) → void
Tests only: use stand-in stores (nil restores runtime_data).
| arg | type | description |
|---|---|---|
| world | any | |
| player | any |
players( ) → any
The players registry of the active root scene, or nil.
playerCount( ) → number
How many players are connected (1 when the registry cannot say).
othersPresent( ) → boolean
True when another player is in this play session: the players registry lists one, or the relay's play room holds another peer (the room knows before a joiner's registry does).
_usePlayers(reg: any, others: boolean?) → void
Tests only: stand in for the players registry and for whether others are present (nil = the real ones).
| arg | type | description |
|---|---|---|
| reg | any | |
| others | boolean? |
relaySend(channel: string, msg: any) → void
Send a transient message to every other player in the session (multiplayer.send). Nothing is stored: a player who is not here when it is sent never hears it.
| arg | type | description |
|---|---|---|
| channel | string | |
| msg | any |
relayOn(channel: string, fn: (any, any) → void
Hear other players' messages on `channel`: `fn(fromPeer, msg)` (multiplayer.on).
| arg | type | description |
|---|---|---|
| channel | string | |
| fn | (any, any |
_useRelay(r: any) → void
Tests only: use a stand-in relay `{ send(channel, msg), on(channel, fn) }` (nil = multiplayer).
| arg | type | description |
|---|---|---|
| r | any |
listenerPosition( ) → vector
Where this client hears from: the local avatar when there is one, else the camera.
toVector(v: any) → vector
Read a vector-ish value (vector, {x,y,z} or an entity) as a vector, or nil.
| arg | type | description |
|---|---|---|
| v | any |
_reset( ) → void
Tests only: forget the host and clock.
Voice = {Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
Showing up to 3 levels deep. Open a part to see what it holds further down.
Problems
Everything affecting this asset right now: its own problems, anything wrong inside it, and problems on its direct dependencies.
agent_score is exposed.+ quality × 0.35
+ performance × 0.25
± compat factor
Usability ratings
Did the part work as advertised when consumers tried to drop it in. Separate from upvotes: those are taste; this is "did it function".
Scoped to this part · feeds back into the world's score.