Maestro - Midi Player Tool Kit for Unity Version 2.19.0
Loading...
Searching...
No Matches
Status, Timing, and Callbacks

Monitor loading progress, completion status, and timing information. More...

Variables

Action< float > MidiPlayerTK.MPTKSoundFont.ProgressCallback = null
 Called every 200 ms while a download is in progress. See also ProgressValue.
Action< MidiSynthMidiPlayerTK.MPTKSoundFont.LoadedCallback = null
 Define a callback when the SoundFont is loaded and ready to use.

Properties

float MidiPlayerTK.MPTKSoundFont.ProgressValue [get]
 Provides the download progress value. Normalized between 0 and 1. It should be a percentage, but webRequest may provide a value not directly related to the actual percentage.
LoadingStatusSoundFontEnum MidiPlayerTK.MPTKSoundFont.StatusSoundFont [get]
 Provides the status of the loaded SoundFont.
TimeSpan MidiPlayerTK.MPTKSoundFont.TimeToDownloadSoundFont [get]
 Time to download the SoundFont from a web resource or a local file.
TimeSpan MidiPlayerTK.MPTKSoundFont.TimeToLoadSoundFont [get]
 Time to load the SoundFont in the MidiSynth prefab.
TimeSpan MidiPlayerTK.MPTKSoundFont.TimeToLoadWave [get]
 Time to load samples in the MidiSynth.
TimeSpan MidiPlayerTK.MPTKSoundFont.TimeToLoadOverall [get]
 Total time to load the SoundFont.

Detailed Description

Monitor loading progress, completion status, and timing information.

Variable Documentation

◆ ProgressCallback

Action<float> MidiPlayerTK.MPTKSoundFont.ProgressCallback = null

Called every 200 ms while a download is in progress. See also ProgressValue.

midiSynth.MPTK_SoundFont.ProgressCallback = (float progress) =>
{
// Warning - this callback is not running inside the Unity thread.
// It's not possible to use Unity API. So forget to directly update the UI.
// One exception, Debug is authorized! But variable can be set and reuse in the Update() ... for example.
// The progress percentage provided by Unity SendWebRequest seems not a percentage. So, I removed the % character ...
Debug.Log($"<color=yellow>In Progress {midiSynth.name} {progress * 100:F0}</color>");
};

◆ LoadedCallback

Action<MidiSynth> MidiPlayerTK.MPTKSoundFont.LoadedCallback = null

Define a callback when the SoundFont is loaded and ready to use.

// This callback will be triggered when the soundfont is ready.
midiSynth.MPTK_SoundFont.LoadedCallback = (MidiSynth synth) =>
{
SoundfontIsReady(synth);
};
Core sample-based SoundFont synthesizer (base class).
Definition MidiSynth.cs:66