Skip to main content
reskate.music reads the song playing and skips it, and reskate.spatialize_music plays the music through a speaker you place. Every function, and the track_changed event, needs the music permission; calling one without it raises an error. See permissions. There are two kinds of music:
  • An outside player: Spotify or another app playing on the player’s computer, read and controlled through Windows’ own media controls (the ones the media keys use). current, play, pause, next and previous work on it.
  • The game’s own soundtrack, on the player’s headphones. game and game_next work on it. While a Spotify station is on, the outside player’s song is the one heard, and the game’s soundtrack has no song.
play, pause, next, previous and game_next share a budget of 2 calls a second.

An outside player

reskate.music.current()

The song the outside player has now. The first call starts ReSkate listening to it.
table or nil
nil when there is no outside player to read.
Needs the music permission.

reskate.music.play()

Tells the outside player to play.
boolean
True when the command was sent. It does not say an app took it.
string
"more than 2 a second" when ok is false.
Needs the music permission.

reskate.music.pause()

Tells the outside player to pause.
boolean
True when the command was sent.
string
"more than 2 a second" when ok is false.
Needs the music permission.

reskate.music.next()

Tells the outside player to skip to the next song.
boolean
True when the command was sent.
string
"more than 2 a second" when ok is false.
Needs the music permission (and input for the example’s bind).

reskate.music.previous()

Tells the outside player to go back a song.
boolean
True when the command was sent.
string
"more than 2 a second" when ok is false.
Needs the music permission.

The game’s soundtrack

reskate.music.game()

The song the game’s own soundtrack plays now.
table or nil
nil while a Spotify station is on, or before a song has started.
Needs the music permission.

reskate.music.game_next()

Skips the game’s soundtrack to its next song.
boolean
True when the song was skipped.
string
Why not: "asked more than twice in a second" or "the game's music cannot skip now (a Spotify station is on, or no song has started)".
Needs the music permission. Shares the budget of 2 calls a second with the outside player’s commands.

A speaker in the world

reskate.spatialize_music(speaker)

Plays the music through a speaker your plugin places: a boombox on the ground, a car stereo, a club’s sound system. Your plugin works out where the speaker is relative to the listener and passes the result. ReSkate applies it to the music as the game streams it:
  • the song a Spotify station is playing, and
  • any other stream of 45 seconds or more: the game’s own songs, and songs from the world’s speakers.
Shorter streams are the world’s short music loops. mute_loops silences them instead. Each long stream has its own filters, so the two songs of a crossfade never share a filter’s state.
table, nil or false
required
The speaker’s settings, or nil or false to turn it off at once.
boolean
True when the speaker is on now. Always false on a dedicated server, which plays no music.
A number past its range is held to it. A number that is not finite raises an error, and so does anything but a table, nil or false. A setting lasts about 2 seconds. Call it every tick you want the speaker. When your plugin stops or crashes, the music is back as it was within 2 seconds. Turned on again after it was off or ran out, the speaker starts with fresh filters.
A real speaker pans: work out which side of the listener it is on (with the camera’s right from reskate.camera.get, which needs camera) and give that ear more gain, a clearer low-pass and the earlier sound (itd). The example above needs skater.read for the skater’s position.
Needs the music permission. It changes only how the music sounds on your game. Plugins cannot change the game’s volume or sound settings.

The track_changed event

Fired when anything about the outside player’s song changes: another song, or it pauses or plays. ReSkate looks once a second. The game’s own soundtrack does not fire it.
string
The app playing it, by its application id as Windows names it.
string
The song’s title.
string
Its artist.
boolean
False while it is paused.
The event’s table has no album; call reskate.music.current() for it. Registering a handler needs the music permission. See events.