Module Musician.Song
Song class
Class Musician.Song
Class Musician.Song
Song class
- Musician.Song.GetPlayingSongCount ()
-
Return the number of songs currently playing
Returns:
-
playingSongCount (int)
- Musician.Song.GetPlayingSongs ()
-
Return songs currently playing
Returns:
-
playingSongCount (int)
- Musician.Song.OnUpdate (elapsed)
-
Main on frame update function
Parameters:
- elapsed (number)
- Musician.Song.UnpackChunkData (data)
-
Unpack song chunk data
Parameters:
- data (string)
Returns:
-
chunk (table)
- Musician.Song.UnpackChunkHeader (data)
-
Unpack song chunk header
Parameters:
- data (string)
Returns:
- mode (int)
- songId (int)
- chunkDuration (number)
- playtimeLeft (number)
- position (table) player position and GUID
- trackCount (int)
- headerLength (number)
- Musician.Song:AppendChunk (chunk, mode, songId, chunkDuration, playtimeLeft, player)
-
Append chunk data to current song
Parameters:
- chunk (table)
- mode (number)
- songId (number)
- chunkDuration (number)
- playtimeLeft (number)
- player (string)
- Musician.Song:CancelImport ()
- Cancel current import
- Musician.Song:Clone ()
-
Clone song
Returns:
-
song (Musician.Song)
- Musician.Song:ConvertToLive ()
- Convert song to live mode. For testing only
- Musician.Song:GetId ()
-
Return song ID
Returns:
-
songId (int)
- Musician.Song:GetProgression ()
-
Return playing progression
Returns:
-
progression (number)
- Musician.Song:Import (data, crop[, previousProgression=0[, onComplete]])
-
Import song from string
Parameters:
- data (string)
- crop (boolean) Automatically crop song to first and last note
- previousProgression (number) Add previous progression (0-1) (default 0)
- onComplete (function) Called when the whole import process is complete. Argument is true when successful (optional)
- Musician.Song:ImportFromBase64 (base64data, crop[, onComplete])
-
Import song from a base 64 encoded string
Parameters:
- base64data (string)
- crop (boolean) Automatically crop song to first and last note
- onComplete (function) Called when the whole import process is complete. Argument is true when successful (optional)
- Musician.Song:IsAudible ()
-
Returns true when the song is being played and can be heard
Returns:
-
isAudible (boolean)
- Musician.Song:IsPlaying ()
-
Return true if the song is playing or about to be played (preloading).
Returns:
-
isPlaying (boolean)
- Musician.Song:NoteOff (track, key, audioOnly[, decay])
-
Stop a note of a track
Parameters:
- track (table) Reference to the track
- key (int) Note key
- audioOnly (boolean) Stop note audio only
- decay (number) Override instrument decay (optional)
- Musician.Song:NoteOn (track, noteIndex, retries)
-
Play a note
Parameters:
- track (table) Reference to the track
- noteIndex (int) Note index
- retries (int) Number of attempts to recover dropped notes
- Musician.Song:OnImportError ()
- Handle importing error
- Musician.Song:PackChunk (chunk)
-
Pack a song chunk
Parameters:
- chunk (table)
Returns:
-
data (string)
- Musician.Song:Play (delay)
-
Play song
Parameters:
- delay (number) Delay in seconds to wait before playing the song
- Musician.Song:PlayOnFrame (elapsed)
-
Play notes accordingly to every frame.
Parameters:
- elapsed (number)
- Musician.Song:Reset ()
- Reset song to initial position
- Musician.Song:Resume (eventSent)
-
Resume a song playing
Parameters:
- eventSent (boolean)
- Musician.Song:Seek (cursor)
-
Seek to position
Parameters:
- cursor (number)
- Musician.Song:SetTrackMuted (track, isMuted)
-
Mute or unmute track
Parameters:
- track (table)
- isMuted (boolean)
- Musician.Song:SetTrackSolo (track, isSolo)
-
Set/unset track solo
Parameters:
- track (table)
- isSolo (boolean)
- Musician.Song:SongNotesOff ()
- Stop all notes of the song
- Musician.Song:Stop ()
- Stop song
- Musician.Song:StopStreaming ()
- Stop streaming song
- Musician.Song:Stream ()
- Stream song
- Musician.Song:StreamOnFrame (elapsed)
-
Stream a chunk of the song on frame
Parameters:
- elapsed (number)
- Musician.Song:TrackIsMuted (track)
-
Return true if the track is muted
Parameters:
- track (table)
Returns:
-
isMuted (boolean)
- Musician.Song:TrackNotesOff (track, audioOnly)
-
Stop all notes of a track
Parameters:
- track (table) Reference to the track
- audioOnly (boolean)