private void ChangeButtonState(ButtonStateCollection sender, bool[] values, int index, bool newValue) { var oldValue = values[index]; values[index] = newValue; if (OnButtonChanged != null) { OnButtonChanged(sender, new ButtonEventArgs(sender.Category, index, oldValue, newValue)); } }
public NanoKontrol2(string midiDeviceName = "nanoKONTROL2") { Slider = new ControlStateCollection("Slider", _Slider); Knob = new ControlStateCollection("Knob", _Knob); Solo = new ButtonStateCollection(this, ButtonCategory.Solo, _Solo); Mute = new ButtonStateCollection(this, ButtonCategory.Mute, _Mute); Record = new ButtonStateCollection(this, ButtonCategory.Record, _Record); Input = MidiInputDevice.OpenByName(midiDeviceName); Output = MidiOutputDevice.OpenByName(midiDeviceName); Input.OnData += Input_OnData; }
private static void Nk2_OnButtonChanged(ButtonStateCollection sender, NanoKontrol2.ButtonEventArgs e) { Console.WriteLine("NK2 {0}[{1}] {2}", sender, e.Index, e.NewValue ? "+" : "-"); sender.LEDs[e.Index] = e.NewValue; }