Beispiel #1
0
        public MidiControlAdaptor CreateAdaptor(MidiControlType controlType, int controlId, Field field, FsConnection fsConnection)
        {
            var adaptor = new MidiControlAdaptor(controlType, controlId, field, fsConnection);

            controlAdaptors.Add(adaptor);
            adaptor.LightControl.Subscribe(HandleLightControl);
            return(adaptor);
        }
Beispiel #2
0
 public MidiDefinition(string midiNote, MidiControlType controlType, float minValue, float maxValue, EncoderMode encoderMode, int controlId)
     : base("DCDT")
 {
     MidiNote        = midiNote;
     MidiControlType = controlType;
     MinValue        = MinValue;
     MaxValue        = maxValue;
     EncoderMode     = encoderMode;
     ControlId       = controlId;
 }
Beispiel #3
0
 public MidiControlAdaptor(MidiControlType controlType, int controlId, Field field, FsConnection fsConnection)
 {
     ControlType  = controlType;
     ControlId    = controlId;
     Field        = field;
     FsConnection = fsConnection;
     UnitType     = FsConnection.FieldDefinition(field).UnitType;
     FsConnection.Subscribe(field).Subscribe(p => HandleValueChange(p));
     // TODO: Make sure the lights are initialised
 }
Beispiel #4
0
 public MidiSimControl(MidiControlType controlType, int controlId, Field field)
 {
     ControlType = controlType;
     ControlId   = controlId;
     Field       = field;
     // Set up a SimControlAdaptor
     // Get the initial value
     // Set up the lighting
     // Listen for changes to the value
     // Set up midi handling to update the value
 }
Beispiel #5
0
        private int MapControlToLedControlNumber(MidiControlType controlType, int controlId)
        {
            switch (controlType)
            {
            case MidiControlType.Encoder:
                return(controlId + 48);

            default:
                return(0);
            }
        }
Beispiel #6
0
        private ControlEventMap MapEventToControl(MidiEvent evt)
        {
            MidiControlType controlType = MidiControlType.Fader;
            int             controlId   = 0;

            if (evt.EventType == MidiEventType.PitchBend)
            {
                controlType = MidiControlType.Fader;
                controlId   = 0;
            }
            else if (evt.EventType == MidiEventType.ControlChange)
            {
                var cc = (ControlChangeEvent)evt;
                if (cc.ControlNumber <= 23 && cc.ControlNumber >= 16)
                {
                    controlType = MidiControlType.Encoder;
                    controlId   = cc.ControlNumber - 16;
                }
            }
            return(new ControlEventMap(controlType, controlId));
        }
 public AProprietaryMidiDefinition(string deviceTypeStr, MappingType type, string midiNote, MidiControlType controlType, float minValue, float maxValue, int controlId)
     : base(deviceTypeStr, type, new Format.MidiDefinition(midiNote, controlType, minValue, maxValue, EncoderMode.Proprietary, controlId))
 {
 }
Beispiel #8
0
 public ControlEventMap(MidiControlType midiControlType, int controlId)
 {
     MidiControlType = midiControlType;
     ControlId       = controlId;
 }