Ejemplo n.º 1
0
        private void BankPatchChanged(object tag, int index)
        {
            switch ((string)tag)
            {
            case "BANK_INST":
                MidiPlayerGlobal.MPTK_SelectBankInstrument(index);
                midiStreamPlayer.MPTK_PlayEvent(new MPTKEvent()
                {
                    Command = MPTKCommand.ControlChange, Controller = MPTKController.BankSelect, Value = index, Channel = StreamChannel,
                });
                break;

            case "PATCH_INST":
                CurrentPreset = index;
                if (testLocalchange)
                {
                    midiStreamPlayer.MPTK_ChannelPresetChange(StreamChannel, index);
                }
                else
                {
                    midiStreamPlayer.MPTK_PlayEvent(new MPTKEvent()
                    {
                        Command = MPTKCommand.PatchChange, Value = index, Channel = StreamChannel,
                    });
                }
                break;

            case "BANK_DRUM":
                MidiPlayerGlobal.MPTK_SelectBankDrum(index);
                midiStreamPlayer.MPTK_PlayEvent(new MPTKEvent()
                {
                    Command = MPTKCommand.ControlChange, Controller = MPTKController.BankSelect, Value = index, Channel = 9,
                });
                break;

            case "PATCH_DRUM":
                CurrentPatchDrum = index;
                if (testLocalchange)
                {
                    midiStreamPlayer.MPTK_ChannelPresetChange(9, index);
                }
                else
                {
                    midiStreamPlayer.MPTK_PlayEvent(new MPTKEvent()
                    {
                        Command = MPTKCommand.PatchChange, Value = index, Channel = 9
                    });
                }
                break;
            }
        }