Singleton class to manage all global MPTK features. More information here: https://paxstellar.fr/midiplayerglobal/.
More...
|
| static int | MPTK_FindMidi (string name) |
| | Find index of a Midi by name. Use the exact name defined in Unity resources folder MidiDB without any path or extension.
Tips: Add Midi files to your project with the Unity menu MPTK or add it directly in the resource folder and open Midi File Setup to automatically integrate Midi in MPTK.
|
| static float | MPTK_DistanceToListener (Transform trf) |
| | Calculate distance with the AudioListener.
|
|
static void | MPTK_Stop () |
| | Search for each MidiFilePlayer and stop playing and stop the MIDI synth.
|
|
static void | MPTK_Quit () |
| | Stops all MIDI synthesizers and exits the application.
|
| static bool | MPTK_IsReady (float delay=0.5f) |
| static bool | MPTK_SelectBankInstrument (int nbank) |
| | The default instrument and drum banks are defined with the popup "SoundFont Setup Alt-F" in the Unity editor.
This method change the default instrument drum bank and build the presets list associated. See MPTK_ListPreset.
Note 1: this call doesn't change the current MIDI bank used to play an instrument, only the content of MPTK_ListPreset.
Note 2: to apply the bank to all channels, the synth must be restarted: call MidiFilePlayer.MPTK_InitSynth.
Note 3: to change the current bank, rather use MidiFilePlayer.MPTK_ChannelPresetChange
.
|
| static bool | MPTK_SelectBankDrum (int nbank) |
| | The default instrument and drum banks are defined with the popup "SoundFont Setup Alt-F" in the Unity editor.
This method change the default instrument drum bank and the presets list associated. See MPTK_ListPresetDrum.
Note 1: this call doesn't change the current MIDI bank used to play a drum, only the content of MPTK_ListPresetDrum.
Note 2: to apply the bank to all channels, the synth must be restarted: call MidiFilePlayer.MPTK_InitSynth.
Note 3: to change the current bank, rather use MidiFilePlayer.MPTK_ChannelPresetChange
.
|
| static string | MPTK_GetPatchName (int bank, int patch) |
| | Return the name of the preset (patch) from a bank and patch number.
|
| static void | MPTK_SelectSoundFont (string name, bool restartPlayer=true) |
| | Changes the current SoundFont on the fly. If MidiFilePlayers are running, they are stopped and optionally restarted.
|
| static bool | MPTK_LoadLiveSF (string pPathSF=null, int defaultBank=-1, int drumBank=-1, bool restartPlayer=true, bool useCache=true, bool log=false) |
|
| static string | MPTK_SoundFontName |
| | Current Soundfont name.
|
|
static int | MPTK_CountWaveLoaded |
| | Number of samples loaded.
|
| static bool | MPTK_SoundFontLoaded = false |
| | Loading status for SoundFont from external file or URL. For status from local resources folder use MPTK_SoundFontIsReady.
|
|
static List< MPTKListItem > | MPTK_ListMidi |
| | List of MIDI files available. Add or remove MIDI from the Unity editor menu "MPTK / Midi File Setup" or Alt-M.
|
|
static List< MPTKListItem > | MPTK_ListPreset |
| | List of presets (instrument) for the default or selected bank.
The default bank can be changed with MPTK_SelectBankInstrument or with the popup "SoundFont Setup Alt-F" in the Unity editor.
|
|
static List< MPTKListItem > | MPTK_ListBank |
| | Gets the list of banks available.
The default bank can be changed with MPTK_SelectBankInstrument or MPTK_SelectBankDrum or with the menu "MPTK / SoundFont" or Alt-F in the Unity editor.
|
|
static List< MPTKListItem > | MPTK_ListPresetDrum |
| | List of drum set for the default or selected bank.
The default bank can be changed with MPTK_SelectBankDrum or with the menu "MPTK / SoundFont" or Alt-F in the Unity editor.
|
| static LoadingStatusSoundFontEnum | MPTK_StatusLastSoundFontLoaded |
| | Status of the last SoundFont loaded. The status is updated in a coroutine, so the status can change at each frame.
|
|
|
static string | MPTK_PathToResources [get] |
| | This path could change depending your project. Change the path before any actions in MPTK.
|
| static string | MPTK_PathSoundFontCache [get] |
| | Folder where Soundfont downloaded are saved (cache).
|
|
static TimeSpan | MPTK_TimeToDownloadSoundFont [get] |
| | Downloading or reading time for the current SoundFont.
|
|
static TimeSpan | MPTK_TimeToLoadSoundFont [get] |
| | Loading time for the current SoundFont.
|
|
static TimeSpan | MPTK_TimeToLoadWave [get] |
| | Loading time for the samples.
|
|
static bool | MPTK_SoundFontIsReady [get] |
| | Loading status for SoundFont from local resources folder. For runtime loading status use MPTK_SoundFontLoaded.
|
|
static int | MPTK_CountPresetLoaded [get] |
| | Count of preset loaded.
|
|
static bool | MPTK_LoadSoundFontAtStartup [get, set] |
| | If true load soundfont at startup.
|
|
static bool | VerboseGlobal [get, set] |
| | If true load all waves when application is started else load when need when playing (default) Useless?
|
| static UnityEvent | OnEventPresetLoaded [get, set] |
| | Event triggered at the end of the loading of the soundfont.
Setting this callback function by script (AddListener) is not recommended. It's better to set callback function from the inspector. See here:https://mptkapi.paxstellar.com/d7/dc4/class_midi_player_t_k_1_1_midi_player_global.html#a64995b20027b35286c143f9f25a1cb6d.
|
|
static List< string > | MPTK_ListSoundFont [get] |
| | List of Soundfont(s) available. With the MPTK PRO, add or remove SoundFonts from the Unity editor menu "MPTK / SoundFont Setup" or Alt-F.
|
Singleton class to manage all global MPTK features. More information here: https://paxstellar.fr/midiplayerglobal/.
◆ MPTK_FindMidi()
| int MidiPlayerTK.MidiPlayerGlobal.MPTK_FindMidi |
( |
string | name | ) |
|
|
static |
Find index of a Midi by name. Use the exact name defined in Unity resources folder MidiDB without any path or extension.
Tips: Add Midi files to your project with the Unity menu MPTK or add it directly in the resource folder and open Midi File Setup to automatically integrate Midi in MPTK.
- Parameters
-
| name | name of the midi without path nor extension |
- Returns
- -1 if not found else return the index of the midi.
◆ MPTK_DistanceToListener()
| float MidiPlayerTK.MidiPlayerGlobal.MPTK_DistanceToListener |
( |
Transform | trf | ) |
|
|
static |
Calculate distance with the AudioListener.
- Parameters
-
| trf | Transform of the object to calculate the distance. |
- Returns
◆ MPTK_IsReady()
| bool MidiPlayerTK.MidiPlayerGlobal.MPTK_IsReady |
( |
float | delay = 0::5f | ) |
|
|
static |
- Warning
- MPTK_IsReady has been deprecated, please investigate MPTK_Pulse in place <midiSynth>.MPTK_SoundFont.IsReady
if (!midiStreamPlayer.MPTK_SoundFont.IsReady)
return;
- Parameters
-
- Returns
◆ MPTK_SelectBankInstrument()
| bool MidiPlayerTK.MidiPlayerGlobal.MPTK_SelectBankInstrument |
( |
int | nbank | ) |
|
|
static |
The default instrument and drum banks are defined with the popup "SoundFont Setup Alt-F" in the Unity editor.
This method change the default instrument drum bank and build the presets list associated. See MPTK_ListPreset.
Note 1: this call doesn't change the current MIDI bank used to play an instrument, only the content of MPTK_ListPreset.
Note 2: to apply the bank to all channels, the synth must be restarted: call MidiFilePlayer.MPTK_InitSynth.
Note 3: to change the current bank, rather use MidiFilePlayer.MPTK_ChannelPresetChange
.
- Parameters
-
| nbank | Number of the SoundFont Bank to load for instrument. |
- Returns
- true if bank has been found else false.
◆ MPTK_SelectBankDrum()
| bool MidiPlayerTK.MidiPlayerGlobal.MPTK_SelectBankDrum |
( |
int | nbank | ) |
|
|
static |
The default instrument and drum banks are defined with the popup "SoundFont Setup Alt-F" in the Unity editor.
This method change the default instrument drum bank and the presets list associated. See MPTK_ListPresetDrum.
Note 1: this call doesn't change the current MIDI bank used to play a drum, only the content of MPTK_ListPresetDrum.
Note 2: to apply the bank to all channels, the synth must be restarted: call MidiFilePlayer.MPTK_InitSynth.
Note 3: to change the current bank, rather use MidiFilePlayer.MPTK_ChannelPresetChange
.
- Parameters
-
| nbank | Number of the SoundFont Bank to load for drum. |
- Returns
- true if bank has been found else false.
◆ MPTK_GetPatchName()
| string MidiPlayerTK.MidiPlayerGlobal.MPTK_GetPatchName |
( |
int | bank, |
|
|
int | patch ) |
|
static |
Return the name of the preset (patch) from a bank and patch number.
- Parameters
-
- Returns
- Name of the preset or empty if not found.
◆ MPTK_SelectSoundFont()
| void MidiPlayerTK.MidiPlayerGlobal.MPTK_SelectSoundFont |
( |
string | name, |
|
|
bool | restartPlayer = true ) |
|
static |
Changes the current SoundFont on the fly. If MidiFilePlayers are running, they are stopped and optionally restarted.
- Version
- Maestro Pro
- Parameters
-
| name | SoundFont name |
| restartPlayer | If a MIDI is playing, restart the currently playing MIDI. |
◆ MPTK_LoadLiveSF()
| bool MidiPlayerTK.MidiPlayerGlobal.MPTK_LoadLiveSF |
( |
string | pPathSF = null, |
|
|
int | defaultBank = -1, |
|
|
int | drumBank = -1, |
|
|
bool | restartPlayer = true, |
|
|
bool | useCache = true, |
|
|
bool | log = false ) |
|
static |
- Warning
- MPTK_LoadLiveSF has been deprecated; use <midiSynth>.MPTK_SoundFont.IsReady instead. Loads a SoundFont on the fly while the application is running.
The SoundFont is loaded from a local file, from the web, or from a cache.
If some MIDIs are playing, they are restarted.
Loading is done in the background (coroutine), so the method returns immediately.
- Version
- Maestro Pro - updated 2.11.2
- Note
- Look also:
- Parameters
-
| pPathSF | Full path to the SoundFont file. Must start with file:// for local desktop loading, or http:// / https:// for a web resource. If null, the path defined in MPTK_LiveSoundFont is used. |
| defaultBank | Default bank to use for instruments; use -1 to select the first bank. |
| drumBank | Bank to use for the drum kit; use -1 to select the last bank. |
| restartPlayer | Restart the MIDI player if needed. Default is true. |
| useCache | Reuse an already downloaded SoundFont if it exists. Default is true. |
| log | Display logs. Default is false. |
- Returns
- true if loading is in progress; use OnEventPresetLoaded to get information when loading is complete (for example, MPTK_StatusLastSoundFontLoaded)
- false if an error is detected in the parameters. The OnEventPresetLoaded callback is not called if false is returned.
◆ MPTK_SoundFontName
| string MidiPlayerTK.MidiPlayerGlobal.MPTK_SoundFontName |
|
static |
Current Soundfont name.
- Version
- 2.15.0
◆ MPTK_SoundFontLoaded
| bool MidiPlayerTK.MidiPlayerGlobal.MPTK_SoundFontLoaded = false |
|
static |
Loading status for SoundFont from external file or URL. For status from local resources folder use MPTK_SoundFontIsReady.
- False at start.
- True when a SF downloaded or loaded from the cache is ready.
◆ MPTK_LiveSoundFont
| string MidiPlayerTK.MidiPlayerGlobal.MPTK_LiveSoundFont |
- Warning
- MPTK_LiveSoundFont has been deprecated; use <midiSynth>.MPTK_SoundFont.IsReady instead. Gets or sets the full path to a SoundFont file (.sf2) or a URL to load. Defined in the MidiPlayerGlobal editor inspector. Must start with file:// or http:// or https://.
- Version
- Maestro Pro
◆ MPTK_StatusLastSoundFontLoaded
Status of the last SoundFont loaded. The status is updated in a coroutine, so the status can change at each frame.
- Version
- 2.11.2
◆ MPTK_PathSoundFontCache
| string MidiPlayerTK.MidiPlayerGlobal.MPTK_PathSoundFontCache |
|
staticget |
Folder where Soundfont downloaded are saved (cache).
- Version
- 2.11.2 Pro
◆ OnEventPresetLoaded
| UnityEvent MidiPlayerTK.MidiPlayerGlobal.OnEventPresetLoaded |
|
staticgetset |
Event triggered at the end of the loading of the soundfont.
Setting this callback function by script (AddListener) is not recommended. It's better to set callback function from the inspector. See here:https://mptkapi.paxstellar.com/d7/dc4/class_midi_player_t_k_1_1_midi_player_global.html#a64995b20027b35286c143f9f25a1cb6d.