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,nextandpreviouswork on it. - The game’s own soundtrack, on the player’s headphones.
gameandgame_nextwork 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.
Needs the
music permission.reskate.music.play()
Tells the outside player to play.
Needs the
music permission.reskate.music.pause()
Tells the outside player to pause.
Needs the
music permission.reskate.music.next()
Tells the outside player to skip to the next song.
Needs the
music permission (and input for the example’s bind).reskate.music.previous()
Tells the outside player to go back a song.
Needs the
music permission.The game’s soundtrack
reskate.music.game()
The song the game’s own soundtrack plays now.
Needs the
music permission.reskate.music.game_next()
Skips the game’s soundtrack to its next song.
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.
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.
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.
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.
album; call reskate.music.current() for it. Registering a handler needs the music permission. See events.