예제 #1
0
        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);
                }
            });
        }
예제 #2
0
        public static RotaryEncoder GetEncoder(RotaryEncoder encoder)
        {
            RotaryEncoder e = encoder.Clone();

            e.step = PolarEncoderValue(MidiMaster.GetKnob(encoder.number));
            return(e);
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
                    }
                }
            }
        }
예제 #5
0
        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);
                }
            });
        }
예제 #6
0
 public static bool GetEncoderTouched(RotaryEncoder encoder)
 {
     return(MidiMaster.GetKey(encoder.touch.number) == 1.0f);
 }
예제 #7
0
 public static float GetEncoderStep(RotaryEncoder encoder)
 {
     return(PolarEncoderValue(MidiMaster.GetKnob(encoder.number)));
 }