public AlsaPortInfo Clone() { var ret = new AlsaPortInfo(); Natives.snd_seq_port_info_copy(ret.Handle, Handle); return(ret); }
// app generates messages --> [RETURNED PORT] --> [output device port] public AlsaPortInfo CreateOutputConnectedPort(AlsaPortInfo pinfo, string portName = "alsa-sharp output") { var portId = output.CreateSimplePort(portName, output_connected_cap, midi_port_type); var sub = new AlsaPortSubscription(); sub.Sender.Client = (byte)output_client_id; sub.Sender.Port = (byte)portId; sub.Destination.Client = (byte)pinfo.Client; sub.Destination.Port = (byte)pinfo.Port; output.SubscribePort(sub); return(output.GetPort(sub.Sender.Client, sub.Sender.Port)); }
IEnumerable <AlsaPortInfo> EnumerateMatchingPorts(AlsaSequencer seq, AlsaPortCapabilities cap) { var cinfo = new AlsaClientInfo { Client = -1 }; while (seq.QueryNextClient(cinfo)) { var pinfo = new AlsaPortInfo { Client = cinfo.Client, Port = -1 }; while (seq.QueryNextPort(pinfo)) { if ((pinfo.PortType & midi_port_type) != 0 && (pinfo.Capabilities & cap) == cap) { yield return(pinfo.Clone()); } } } }