minetest.sound_play
Jump to navigation
Jump to search
Syntax
minetest.sound_play(SimpleSoundSpec, SoundParameters)
Description
Plays a sound.
Only OGG files are supported. For positional playing of sounds, only single-channel (mono) files are supported. Otherwise OpenAL will play them non-positionally.
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 distanceloop = 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 playerpos = position
: Sound is played at this positionobject = 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.
This article is missing examples. Feel free to add them. |