public MidiPort CreateOutputPort(string name) { MIDIPortRef port; CoreMidiInterop.MIDIOutputPortCreate(Handle, Midi.ToCFStringRef(name), out port); return(new MidiPort(port, true)); }
public MidiEndpoint CreateVirtualSource(string name, out MidiError statusCode) { IntPtr ptr; statusCode = (MidiError)CoreMidiInterop.MIDISourceCreate(Handle, Midi.ToCFStringRef(name), out ptr); return(statusCode == MidiError.Ok ? new MidiEndpoint(ptr, name, true, null) : null); }
public Task <IMidiDevice> OpenDevice(string id) { var devices = GetDevices().ToArray(); var device = devices.First(i => i.Id == id); return(Task.FromResult((IMidiDevice) new IOSMidiDevice(this, CMidi.GetDevice(Array.IndexOf(devices, device)), device))); }
public MidiClient(string name) { IntPtr h; name_string = Midi.ToCFStringRef(name); CoreMidiInterop.MIDIClientCreate(name_string, OnNotify, IntPtr.Zero, out h); Handle = h; }
public MidiPort CreateInputPort(string name) { MIDIPortRef port; var d = new ReadDispatcher(); CoreMidiInterop.MIDIInputPortCreate(Handle, Midi.ToCFStringRef(name), d.DispatchRead, IntPtr.Zero, out port); d.Port = new MidiPort(port, true); return(d.Port); }
public MidiEndpoint CreateVirtualDestination(string name, out MidiError statusCode) { IntPtr ptr; var d = new ReadDispatcher(); statusCode = (MidiError)CoreMidiInterop.MIDIDestinationCreate(Handle, Midi.ToCFStringRef(name), d.DispatchProc, IntPtr.Zero, out ptr); return(statusCode == MidiError.Ok ? new MidiEndpoint(ptr, name, true, d) : null); }
void SetStringProp(IntPtr id, string value) { if (id == IntPtr.Zero) { return; } CFStringRef str; CoreMidiInterop.MIDIObjectSetStringProperty(Handle, id, Midi.ToCFStringRef(value)); }
public MidiClient(string name) { IntPtr h; name_string = Midi.ToCFStringRef(name); int ret = CoreMidiInterop.MIDIClientCreate(name_string, null, IntPtr.Zero, out h); if (ret != 0) { throw new MidiException($"Failed to create MIDI client for {name}: error code {ret}"); } Handle = h; }
IEnumerable <MidiEntity> EnumerateMidiEntities() { var dcount = MIDI.DeviceCount; for (nint d = 0; d < dcount; d++) { var dev = MIDI.GetDevice(d); var ecount = dev.EntityCount; for (nint e = 0; e < ecount; e++) { yield return(dev.GetEntity(e)); } } }
public IEnumerable <MidiDeviceDetails> GetDevices() { return(Enumerable.Range(0, (int)CMidi.DeviceCount).Select(i => CreateMidiDeviceDetails(CMidi.GetDevice(i)))); }