static void NoteOff(MidiChannel channel, int note) { Pads.All.ForEach(pad => { if (note != pad.number) { return; } pad.pressure = 0.0f; if (padReleasedDelegate != null) { padReleasedDelegate(pad); } }); RotaryEncoders.All.ForEach(encoder => { if (note != encoder.touch.number) { return; } RotaryEncoder e = encoder.Clone(); e.touch.touched = false; if (encoderReleasedDelegate != null) { encoderReleasedDelegate(e); } }); }
public static RotaryEncoder GetEncoder(RotaryEncoder encoder) { RotaryEncoder e = encoder.Clone(); e.step = PolarEncoderValue(MidiMaster.GetKnob(encoder.number)); return(e); }
public new RotaryEncoder Clone() { RotaryEncoder rotaryEncoder = new RotaryEncoder(); rotaryEncoder.name = this.name; rotaryEncoder.number = this.number; rotaryEncoder.message = this.message; rotaryEncoder.color = this.color; rotaryEncoder.step = this.step; rotaryEncoder.position = this.position; rotaryEncoder.touch = this.touch; return(rotaryEncoder); }
static void NoteOn(MidiChannel channel, int note, float velocity) { Pads.All.ForEach(pad => { if (note != pad.number) { return; } Pad p = pad.Clone(); p.pressure = velocity; if (padPressedDelegate != null) { padPressedDelegate(p, velocity); } }); RotaryEncoders.All.ForEach(encoder => { if (note != encoder.touch.number) { return; } RotaryEncoder e = encoder.Clone(); e.touch.touched = true; if (encoderTouchedDelegate != null) { encoderTouchedDelegate(e); } }); if (note == _TouchStrip.touchStrip.number) { TouchStrip t = _TouchStrip.touchStrip.Clone(); if (velocity == 1.0f) { t.touched = true; if (touchStripTouchedDelegate != null) { touchStripTouchedDelegate(t); } } else if (velocity == 0.0f) { t.touched = false; if (touchStripReleasedDelegate != null) { touchStripReleasedDelegate(t); } } } }
static void Knob(MidiChannel channel, int knobNumber, float knobValue) { Buttons.All.ForEach(button => { if (button.number != knobNumber) { return; } Button b = button.Clone(); if (knobValue == 1.0f) { if (buttonPressedDelegate != null) { buttonPressedDelegate(b); } } else if (knobValue == 0.0f) { if (buttonReleasedDelegate != null) { buttonReleasedDelegate(b); } } }); RotaryEncoders.All.ForEach(encoder => { if (encoder.number != knobNumber) { return; } RotaryEncoder e = encoder.Clone(); e.step = PolarEncoderValue(knobValue); if (encoderDelegate != null) { encoderDelegate(e, e.step); } }); }
public static bool GetEncoderTouched(RotaryEncoder encoder) { return(MidiMaster.GetKey(encoder.touch.number) == 1.0f); }
public static float GetEncoderStep(RotaryEncoder encoder) { return(PolarEncoderValue(MidiMaster.GetKnob(encoder.number))); }