MidiPlayerGlobal is a singleton and static class for managing all global features of MPTK.

For non C# specialist:

  • singleton: only one instance can exist at the same time.
  • static: the class doesn’t need to be instantiated (done automatically by MPTK) in an object to be used. All properties are shared and are available for all others objects. That is very useful!

The script MidiPlayerGlobal.cs exists in each MPTK Prefab. But when running, only one is kept in the scene hierarchy.

Inspector [PRO only]

With the inspector, you can:

  • Current SoundFont: select a SoundFont from the MPTK SoundFont available.
  • Load SoundFont at startup: the selected SoundFont is loaded when application is started. It’s the default behaviors. It’s possible de disable this automatic loading.
  • Load Samples at startup (no core mode): the “no core mode” will be removed with the next major version.
  • SoundFont URL or file path: with the version Pro it’s possible to dynamically load a SoundFont when running from a local file on your desktop or from a web site. But, SoundFont loading could take some times.

Integration in your script

All methods and properties of MidiPlayerGlobal are static. So you can use directly by the class name to access it. Look at this page for more information how scripting with MPTK and to download the full documentation.

Example of methods. Read the API doc for a full information.

Debug.Log(string.Format("Load Time:{0} s    Samples:{1} s    Count Presets:{2}   Samples:{3}",