/// <summary> /// Set Midi instrument for all channels /// </summary> /// <param name="instrument"></param> public void SetInstrument(MyMidi.Instrument instrument) { try { foreach (var c in Enum.GetValues(typeof(MyMidi.Channel))) { //outputDevice.SendProgramChange((Midi.Channel)c, instrument); // Change the patch while playing int nChannel = (int)c; int p = (int)instrument; int v = 0; ChannelMessageBuilder builder = new ChannelMessageBuilder() { Command = ChannelCommand.ProgramChange, MidiChannel = nChannel, Data1 = p, Data2 = v, }; builder.Build(); outDevice.Send(builder.Result); } } catch (Exception ex) { Console.WriteLine(ex.Message); } }
public void SetInstrument(MyMidi.Instrument instrument) { midi.SetInstrument(instrument); }