Sound

:= []

Finds Sound ids in a Manifest, and builds the Play Commands that your game returns from init or step.

resolve : Manifest, Str -> U32

The Sound id of a name in the Manifest, such as sound/jump. Call it once, in loaded, and keep the id in your Model. A name that is not in the Manifest gives 0, which plays nothing.

duration : Manifest, Str -> F32

The length in seconds at pitch 1 of the Sound with this name, such as sound/creak. A Speaker at pitch 2 ends in half this time. A name that is not in the Manifest, a mesh or a sky gives 0.

play : U32 -> Command

Plays the Sound with this id once, at gain 1 and pitch 1, Here at the Listener. For another gain, pitch or Place, write the Play tag yourself, such as Play({ sound: id, gain: 0.5, pitch: 1.0, at: Here }).