audio
A module script.
Interface
What this asset declares: the schema it conforms to, what it exposes, and the rendered structured payload.
conforms to
zero/source-extract/v2mistwood.audio — a small audio director over the Audio component. One place that knows where the sound bank lives, mixes one-shots and loops against the player's master/sfx/music volumes, and spawns the throwaway entities the Audio component plays from. The game just asks for sounds by short name; this module resolves the file, applies the mix, and cleans up naming so two one-shots never collide. Sounds live at /source/<DIR>/mw_<name>.wav. Call setVolumes() whenever the player changes a volume slider so the mix stays current. Usage: local Audio = require("mistwood.audio") Audio.setVolumes({ master = 0.9, sfx = 1.0, music = 0.7 }) Audio.play("click", { volume = 0.7 }) -- one-shot local amb = Audio.loop("ambience", 0.6, "ambient") Audio.setLoopVolume(amb, 0.2) -- fade a loop live
clamp01(v: ?) → void
| arg | type | description |
|---|---|---|
| v | ? |
url(name: ?) → void
VFS path of a named sound (so callers that build their own Audio component — e.g. a spatial looping growl on a creature — can reuse the resolution).
| arg | type | description |
|---|---|---|
| name | ? |
exists(name: ?) → void
| arg | type | description |
|---|---|---|
| name | ? |
setVolumes(s: ?) → void
Update the live mix from a settings table { master, sfx, music }.
| arg | type | description |
|---|---|---|
| s | ? |
play(name: ?, opts: ?) → void
Fire-and-forget one-shot. opts: { volume = 0..1, music = bool }.
| arg | type | description |
|---|---|---|
| name | ? | |
| opts | ? |
loop(name: ?, volume: ?, channel: ?) → void
A looping bed (ambience, drone, heartbeat, breath). Returns the entity id so the caller can fade it with setLoopVolume; nil if the sound is missing.
| arg | type | description |
|---|---|---|
| name | ? | |
| volume | ? | |
| channel | ? |
setLoopVolume(id: ?, v: ?) → void
| arg | type | description |
|---|---|---|
| id | ? | |
| v | ? |
Sub-parts
Everything contained inside this part. Assets are composite children (clickable cards). Files are leaf payloads. Expand any row to view its source.
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.