author | Wuzzy |
Wed, 30 Oct 2019 11:16:24 +0000 | |
changeset 2084 | 7fe5cb216b02 |
parent 2077 | 514babfbad9e |
child 2100 | f058bd501c06 |
permissions | -rw-r--r-- |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
1 |
#summary List of functions in the Lua API that affect the audio |
1844 | 2 |
#labels !LuaFunctions |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
3 |
|
1799 | 4 |
= Lua API: Audio functions = |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
5 |
This page is a list of all functios in the [LuaAPI Lua API] that affect the audio. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
6 |
|
1800 | 7 |
== `PlaySound(soundId, [gearUid [, instaVoice]])` == |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
8 |
Plays the specified sound. Possible values for `soundId` are listed on the [Sounds] page. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
9 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
10 |
To play a voice (see [Taunts] for a list), you must also set `gearUid`. `gearUid` is the hedgehog gear which is used to “talk”. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
11 |
|
2077
514babfbad9e
Remove outdated legacy hints as clutter
Wuzzy <almikes@aol.com>
parents:
1844
diff
changeset
|
12 |
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. You can disable this behaviour and force Hedgewars to instantly play the voice by also setting `instaVoice` to `true`. Only use `instaVoice` when you really need it. |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
13 |
|
1800 | 14 |
== `PlayMusicSound(soundId)` (0.9.25) == |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
15 |
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 `StopMusicSound` after a while. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
16 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
17 |
Example: |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
18 |
<code language="lua"> |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
19 |
PlayMusicSound(sndRideOfTheValkyries) -- Replace the background music the Ride of the Valkyries |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
20 |
</code> |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
21 |
|
1800 | 22 |
== `StopMusicSound(soundId)` (0.9.25) == |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
23 |
Stops the specified “music sound” (if it was still playing) and resumes the main background music. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
24 |
|
2077
514babfbad9e
Remove outdated legacy hints as clutter
Wuzzy <almikes@aol.com>
parents:
1844
diff
changeset
|
25 |
== `SetSoundMask(soundId, isMasked)` == |
1749
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
26 |
Disables a given sound (including taunts) from being played by the engine. `soundId` is a valid sound ID on [Sounds] or [Taunts]. `isMasked` is a boolean. If `true`, the sound will not be played by the engine anymore. If `false`, playing this sound is allowed again. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
27 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
28 |
Sounds played by the Lua function `PlaySound` will always work, however, and ignore the sound mask. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
29 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
30 |
Note: Due to the way the voices work internally in Hedgewars, if you want to play a masked voice, you have to set `instaVoice` to `true` when you call `PlaySound`. Otherwise, it won't work. |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
31 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
32 |
Example: |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
33 |
|
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
34 |
<code language="lua">SetSoundMask(sndIncoming, true) |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
35 |
-- Disable the “Incoming” sound from being played</code> |
91756d20ce3e
Separate core Lua stuff into new Lua pages for better maintainability. Main LuaAPI page not touched yet
Wuzzy <almikes@aol.com>
parents:
diff
changeset
|
36 |