private IntPtr ReadDataPort(IntPtr self, IntPtr args) { var argTuple = new PyTuple(new PyObject(args, false)); var portName = argTuple.Get(0).GetString(); var dataPort = InputPorts.First(port => port.Name == portName) as NodeSystemLib2.FormatData1D.InputPortData1D; var buffer = dataPort.Read(); return(new PyArray(buffer.Data.Take(buffer.Available).ToArray(), false).Object.Handle); }
private IntPtr GetSamplerate(IntPtr self, IntPtr args) { var argTuple = new PyTuple(new PyObject(args, false)); var portName = argTuple.Get(0).GetString(); var dataPort = InputPorts.First(port => port.Name == portName) as NodeSystemLib2.FormatData1D.InputPortData1D; double samplerate = 0; if (dataPort != null) { samplerate = dataPort.Samplerate; } return(new PyFloat(samplerate, false).Handle); }
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); } } }