/// <summary>Gets connected MIDI input devices</summary> /// <returns>Array of MidiInCapabilities</returns> public static MidiInCapabilities[] GetMidiInDevices() { var devices = new MidiInCapabilities[MidiIn.NumberOfDevices]; for (var device = 0; device < MidiIn.NumberOfDevices; device++) { devices[device] = MidiIn.DeviceInfo(device); } return(devices); }
public static List <MidiWithIndex> GetDevices() { List <MidiWithIndex> devices = new List <MidiWithIndex>(); for (int index = 0; index < MidiIn.NumberOfDevices; index++) { MidiInCapabilities x = MidiIn.DeviceInfo(index); devices.Add(new MidiWithIndex(x, index)); } return(devices); }
public MidiInViewModel(int deviceNo) { this.deviceNo = deviceNo; device = new MidiIn(deviceNo); capabilities = MidiIn.DeviceInfo(deviceNo); subscribers = new List <Subscriber>(); device.MessageReceived += Device_MessageReceived; device.ErrorReceived += Device_ErrorReceived; device.Start(); }
//TODO: error handling public void GetDevice(int deviceID, Action <MidiInCapabilities, Exception> callback) { MidiInCapabilities cap = new MidiInCapabilities(); if (MidiIn.NumberOfDevices > 0) { cap = MidiIn.DeviceInfo(deviceID); callback(cap, null); } else { MidiInCapabilities nullCap = new MidiInCapabilities(); callback(nullCap, new MidiDeviceServiceException("No Midi Devices Found")); } }
private static extern void midiInGetDevCaps(UIntPtr uDeviceId, out MidiInCapabilities caps, uint cbMidiInCaps);
public MidiWithIndex(MidiInCapabilities device, int index) { Device = device; Index = index; }
public static void MidiInGetDevCaps(UIntPtr uDeviceId, out MidiInCapabilities caps) => midiInGetDevCaps(uDeviceId, out caps, (uint)Marshal.SizeOf(typeof(MidiInCapabilities)));
public static extern int midiInGetDevCaps(int uDeviceID, out MidiInCapabilities lpCaps, int cbMidiInCaps);