Exemple #1
0
        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);
        }
Exemple #2
0
        public MidiPort CreateOutputPort(string name)
        {
            MIDIPortRef port;

            CoreMidiInterop.MIDIOutputPortCreate(Handle, Midi.ToCFStringRef(name), out port);
            return(new MidiPort(port, true));
        }
Exemple #3
0
        public MidiClient(string name)
        {
            IntPtr h;

            name_string = Midi.ToCFStringRef(name);
            CoreMidiInterop.MIDIClientCreate(name_string, OnNotify, IntPtr.Zero, out h);
            Handle = h;
        }
Exemple #4
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);
        }
Exemple #5
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);
        }
Exemple #6
0
        void SetStringProp(IntPtr id, string value)
        {
            if (id == IntPtr.Zero)
            {
                return;
            }
            CFStringRef str;

            CoreMidiInterop.MIDIObjectSetStringProperty(Handle, id, Midi.ToCFStringRef(value));
        }
Exemple #7
0
        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;
        }