Example #1
0
        public bool Apply(MidiEvent inEvent, EventRuleArgs args)
        {
            bool match = false;

            if ((inEvent.CommandCode == MidiCommandCode.ChannelAfterTouch) &&
                (type == AfterTouchType.Channel))
            {
                if (inChannels.IsValueIncluded(inEvent.Channel))
                {
                    ChannelAfterTouchEvent afterTouchEvent = (ChannelAfterTouchEvent)inEvent;
                    afterTouchEvent.Channel            = outChannel.ProcessValue(inEvent.Channel);
                    afterTouchEvent.AfterTouchPressure = outValue.ProcessValue(afterTouchEvent.AfterTouchPressure);
                    match = true;
                }
            }
            else if ((inEvent.CommandCode == MidiCommandCode.KeyAfterTouch) && (type == AfterTouchType.Key))
            {
                if (inChannels.IsValueIncluded(inEvent.Channel))
                {
                    NoteEvent afterTouchEvent = (NoteEvent)inEvent;
                    afterTouchEvent.Channel  = outChannel.ProcessValue(inEvent.Channel);
                    afterTouchEvent.Velocity = outValue.ProcessValue(afterTouchEvent.Velocity);
                    match = true;
                }
            }

            return(match);
        }
Example #2
0
        public bool Apply(MidiEvent inEvent, EventRuleArgs args)
        {
            bool match = false;

            if (inEvent.CommandCode == MidiCommandCode.PitchWheelChange)
            {
                PitchWheelChangeEvent pitchWheelEvent = (PitchWheelChangeEvent)inEvent;
                if (inChannels.IsValueIncluded(pitchWheelEvent.Channel))
                {
                    pitchWheelEvent.Pitch   = outValue.ProcessValue(pitchWheelEvent.Pitch);
                    pitchWheelEvent.Channel = outChannel.ProcessValue(pitchWheelEvent.Channel);
                    match = true;
                }
            }
            return(match);
        }
Example #3
0
        public bool Apply(MidiEvent inEvent, EventRuleArgs args)
        {
            bool match = false;

            if (inEvent.CommandCode == MidiCommandCode.ControlChange)
            {
                ControlChangeEvent controlEvent = (ControlChangeEvent)inEvent;
                if (inControllers.IsValueIncluded((int)controlEvent.Controller) &&
                    inChannels.IsValueIncluded(controlEvent.Channel) &&
                    inValues.IsValueIncluded(controlEvent.ControllerValue))
                {
                    controlEvent.ControllerValue = outValue.ProcessValue(controlEvent.ControllerValue);
                    controlEvent.Controller      = (MidiController)outController.ProcessValue((int)controlEvent.Controller);
                    controlEvent.Channel         = outChannel.ProcessValue(controlEvent.Channel);
                    match = true;
                }
            }
            return(match);
        }
Example #4
0
        public bool Apply(MidiEvent inEvent, EventRuleArgs args)
        {
            bool        match       = false;
            NoteOnEvent noteOnEvent = inEvent as NoteOnEvent;

            if (noteOnEvent != null && noteOnEvent.Velocity > 0)
            {
                if (inChannels.IsValueIncluded(inEvent.Channel) &&
                    inNotes.IsValueIncluded(noteOnEvent.NoteNumber) &&
                    inVelocity.IsValueIncluded(noteOnEvent.Velocity)
                    )
                {
                    noteOnEvent.Channel    = outChannel.ProcessValue(noteOnEvent.Channel);
                    noteOnEvent.Velocity   = outVelocity.ProcessValue(noteOnEvent.Velocity);
                    noteOnEvent.NoteNumber = outNote.ProcessValue(noteOnEvent.NoteNumber);
                    //noteOnEvent.AbsoluteTime = outStartTime.ProcessValue(noteOnEvent.AbsoluteTime);
                    noteOnEvent.NoteLength = outDuration.ProcessValue(noteOnEvent.NoteLength);
                    match = true;
                }
            }

            return(match);
        }