Module Musician.Preloader
Preloads sample files into the disk cache in background
Functions
| Musician.Preloader.AddPreloaded (sampleId) | Flag a note sample as preloaded |
| Musician.Preloader.GetCursorKey (cursor) | Return the key to be preloaded by cursor. |
| Musician.Preloader.GetFrameWaitingTime () | Return frame waiting time in seconds |
| Musician.Preloader.GetProgress () | Return the initial preloading progression |
| Musician.Preloader.Init () | Preloader initialization |
| Musician.Preloader.IsComplete () | Return true if all the samples have been preloaded |
| Musician.Preloader.IsPreloaded (sampleId, currentCycle) | Return true if the note sample has been preloaded |
| Musician.Preloader.OnUpdate (elapsed) | Main on update function, called on each frame |
| Musician.Preloader.PreloadNext () | Preload next sample |
| Musician.Preloader.PreloadNote (instrument, key) | Preload note |
| Musician.Preloader.QuickPreload () | Attempt to preload all samples at startup |
Functions
- Musician.Preloader.AddPreloaded (sampleId)
-
Flag a note sample as preloaded
Parameters:
- sampleId (string) as returned by Musician.Sampler.GetSampleId()
- Musician.Preloader.GetCursorKey (cursor)
-
Return the key to be preloaded by cursor.
Starts from the middle to the bounds to preload the most used keys in priority.
Parameters:
- cursor (number) cursor key
Returns:
-
(number) key to be preloaded
- Musician.Preloader.GetFrameWaitingTime ()
-
Return frame waiting time in seconds
Returns:
-
(number)
- Musician.Preloader.GetProgress ()
-
Return the initial preloading progression
Returns:
-
(number)
- Musician.Preloader.Init ()
- Preloader initialization
- Musician.Preloader.IsComplete ()
-
Return true if all the samples have been preloaded
Returns:
-
(boolean)
- Musician.Preloader.IsPreloaded (sampleId, currentCycle)
-
Return true if the note sample has been preloaded
Parameters:
- sampleId (string) as returned by Musician.Sampler.GetSampleId()
- currentCycle (boolean) for current preloading cycle only (even if the sample is already in cache)
Returns:
-
(boolean)
- Musician.Preloader.OnUpdate (elapsed)
-
Main on update function, called on each frame
Parameters:
- elapsed (number)
- Musician.Preloader.PreloadNext ()
- Preload next sample
- Musician.Preloader.PreloadNote (instrument, key)
-
Preload note
Parameters:
- instrument (int)
- key (int)
Returns:
- hasSample (boolean)
- preloadTime (number) in seconds
- Musician.Preloader.QuickPreload ()
- Attempt to preload all samples at startup