Ejemplo n.º 1
0
        public SwitchListData(SwitchMapping switchMapping)
        {
            Id             = switchMapping.Id;
            NormallyClosed = switchMapping.IsNormallyClosed;
            Description    = switchMapping.Description;
            Source         = switchMapping.Source;
            InputActionMap = switchMapping.InputActionMap;
            InputAction    = switchMapping.InputAction;
            Constant       = switchMapping.Constant;
            Device         = switchMapping.Device;
            if (string.IsNullOrEmpty(switchMapping.DeviceItem) && Device != null && Device.AvailableSwitches.Count() == 1)
            {
                DeviceItem = Device.AvailableSwitches.First().Id;
            }
            else
            {
                DeviceItem = switchMapping.DeviceItem;
            }

            PulseDelay = switchMapping.PulseDelay;

            SwitchMapping = switchMapping;
        }
Ejemplo n.º 2
0
        private void HandleMidiSourcePropertyChanged(object sender, PropertyChangedEventArgs e)
        {
            if (e.PropertyName == "HoldPedal")
            {
                if (ApplyHoldPedalToSustain)
                {
                    KillSustainedNotes();
                }
                if (SwitchSource.HasFlag(SwitchSources.HoldPedal))
                {
                    Switch = _midiSource.HoldPedal;
                }
            }

            if (e.PropertyName == "PitchBend")
            {
                _voices.Where(v => v.FromMidiNote != null).Execute(SetPitch);
            }
            else if (e.PropertyName == "Modulation")
            {
                ModulationAmount = _midiSource.Modulation;
            }

            if (e.PropertyName == "Portamento" && SwitchSource.HasFlag(SwitchSources.PortamentoSwitch))
            {
                Switch = _midiSource.Portamento;
            }
            else if (e.PropertyName == "SustenutoPedal" && SwitchSource.HasFlag(SwitchSources.SustenutoPedal))
            {
                Switch = _midiSource.SustenutoPedal;
            }
            else if (e.PropertyName == "SoftPedal" && SwitchSource.HasFlag(SwitchSources.SoftPedal))
            {
                Switch = _midiSource.SoftPedal;
            }
            else if (e.PropertyName == "Legato" && SwitchSource.HasFlag(SwitchSources.LegatoSwitch))
            {
                Switch = _midiSource.Legato;
            }

            float?newIntensity = null;

            if (e.PropertyName == "Pressure" && IntensitySource.HasFlag(ExpressionSources.ChannelPressure))
            {
                newIntensity = _midiSource.Pressure;
            }
            else if (e.PropertyName == "BreathController" && IntensitySource.HasFlag(ExpressionSources.BreathController))
            {
                newIntensity = _midiSource.BreathController;
            }
            else if (e.PropertyName == "FootPedal" && IntensitySource.HasFlag(ExpressionSources.FootPedal))
            {
                newIntensity = _midiSource.FootPedal;
            }
            else if (e.PropertyName == "Expression" && IntensitySource.HasFlag(ExpressionSources.Expression))
            {
                newIntensity = _midiSource.Expression;
            }

            if (newIntensity.HasValue)
            {
                _voices.Where(v => v.IsActive && v.FromMidiNote != null).Execute(v => v.Intensity = newIntensity.Value);
            }
        }
 public SwitchEventArgs(SwitchSource source)
 {
     Source = source;
 }