SetList Class

Used to access and control Cantabile's set list functionality.

Access this object via the Cantabile#setList property.

class SetList extends EndPoint {
    get items(): SetListItem[];
    get name(): string;
    get preLoaded(): boolean;
    get currentSongIndex(): number;
    get currentSong(): SetListItem;
    loadSongByIndex(index: number, delayed?: boolean): void;
    loadSongByProgram(program: number, delayed?: boolean): void;
    loadFirstSong(delayed?: boolean): void;
    loadLastSong(delayed?: boolean): void;
    loadNextSong(direction: number, delayed?: boolean, wrap?: boolean): void;
    available(): string[];
    loadSetList(name: string, loadFirst?: boolean): void;
}

#Properties

#currentSong

The currently loaded SetListItem (or null if the current song isn't in the set list). See also #currentSongIndex.

get currentSong(): SetListItem;

#currentSongIndex

The index of the currently loaded song (or -1 if the current song isn't in the set list). See also #currentSong.

get currentSongIndex(): number;

#items

An array of SetListItem items in the set list

get items(): SetListItem[];

#name

The display name of the current set list (ie: its file name with path and extension removed)

get name(): string;

#preLoaded

Indicates if the set list is currently pre-loaded

get preLoaded(): boolean;

#Methods

#available()

Gets a list of available set lists in the user's set list folder

available(): string[];

#loadFirstSong()

Load the first song in the set list

loadFirstSong(delayed?: boolean): void;
  • delayed Whether to perform a delayed or immediate load

#loadLastSong()

Load the last song in the set list

loadLastSong(delayed?: boolean): void;
  • delayed Whether to perform a delayed or immediate load

#loadNextSong()

Load the next or previous song in the set list

loadNextSong(direction: number, delayed?: boolean, wrap?: boolean): void;
  • direction Direction to move (1 = next, -1 = previous)

  • delayed Whether to perform a delayed or immediate load

  • wrap Whether to wrap around at the start/end of the list

#loadSetList()

Loads the specified set list from the user's set list folder

loadSetList(name: string, loadFirst?: boolean): void;
  • name Name of the set to load (relative to user's set list folder, without extension)

  • loadFirst True to load the first song in the set list (default = true)

#loadSongByIndex()

Load the song at a given index position

loadSongByIndex(index: number, delayed?: boolean): void;
  • index The zero based index of the song to load

  • delayed Whether to perform a delayed or immediate load

#loadSongByProgram()

Load the song with a given program number

loadSongByProgram(program: number, delayed?: boolean): void;
  • program The zero based program number of the song to load

  • delayed Whether to perform a delayed or immediate load

#Events

#'changed' Event

Fired when anything about the contents of the set list changes

setList.on('changed', () => { });

#'currentSongChanged' Event

Fired when the currently loaded song changes

setList.on('currentSongChanged', () => { });

#'currentSongPartChanged' Event

Fired when the part of the currently loaded song changes

setList.on('currentSongPartChanged', (part: Number, partCount: Number) => { });
  • part The zero-based current song part index (can be -1)

  • partCount The number of parts in the current song

#'itemAdded' Event

Fired after a new item has been added to the set list

setList.on('itemAdded', (index: Number) => { });
  • index The zero based index of the newly added item

#'itemChanged' Event

Fired when something about an item has changed

setList.on('itemChanged', (index: Number) => { });
  • index The zero based index of the item that changed

#'itemMoved' Event

Fired when an item in the set list has been moved

setList.on('itemMoved', (from: Number, to: Number) => { });
  • from The zero based index of the item before being moved

  • to The zero based index of the item's new position

#'itemRemoved' Event

Fired after an item has been removed from the set list

setList.on('itemRemoved', (index: Number) => { });
  • index The zero based index of the removed item

#'nameChanged' Event

Fired when the name of the currently loaded set list changes

setList.on('nameChanged', () => { });

#'preLoadedChanged' Event

Fired when the pre-loaded state of the list has changed

setList.on('preLoadedChanged', () => { });

#'reload' Event

Fired when the entire set list has changed (eg: after a sort operation, or loading a new set list)

setList.on('reload', () => { });