![]() |
Maestro - Midi Player Tool Kit for Unity Version 2.18.2
|
Start, stop, pause, resume, replay, and sequence MIDI playback. More...
Play and Stop MIDI | |
| bool | MidiPlayerTK.MidiFilePlayer.MPTK_StartPlayAtFirstNote |
| If the value is true, MIDI playing will begin at the first note found in the MIDI. | |
| bool | MidiPlayerTK.MidiFilePlayer.MPTK_StopPlayOnLastNote |
| By default, the end of a MIDI file is not the last note. It is the last MIDI event. If this value is true, MIDI playback will stop at the last note found in the MIDI file and the OnEventEndPlay will be triggered at the last note. | |
| ModeStopPlay | MidiPlayerTK.MidiFilePlayer.MPTK_ModeStopVoice |
| Defined the behavior of the MIDI player when playback is stopped with MPTK_Stop or restarted when the last MIDI events is reached and MPTK_MidiAutoRestart is set to true. Code example: | |
| bool | MidiPlayerTK.MidiFilePlayer.MPTK_PlayOnStart [get, set] |
| Whether the MIDI playback starts when the application starts? | |
| bool | MidiPlayerTK.MidiFilePlayer.MPTK_MidiAutoRestart [get, set] |
| When the value is true, the current MIDI playing is restarted when it reaches the end of the MIDI file or #MPTK_MidiLoaded.MPTK_TickEnd. . | |
| bool | MidiPlayerTK.MidiFilePlayer.MPTK_IsPaused [get] |
| Is MIDI file playing is paused ? | |
| bool | MidiPlayerTK.MidiFilePlayer.MPTK_IsPlaying [get] |
| Is MIDI file is playing ? | |
| virtual void | MidiPlayerTK.MidiFilePlayer.MPTK_Play (bool alreadyLoaded=false) |
| Plays the midi file defined with MPTK_MidiName or MPTK_MidiIndex. In the most part of the case, just call midiFilePlayer.MPTK_Play() in your script. But sometimes, you want to apply some changes on the MIDI file before playing it. The script example below describes how to load a MIDI file, apply some changes and play it. Thank to the parameter 'alreadyLoaded'. When true, the MIDI has been already loaded with MPTK_Load(). | |
| void | MidiPlayerTK.MidiFilePlayer.MPTK_Stop (bool stopAllSound=true, float wait=-1f) |
| Stops MIDI playback and cancels all sounds. This operation is performed in background, so MIDI may really stop after this method returns. | |
| void | MidiPlayerTK.MidiFilePlayer.MPTK_RePlay () |
| Restart playing of the current midi file. | |
| void | MidiPlayerTK.MidiFilePlayer.MPTK_Pause (float timeToPauseMS=-1f) |
| Pause the current playing. Use MPTK_UnPause to continue playing. | |
| void | MidiPlayerTK.MidiFilePlayer.MPTK_UnPause () |
| UnPause the current playing when MidiPlayer is paused with MPTK_Pause. | |
| void | MidiPlayerTK.MidiFilePlayer.MPTK_Next () |
| Plays next MIDI from the list of midi defined in MPTK (see Unity menu Midi). | |
| void | MidiPlayerTK.MidiFilePlayer.MPTK_Previous () |
| Plays previous MIDI from the list of midi defined in MPTK (see Unity menu Midi). | |
| void | MidiPlayerTK.MidiFilePlayer.MPTK_PlayNextOrPrevious (int offset) |
| Plays the next or previous MIDI from the MidiDB list. | |
| void | MidiPlayerTK.MidiFilePlayer.MPTK_SwitchMidiWithDelay (int index, string name, float volume, float delayToStopMillisecond, float delayToStartMillisecond) |
| Switches playback between two MIDIs with ramp-up. This method is useful for integration with Bolt: main MIDI parameters are defined in one call. | |
| virtual void | MidiPlayerTK.MidiFilePlayer.MPTK_Play (float delayRampUp, float startDelay=0) |
| Plays the MIDI file defined by MPTK_MidiName or MPTK_MidiIndex with ramp-up to the volume defined by MPTK_Volume. The time to get a MIDI playing at full MPTK_Volume is delayRampUp + startDelay. A delayed start can also be set. | |
| void | MidiPlayerTK.MidiFilePlayer.MPTK_Play (byte[] data) |
| Plays a MIDI file from a byte array. Check MPTK_StatusLastMidiLoaded to get the load status. | |
| void | MidiPlayerTK.MidiFilePlayer.MPTK_Play (MPTKWriter mfw2, float delayRampUp=0f, float fromPosition=0, float toPosition=0, long fromTick=0, long toTick=0, bool timePosition=true) |
| Plays a MIDI from a MidiFileWriter2 object. | |
| virtual void | MidiPlayerTK.MidiFilePlayer.MPTK_Stop (float delayRampDown, float stopDelay=0) |
| Stops playback after a delay. After the stop delay (0 by default), the volume decreases until playback stops. The time to get a real MIDI stop is delayRampDown + stopDelay. | |
Start, stop, pause, resume, replay, and sequence MIDI playback.
|
virtual |
Plays the midi file defined with MPTK_MidiName or MPTK_MidiIndex. In the most part of the case, just call midiFilePlayer.MPTK_Play() in your script. But sometimes, you want to apply some changes on the MIDI file before playing it. The script example below describes how to load a MIDI file, apply some changes and play it. Thank to the parameter 'alreadyLoaded'. When true, the MIDI has been already loaded with MPTK_Load().
| alreadyLoaded | true: the MIDI has already been loaded (see MPTK_Load() v2.9.0 |
Reimplemented in MidiPlayerTK.MidiExternalPlayer.
| void MidiPlayerTK.MidiFilePlayer.MPTK_Stop | ( | bool | stopAllSound = true, |
| float | wait = -1f ) |
Stops MIDI playback and cancels all sounds. This operation is performed in background, so MIDI may really stop after this method returns.
| stopAllSound | Set to true to stop all sounds (default), otherwise currently playing notes will continue until they finish. |
| wait | With Legacy mode and if greater than -1 (v2.16), waits until MIDI playback is fully stopped or the specified wait time (in milliseconds) is reached. Otherwise, returns immediately. |
| void MidiPlayerTK.MidiFilePlayer.MPTK_Pause | ( | float | timeToPauseMS = -1f | ) |
Pause the current playing. Use MPTK_UnPause to continue playing.
| timeToPauseMS | time to pause in milliseconds. default or < 0 : indefinitely |
| void MidiPlayerTK.MidiFilePlayer.MPTK_PlayNextOrPrevious | ( | int | offset | ) |
Plays the next or previous MIDI from the MidiDB list.
| offset | Forward or backward offset in the list. 1 = next, -1 = previous. |
| void MidiPlayerTK.MidiFilePlayer.MPTK_SwitchMidiWithDelay | ( | int | index, |
| string | name, | ||
| float | volume, | ||
| float | delayToStopMillisecond, | ||
| float | delayToStartMillisecond ) |
Switches playback between two MIDIs with ramp-up.
This method is useful for integration with Bolt: main MIDI parameters are defined in one call.
| index | Index of the MIDI to play. Used only if name is null or empty. |
| name | Name of the MIDI to play. Can be part of the MIDI name. If set, this parameter has priority over index . |
| volume | Volume of the MIDI. Use -1 to keep the default volume. |
| delayToStopMillisecond | Delay before stopping the currently playing MIDI (with volume decrease), or delay before playback if no MIDI is playing. |
| delayToStartMillisecond | Delay to reach full MIDI volume (ramp-up volume). |
|
virtual |
Plays the MIDI file defined by MPTK_MidiName or MPTK_MidiIndex with ramp-up to the volume defined by MPTK_Volume.
The time to get a MIDI playing at full MPTK_Volume is delayRampUp + startDelay.
A delayed start can also be set.
| delayRampUp | Ramp-up delay, in milliseconds, to reach the default volume. |
| startDelay | Delayed start, in milliseconds. V2.89.1 |
| void MidiPlayerTK.MidiFilePlayer.MPTK_Play | ( | byte[] | data | ) |
Plays a MIDI file from a byte array.
Check MPTK_StatusLastMidiLoaded to get the load status.
| void MidiPlayerTK.MidiFilePlayer.MPTK_Play | ( | MPTKWriter | mfw2, |
| float | delayRampUp = 0f, | ||
| float | fromPosition = 0, | ||
| float | toPosition = 0, | ||
| long | fromTick = 0, | ||
| long | toTick = 0, | ||
| bool | timePosition = true ) |
Plays a MIDI from a MidiFileWriter2 object.
| mfw2 | A MidiFileWriter2 object. |
| delayRampUp |
|
virtual |
Stops playback after a delay. After the stop delay (0 by default), the volume decreases until playback stops.
The time to get a real MIDI stop is delayRampDown + stopDelay.
| delayRampDown | Fade-out time in milliseconds. |
| stopDelay | Delayed stop in milliseconds. V2.89.1 |
| bool MidiPlayerTK.MidiFilePlayer.MPTK_StartPlayAtFirstNote |
If the value is true, MIDI playing will begin at the first note found in the MIDI.
Obviously, all previous events are processed, but at the same tick as the first note-on.
Often, the first note is not set at the beginning of the MIDI file (which is tick 0), alSo there is a delay before playing the first note.
This setting is useful to start playing sound immediately. Works also when looping.
| bool MidiPlayerTK.MidiFilePlayer.MPTK_StopPlayOnLastNote |
By default, the end of a MIDI file is not the last note. It is the last MIDI event.
If this value is true, MIDI playback will stop at the last note found in the MIDI file
and the OnEventEndPlay will be triggered at the last note.
| ModeStopPlay MidiPlayerTK.MidiFilePlayer.MPTK_ModeStopVoice |
Defined the behavior of the MIDI player when playback is stopped with MPTK_Stop or restarted when the last MIDI events is reached and MPTK_MidiAutoRestart is set to true.
Code example:
|
getset |
When the value is true, the current MIDI playing is restarted when it reaches the end of the MIDI file or #MPTK_MidiLoaded.MPTK_TickEnd.
.