When Maestro MPTK load a MIDI from the MIDI db or from an external file (web or local), all the setting of the MIDI player (prefab MidiFilePlayer or MidiExternalPlay) are set to the default values found in the MIDI.
This code will not works:
// Select first MIDI in the DB
midiFilePlayer.MPTK_MidiIndex = 0;
// Disable MIDI channel 9 (generally drums)
midiFilePlayer.MPTK_ChannelEnableSet(9, false);
// Now, play, NOT WORKS, because channel settings will be set to default values.
midiFilePlayer.MPTK_Play();
It’s the same for properties like MPTK_InnerLoop. This code will works but with MIDI from your DB because the Load and Start MIDI are split.
// Select first MIDI in the DB
midiFilePlayer.MPTK_MidiIndex = 0;
MidiLoad midiloaded = midiFilePlayer.MPTK_Load();
// Disable MIDI channel 9 (generally drums)
midiFilePlayer.MPTK_ChannelEnableSet(9, false);
// Now, play!
midiFilePlayer.MPTK_Play(alreadyLoaded: true);
Another solution will works with MIDI from the DB (MidiFilePlayer prefab) and MIDI from a web site (MidiExternalPlay prefab). Here an example with an external MIDI:
private void Start()
{
midiExternalPlayer = FindFirstObjectByType<MidiExternalPlayer>();
// Event triggered when MIDI starts playing
midiExternalPlayer.OnEventStartPlayMidi.AddListener(StartPlay);
midiExternalPlayer.MPTK_Play();
}
public void StartPlay(string midiName)
{
// Disable MIDI channel 9
midiExternalPlayer .MPTK_ChannelEnableSet(9, false);
}
Obviously, changing these properties dynamically when the MIDI is playing is always possible.