Lua API: Audio functions
This page is a list of all functios in the Lua API
that affect the audio.
PlaySound(soundId, [gearUid [, instaVoice]])
Plays the specified sound. Possible values for
are listed on the Sounds
To play a voice (see Taunts for a list), you must also set
is the hedgehog gear which is used to “talk”.
If you play a voice, by default the voice will respect an internal queue and might be played with an delay in order to prevent annoying voice overlapping. Since version 0.9.24, you can disable this behaviour and force Hedgewars to instantly play the voice by also setting
. Only use
when you really need it.
Plays a sound as replacement for the background music. The sound is played once. The main music is paused and the sound is played instead. The main background music does not resume automatically, so you should call
after a while.
PlayMusicSound(sndRideOfTheValkyries) -- Replace the background music the Ride of the Valkyries
Stops the specified “music sound” (if it was still playing) and resumes the main background music.
Disables a given sound (including taunts) from being played by the engine.
is a valid sound ID on Sounds
is a boolean. If
, the sound will not be played by the engine anymore. If
, playing this sound is allowed again.
Sounds played by the Lua function
will always work, however, and ignore the sound mask.
Note: Due to the way the voices work internally in Hedgewars, if you want to play a masked voice, you have to set
when you call
. Otherwise, it won't work.
-- Disable the “Incoming” sound from being played