minetest.sound_play

From Minetest Developer Wiki
Revision as of 14:08, 19 January 2013 by PilzAdam (talk | contribs)
Jump to navigation Jump to search

Syntax

minetest.sound_play(SimpleSoundSpec, SoundParameters)

Description

Plays a sound.

SimpleSoundSpec can be a string with the filename (without the file extention) or a table with the fields name="name" and gain=float.

SoundParameters is a table with the following fields:

  • gain = float: the gain (default 1.0)
  • max_hear_distance = int: the maximum hear distance
  • loop = bool: Sound is looped

The location can be specified with one of the following fields (if none is used, its played locationless to all players):

  • to_player = "playername": Sound is played locationless to the player
  • pos = position: Sound is played at this position
  • object = ObjectRef: Sound is played connected to the object

The function returns a sound hanlder that can be passed to minetest.sound_stop(handle) to stop the sound.

Mbox information.png This article is missing examples.
Feel free to add them.