/// <inheritdoc /> public void ResetDevices() { foreach (IRGBDevice device in Devices) { NovationLaunchpadRGBDevice novationDevice = device as NovationLaunchpadRGBDevice; novationDevice?.Reset(); } }
/// <inheritdoc /> public bool Initialize(RGBDeviceType loadFilter = RGBDeviceType.All, bool exclusiveAccessIfPossible = false, bool throwExceptions = false) { IsInitialized = false; try { UpdateTrigger?.Stop(); IList <IRGBDevice> devices = new List <IRGBDevice>(); if (loadFilter.HasFlag(RGBDeviceType.LedMatrix)) { for (int index = 0; index < OutputDeviceBase.DeviceCount; index++) { try { MidiOutCaps outCaps = OutputDeviceBase.GetDeviceCapabilities(index); if (outCaps.name == null) { continue; } NovationDevices?deviceId = (NovationDevices?)Enum.GetValues(typeof(NovationDevices)) .Cast <Enum>() .FirstOrDefault(x => string.Equals(x.GetDeviceId(), outCaps.name, StringComparison.OrdinalIgnoreCase)); if (deviceId == null) { continue; } INovationRGBDevice device = new NovationLaunchpadRGBDevice(new NovationLaunchpadRGBDeviceInfo(outCaps.name, index, deviceId.GetColorCapability())); device.Initialize(UpdateTrigger); devices.Add(device); } catch { if (throwExceptions) { throw; } } } } UpdateTrigger?.Start(); Devices = new ReadOnlyCollection <IRGBDevice>(devices); IsInitialized = true; } catch { if (throwExceptions) { throw; } return(false); } return(true); }