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); }
public void Dispose() { if (should_dispose) { dispatcher?.Dispose(); dispatcher = null; should_dispose = false; } }
public void Dispose() { if (list != IntPtr.Zero) { Marshal.FreeHGlobal(list); list = IntPtr.Zero; } if (should_dispose) { dispatcher = null; CoreMidiInterop.MIDIPortDispose(Handle); should_dispose = false; } }
public MidiPort(MIDIPortRef port, bool shouldDispose, ReadDispatcher dispatcher) { Handle = port; should_dispose = shouldDispose; this.dispatcher = dispatcher; }
public MidiEndpoint(MIDIEndpointRef endpoint, string endpointName, bool shouldDispose, ReadDispatcher dispatcher) { Handle = endpoint; should_dispose = shouldDispose; EndpointName = endpointName; this.dispatcher = dispatcher; }