コード例 #1
0
        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);
        }
コード例 #2
0
        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);
        }
コード例 #3
0
 public void Dispose()
 {
     if (should_dispose)
     {
         dispatcher?.Dispose();
         dispatcher     = null;
         should_dispose = false;
     }
 }
コード例 #4
0
        public void Dispose()
        {
            if (list != IntPtr.Zero)
            {
                Marshal.FreeHGlobal(list);
                list = IntPtr.Zero;
            }

            if (should_dispose)
            {
                dispatcher = null;
                CoreMidiInterop.MIDIPortDispose(Handle);
                should_dispose = false;
            }
        }
コード例 #5
0
 public MidiPort(MIDIPortRef port, bool shouldDispose, ReadDispatcher dispatcher)
 {
     Handle          = port;
     should_dispose  = shouldDispose;
     this.dispatcher = dispatcher;
 }
コード例 #6
0
 public MidiEndpoint(MIDIEndpointRef endpoint, string endpointName, bool shouldDispose, ReadDispatcher dispatcher)
 {
     Handle          = endpoint;
     should_dispose  = shouldDispose;
     EndpointName    = endpointName;
     this.dispatcher = dispatcher;
 }