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 MidiPort CreateOutputPort(string name) { MIDIPortRef port; CoreMidiInterop.MIDIOutputPortCreate(Handle, Midi.ToCFStringRef(name), out port); return(new MidiPort(port, true)); }
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; }