Music
classBackground music playback control
Fields
| Name | Type | Description |
|---|---|---|
| playlist | string | Key of the active playlist |
| track_count | integer | Number of tracks in the active playlist |
Functions
Music:request_silence()
Fade out both channels and stop automatic track advance
Music:set_playlist(key)
Select a named playlist (e.g. default, cosmos). Returns whether the key exists
| key | string | Playlist key |
returns boolean
Music:play_track(index)
Play a track by zero-based index in the current playlist
| index | integer | Zero-based track index |
Music:play_track_crossfade(index, crossfade_seconds)
Play a track with explicit crossfade duration in seconds (0 = immediate)
| index | integer | Zero-based track index |
| crossfade_seconds | number | Crossfade duration in seconds |
Music:play_random()
Start a random track from the current playlist
Music:play_random_crossfade(crossfade_seconds)
Start a random track with explicit crossfade duration in seconds
| crossfade_seconds | number | Crossfade duration in seconds |
Inherited from Object (5)
- name Object name
- Object.find(name) Find an already loaded object by name
- Object.cast(object) Trying to cast Object into Object
- Object:get_class() Class of this object
- Object.get_class() Return Object class object