public VibranceProxy(bool isSilenced = false) { try { vibranceInfo = new VIBRANCE_INFO(); bool ret = initializeLibrary(); int[] gpuHandles = new int[NVAPI_MAX_PHYSICAL_GPUS]; enumeratePhsyicalGPUs(gpuHandles); vibranceInfo.activeOutput = getActiveOutputs(gpuHandles); StringBuilder buffer = new StringBuilder(64); char[] sz = new char[64]; getGpuName(gpuHandles, buffer); vibranceInfo.szGpuName = buffer.ToString(); vibranceInfo.defaultHandle = enumerateNvidiaDisplayHandle(); NV_DISPLAY_DVC_INFO info = new NV_DISPLAY_DVC_INFO(); if (getDVCInfo(ref info, vibranceInfo.defaultHandle)) { if (info.currentLevel != vibranceInfo.userVibranceSettingDefault) { setDVCLevel(vibranceInfo.defaultHandle, vibranceInfo.userVibranceSettingDefault); } } vibranceInfo.isInitialized = true; } catch (Exception) { MessageBox.Show(VibranceProxy.NVAPI_ERROR_INIT_FAILED); } }
public NvidiaVibranceProxy(bool isSilenced = false) { try { vibranceInfo = new VIBRANCE_INFO(); bool ret = initializeLibrary(); int[] gpuHandles = new int[NVAPI_MAX_PHYSICAL_GPUS]; int[] outputIds = new int[NVAPI_MAX_PHYSICAL_GPUS]; enumeratePhsyicalGPUs(gpuHandles); enumerateDisplayHandles(); vibranceInfo.activeOutput = getActiveOutputs(gpuHandles, outputIds); StringBuilder buffer = new StringBuilder(64); char[] sz = new char[64]; getGpuName(gpuHandles, buffer); vibranceInfo.szGpuName = buffer.ToString(); vibranceInfo.defaultHandle = enumerateNvidiaDisplayHandle(0); NV_DISPLAY_DVC_INFO info = new NV_DISPLAY_DVC_INFO(); if (getDVCInfo(ref info, vibranceInfo.defaultHandle)) { if (info.currentLevel != vibranceInfo.userVibranceSettingDefault) { setDVCLevel(vibranceInfo.defaultHandle, vibranceInfo.userVibranceSettingDefault); } } vibranceInfo.isInitialized = true; } catch (Exception) { MessageBox.Show(NvidiaVibranceProxy.NVAPI_ERROR_INIT_FAILED); } }