Module music
Music Lua module.
Typical usage would be something like:
music.load( "intro" ) -- Load the song music.play() -- Play it
Functions
choose (situation) | Delays a rechoose. |
play () | Plays the loaded song. |
pause (disable) | Pauses the music engine. |
stop (nodisable) | Stops playing the current song. |
isPlaying () | Checks to see if something is playing. |
current () | Gets the name of the current playing song. |
getVolume (log) | Gets the volume level of the music. |
Functions
- choose (situation)
-
Delays a rechoose.
Parameters:
- situation string Situation to choose.
Usage:
music.choose( "ambient" ) -- Rechooses ambient in 5 seconds
- play ()
- Plays the loaded song. Will resume paused songs.
- pause (disable)
-
Pauses the music engine.
Parameters:
- disable boolean Whether or not to disable music changes until music.play() is called. This disables all in-game music changes such as taking off.
- stop (nodisable)
-
Stops playing the current song.
Parameters:
- nodisable boolean Whether or not to disable music changes until music.play() is called. This disables all in-game music changes such as taking off. Disables by false, set to true to only stop the current song.
- isPlaying ()
-
Checks to see if something is playing.
Returns:
-
boolean
true if something is playing.
- current ()
-
Gets the name of the current playing song.
Returns:
- string The name of the current playing song or "none" if no song is playing.
- number The current offset inside the song (-1. if music is none).
Usage:
songname, songplayed = music.current()
- getVolume (log)
-
Gets the volume level of the music.
Parameters:
- log boolean Whether or not to get the volume in log scale.
Returns:
-
number
Volume level of the music.