Description and list of MIDI channels associated with the synth. Each MIDI synth has 16 channels that carry all the relevant MIDI information.
Channels distinguish instruments and provide independent control for each one. By sending MIDI messages on each channel, you can change instrument, volume, pitch, and other parameters. In Maestro MPTK, channels are indexed from 0 to 15. Channel 9 is reserved for drum sounds.
HelperDemo.GUI_Horizontal(HelperDemo.Zone.BEGIN);
GUILayout.Label("Channel Preset Name Preset / Bank",
myStyle.TitleLabel3, GUILayout.Width(60 + 140 + 120 + 100 + 110));
GUILayout.Label(" Count Enabled Volume",
myStyle.TitleLabel3, GUILayout.Width(900));
HelperDemo.GUI_Horizontal(HelperDemo.Zone.END);
{
HelperDemo.GUI_Horizontal(HelperDemo.Zone.BEGIN);
if (GUILayout.Button($" {channel:00}", myStyle.TitleLabel3, GUILayout.Width(60)))
GUILayout.Label(midiFilePlayer.
MPTK_Channels[channel].PresetName ??
"not set", myStyle.TitleLabel3, GUILayout.Width(140));
int presetForced = midiFilePlayer.
MPTK_Channels[channel].ForcedPreset;
string sPreset = presetForced == -1 ? $"{presetNum} / {bankNum}" : $"F{presetForced} / {bankNum}";
int forcePreset = (int)HelperDemo.GUI_Slider(sPreset, presetNum, -1f, 127f, alignCaptionRight: true, widthCaption: 120, widthSlider: 100, widthLabelValue: -1);
if (forcePreset != presetNum)
{
midiFilePlayer.
MPTK_Channels[channel].ForcedPreset = forcePreset;
}
GUILayout.Label($"{midiFilePlayer.MPTK_Channels[channel].NoteCount,-5}", myStyle.LabelRight, GUILayout.Width(100));
GUILayout.Label(" ", myStyle.TitleLabel3, GUILayout.Width(20));
bool state = GUILayout.Toggle(midiFilePlayer.
MPTK_Channels[channel].Enable,
"", GUILayout.MaxWidth(20));
{
Debug.LogFormat(
"Channel {0} state:{1}, preset:{2}", channel, state, midiFilePlayer.
MPTK_Channels[channel].PresetName ??
"not set");
}
float currentVolume = midiFilePlayer.
MPTK_Channels[channel].Volume;
float volume = HelperDemo.GUI_Slider(null, currentVolume, 0f, 1f, alignCaptionRight: true, enableButton: false, widthCaption: -1, widthSlider: 100, widthLabelValue: 40);
if (volume != currentVolume)
HelperDemo.GUI_Horizontal(HelperDemo.Zone.END);
}