Docs / Plugins / Plugin API reference
Sound
omsi.audio.* plays WAV files from the plugin's folder: everywhere, at a map point, or moving with the bus.
omsi.audio.play#
omsi.audio.play(file, [opts]) → integer id or nil, reason
Plays a WAV file of the plugin's folder. opts: volume (1), pitch (1), loop, range (metres heard at full volume, 5), and either x, y, z (a sound at a map point) or on_bus = true (it moves with the player's bus); none: heard alike everywhere. The game's volume setting applies. A plugin plays 32 at most.
Parameters: file string; opts table, optional.
Since 0.2.22. Permission: audio.
local id = omsi.audio.play("gong.wav", { on_bus = true, volume = 0.8 })omsi.audio.playing#
omsi.audio.playing(id) → boolean
Whether a sound of the plugin's still plays.
Parameters: id integer.
Since 0.2.22.
omsi.audio.set#
omsi.audio.set(id, opts) → boolean
Changes a sound of the plugin's: volume, pitch, range, x, y, z / on_bus.
Parameters: id integer; opts table.
Since 0.2.22. Permission: audio.
omsi.audio.stop#
omsi.audio.stop(id) → boolean
Stops a sound of the plugin's.
Parameters: id integer.
Since 0.2.22. Permission: audio.
omsi.audio.stop_all#
omsi.audio.stop_all() → nil
Stops every sound of the plugin's.
Since 0.2.22. Permission: audio.
omsi.audio.volume#
omsi.audio.volume() → number or nil
The game's volume setting, 0 to 1.
Since 0.2.22.
Something wrong or missing? Fix it on GitHub or open an issue.