OptionalatPlace this sound at a fixed world point. Same coordinates and same
defaults as follow, for something that does not move.
Mutually exclusive with follow: passing both throws, rather than
quietly picking one and leaving the other looking broken.
OptionalfollowPlace this sound at a renderable and keep it there, re-reading its world position every frame. Tracking stops when the renderable is destroyed.
Positions are WORLD pixels, with +y down like everything else in
melonJS; the Y flip Web Audio wants is applied for you. Sounds placed
this way are given the pixel-shaped panner defaults, which
audio.setSpatialDefaults() can change and audio.panner() overrides.
OptionalloopLoop playback when the region ends. Defaults to false.
OptionalonendCalled when this instance finishes playing.
OptionalspriteName of a region declared in the clip's sprite map. Omit to play the
whole clip.
OptionalstopStop the sound when the renderable it follows is destroyed, rather than
leaving it playing where the renderable was. Defaults to false.
Note that stopping discards the playback id, so keep this false for a
looping sound you intend to reposition and resume later.
OptionalvolumePlayback volume, 0.0..1.0. Defaults to the current global volume.
Options accepted by
audio.playin place of the positionalloopargument.Every field is optional, and the positional form
play(name, loop, onend, volume)continues to work unchanged.