Exemplo n.º 1
0
        public void RemoveAllInputPortsFromNode(List <string> without = null)
        {
            if (without == null)
            {
                while (InputPorts.Any())
                {
                    RemoveInputPortFromNode(InputPorts.First());
                }
            }
            else
            {
                var filteredPorts = InputPorts.Where(port => !without.Contains(port.Name)).ToList();

                foreach (var port in filteredPorts)
                {
                    RemoveInputPortFromNode(port);
                }
            }
        }
Exemplo n.º 2
0
        public void AddInput(InputPort port, int index = -1)
        {
            if (InputPorts.Any(i => i.Name == port.Name))
            {
                throw new ArgumentException("Name of port ambiguous");
            }

            port.InputConnectionChanged += Input_InputConnectionChanged;

            // TODO: cleanup? Cause scheduler does DataAvailable and ValueAvailable now
            switch (port.DataType)
            {
            case PortDataType.Array:
                ((DataInputPort)port).DataAvailable     += Input_DataAvailable;
                ((DataInputPort)port).SamplerateChanged += Input_SamplerateChanged;
                break;

            case PortDataType.FFT:
                ((FFTInputPort)port).DataAvailable     += Input_DataAvailable;
                ((FFTInputPort)port).SamplerateChanged += Input_SamplerateChanged;
                ((FFTInputPort)port).FFTSizeChanged    += Input_FFTSizeChanged;
                break;

            case PortDataType.Value:
                ((ValueInputPort)port).ValueAvailable += Node_ValueAvailable;
                _valueInputs.Add((ValueInputPort)port);
                break;
            }

            port.Parent = this;
            if (index > -1)
            {
                _inputs.Insert(index, port);
            }
            else
            {
                _inputs.Add(port);
            }
            PortAdded?.Invoke(this, new PortChangedEventArgs {
                Port = port, Index = index
            });
        }