Class sound
Provides functions to play a loaded sound.
A sound can be started, paused and resumed. It also provides information if the sound has finished playing.
Info:
- Copyright: 2022 Patrick Lang
- Author: Patrick Lang
Methods
| sound:new (soundTableEntry, duration) | Creates a new sound. |
| sound:setVolume (volume) | Sets the volume of the sound. |
| sound:play () | Plays or resumes the sound. |
| sound:pause () | Pauses the sound. |
| sound:isFinished () | Checks whether the sound has finished playing. |
| sound:getSoundTableEntry () | Gets the reference to the entry in the FlyWithLua sound table. |
Methods
- sound:new (soundTableEntry, duration)
-
Creates a new sound.
Parameters:
- soundTableEntry number The reference to the entry in the FlyWithLua sound table.
- duration number The duration of the sound.
Returns:
-
sound
The created sound.
- sound:setVolume (volume)
-
Sets the volume of the sound.
A value of 1 means 100% (full volume), a value of 0.5 means 50% (half the volume).
Parameters:
- volume numer The volume to use.
- sound:play ()
- Plays or resumes the sound.
- sound:pause ()
- Pauses the sound. The sound is not paused if the sound has already been paused, has not been started or has finished playing.
- sound:isFinished ()
-
Checks whether the sound has finished playing.
Returns:
-
bool
Trueif the sound has not bee started, is currently paused or has finished playing, otherwisefalse. - sound:getSoundTableEntry ()
-
Gets the reference to the entry in the FlyWithLua sound table.
Returns:
-
number
The reference to the sound table entry.