Module music
Music Lua module.
Typical usage would be something like:
music.load( "intro" ) -- Load the song music.play() -- Play it
Functions
delay (situation, delay) | Delays a rechoose. |
load (name) | Loads a song. |
play () | Plays the loaded song. |
stop ([disable=false]) | Stops playing the current song. |
isPlaying () | Checks to see if something is playing. |
current () | Gets the name of the current playing song. |
setRepeat (repeat) | Makes the music repeat. |
getVolume (log) | Gets the volume level of the music. |
Functions
- delay (situation, delay)
-
Delays a rechoose.
Parameters:
- situation string Situation to choose.
- delay number Delay in seconds.
Usage:
music.delay( "ambient", 5.0 ) -- Rechooses ambient in 5 seconds
- load (name)
-
Loads a song.
Restores the music system if it was temporarily disabled.
Parameters:
- name string Name of the song to load.
- play ()
-
Plays the loaded song.
Restores the music system if it was temporarily disabled.
- stop ([disable=false])
-
Stops playing the current song.
Parameters:
- disable boolean Whether or not to disable the music system temporarily after stopping. (default false)
- 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 (0. if music is none).
Usage:
songname, songplayed = music.current()
- setRepeat (repeat)
-
Makes the music repeat. This gets turned of when a new music is chosen, e.g., take-off or landing.
Parameters:
- repeat boolean Whether or not repeat should be set.
- 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.