internal static void noteMess(int note, bool onoff) // Sends a NoteOn message to the MIDI device { if (ControlSender == false) { if (HardwareSetup.BCF2000_i != null) { ChannelMessageBuilder builder = new ChannelMessageBuilder(); // build MIDI Message builder.MidiChannel = 0; // Always channel 0 builder.Command = ChannelCommand.NoteOn; // NoteOn message for buttons builder.Data1 = note; // Note number if (onoff) { builder.Data2 = 100; // send 100 if true } else { builder.Data2 = 0; } builder.Build(); try { BCF2000_o.Send(builder.Result); } catch (Exception ex) { System.Diagnostics.Debug.WriteLine("Failed to send MIDI Message" + ex.Message); if (inForm != null) { inForm.ChangeStatusText(ex); } } } } if (FormSender == false) { if (inForm != null) { inForm.setButton(note, onoff); } } }
public static void setY(int index, bool val) // Set the value of a button { Button[index] = val; if (!HardwareSetup.FormSender && !HardwareSetup.ControlSender && HardwareSetup.BCF2000_i != null) { HardwareSetup.noteMess(index, val); if (inForm != null) { inForm.setButton(index, val); } } }