/// <summary>Opens the device, setting up the handle for further operations.</summary> /// <param name="deviceID">The index of the device to open.</param> /// <param name="callback">The callback which will receive input events.</param> /// <returns>Whether opening the device succeeded.</returns> private bool OpenDevice(uint deviceID, MIDIInProc callback) { uint Result = midiInOpen(out IntPtr DeviceHandle, deviceID, Marshal.GetFunctionPointerForDelegate(callback), IntPtr.Zero, 0x00030000); LogError("open", Result); this.DeviceHandle = DeviceHandle; return(Result == 0); }
public WindowsMIDI(string name, Dictionary <string, object> config) { this.Callback = MIDICallback; this.CallbackHandle = GCHandle.Alloc(Callback); Configurer.Configure(this, config); }