public static MIDIError MIDI_InOpen(ref IntPtr handle, int deviceID, MIDIINPROC proc, IntPtr user, MIDIFlags flags) { if (proc == null) { flags = MIDIFlags.MIDI_CALLBACK_NULL; } else { flags |= MIDIFlags.MIDI_CALLBACK_FUNCTION; } return(Midi.midiInOpen(ref handle, new IntPtr(deviceID), proc, user, flags)); }