SetPlayList

Category: Music
Since engine version: 4.2 OC

Description

Sets the play list of pieces of music to be played in random order, if music is activated. The actual number of pieces of music in the playlist is returned, or 0 in network mode.

Syntax

int SetPlayList(any playlist, int at_player, bool force_change, int fadetime_ms, int resume_time_ms);

Parameters

playlist:
[opt] If this parameter is a string: List of pieces of music to be played. The individual file and category names are separated with semicolons (";"). Wildcards are expanded. If the parameter is left out, the standard playlist is restored. The parameter may also be a proplist with any of the following members:
Property Type Meaning
PlayList string Same as providing the playlist directly as a string.
MusicBreakMin int Minimum time of silence between two songs in milliseconds. Defaults to 10000.
MusicBreakMax int Maximum time of silence between two songs in milliseconds. Defaults to 10000. A random value between the minimum and maximum is chosen before each new song is selected.
MusicBreakChance int Chance in percent that silence is inserted between two songs. Defaults to 50.
MusicMaxPositionMemory int Time in seconds that the current position in a piece is remembered and will be used for resume if it becomes available through a call to SetPlayList. Defaults to 420. A value of zero means infinite memory.
at_player:
[opt] The playlist is changed only on clients where the player with this player number is local. If left out or NO_OWNER, the playlist is changed for all clients. If the player number is invalid, no playlists are changed.
force_change:
[opt] If true and the new playlist does not contain the piece currently playing, a new song is selected and played.
fadetime_ms:
[opt] Fade time to the new piece if force_change is true and the current song is changed in response to this call. Set to zero to change music instantly.
resume_time_ms:
[opt] If greater than zero and changing the playlist causes a new piece to be selected immediately, the upcoming piece is resumed from the position where it last stopped playing if at least this amount of time is still left to be played.

Remarks

Pieces are identified either by matching file name or any matching category. Categories are only available for .ogg files and may be set as a semicolon-delimited list in the comment field. Matching is case-insensitive, but case insensitive matching does not work for extended UTF8 characters.
SetPlayList does not activate music playback when the player has turned the music off. If the player enables music, the new playlist takes effect.
SetPlayList("*.*") is not identical to SetPlayList(). The former activates all music, the latter only those not starting with "@", the standard behavior.
See also: Music
PeterW, 2003-01
Sven2, 2015-09