private void GetChannelInstruments()
{
for (int i = 0; i < a_ChannelInstrumentNumbers.Length; i++)
{
a_ChannelInstrumentNumbers[i] = 1; // default is 1 (acoustic grand piano)
}
for (int i = 0; i < a_ChannelInstrumentNumbers.Length; i++)
{
a_ChannelInstrumentNames[i] = PatchChangeEvent.GetPatchName(0);
}
for (int i = 0; i < i_NumMusicChannels; i++)
{
for (int j = 0; j < midiEventCollection[i + 1].Count; j++)
{
if (midiEventCollection[i + 1][j].CommandCode == MidiCommandCode.PatchChange)
{
a_ChannelInstrumentNumbers[midiEventCollection[i + 1][j].Channel - 1] = ((PatchChangeEvent)midiEventCollection[i + 1][j]).Patch + 1;
a_ChannelInstrumentNames[midiEventCollection[i + 1][j].Channel - 1] = PatchChangeEvent.GetPatchName(a_ChannelInstrumentNumbers[midiEventCollection[i + 1][j].Channel - 1] - 1);
break;
}
}
}
}