internal unsafe PortReference(UnsafeStructs.jack_port_t *portPointer) { PortPointer = portPointer; FullName = PortApi.GetName(portPointer).PtrToString(); bool isPhysicalPort; Direction direction; ReadJackPortFlags(portPointer, out direction, out isPhysicalPort); Direction = direction; IsPhysicalPort = isPhysicalPort; PortType = GetPortType(portPointer); }
unsafe void AutoConnectPorts() { List <PortReference> ports = GetAllJackPorts().Where(p => p.IsPhysicalPort).ToList(); List <string> outlets = ports.Where(p => p.Direction == Direction.Out && p.PortType == PortType.Audio).Select(p => p.FullName).ToList(); List <string> inlets = _audioInPorts.Select(p => PortApi.GetName(p._port).PtrToString()).ToList(); ConnectPorts(outlets, inlets); outlets = _audioOutPorts.Select(p => PortApi.GetName(p._port).PtrToString()).ToList(); inlets = ports.Where(p => p.Direction == Direction.In && p.PortType == PortType.Audio).Select(p => p.FullName).ToList(); ConnectPorts(outlets, inlets); outlets = ports.Where(p => p.Direction == Direction.Out && p.PortType == PortType.Midi).Select(p => p.FullName).ToList(); inlets = _midiInPorts.Select(p => PortApi.GetName(p._port).PtrToString()).ToList(); ConnectPorts(outlets, inlets); outlets = _midiOutPorts.Select(p => PortApi.GetName(p._port).PtrToString()).ToList(); inlets = ports.Where(p => p.Direction == Direction.In && p.PortType == PortType.Midi).Select(p => p.FullName).ToList(); ConnectPorts(outlets, inlets); }