private void ChangeValue(ControlStateCollection sender, MidiValue[] values, int index, byte newValue) { var oldValue = values[index]; var _newValue = new MidiValue(newValue); values[index] = _newValue; if (OnControlChanged != null) { OnControlChanged(sender, new ControlEventArgs(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_OnChanged(ControlStateCollection sender, NanoKontrol2.ControlEventArgs e) { Console.WriteLine("NK2 {0}[{1}] = {2}", sender, e.Index, e.NewValue); }