new Dictionary<DisplayDevice, string>(); // Needed for ChangeDisplaySettingsEx #region --- Constructors --- /// <summary>Queries available display devices and display resolutions.</summary> static WinDisplayDeviceDriver() { lock (display_lock) { // To minimize the need to add static methods to OpenTK.Graphics.DisplayDevice // we only allow settings to be set through its constructor. // Thus, we save all necessary parameters in temporary variables // and construct the device when every needed detail is available. // The main DisplayDevice constructor adds the newly constructed device // to the list of available devices. DisplayDevice opentk_dev; DisplayResolution opentk_dev_current_res = null; List<DisplayResolution> opentk_dev_available_res = new List<DisplayResolution>(); bool opentk_dev_primary = false; int device_count = 0, mode_count = 0; // Get available video adapters and enumerate all monitors WindowsDisplayDevice dev1 = new WindowsDisplayDevice(), dev2 = new WindowsDisplayDevice(); while (Functions.EnumDisplayDevices(null, device_count++, dev1, 0)) { if ((dev1.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) == DisplayDeviceStateFlags.None) continue; DeviceMode monitor_mode = new DeviceMode(); // The second function should only be executed when the first one fails // (e.g. when the monitor is disabled) if (Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.CurrentSettings, monitor_mode, 0) || Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.RegistrySettings, monitor_mode, 0)) { opentk_dev_current_res = new DisplayResolution( monitor_mode.Position.X, monitor_mode.Position.Y, monitor_mode.PelsWidth, monitor_mode.PelsHeight, monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency); opentk_dev_primary = (dev1.StateFlags & DisplayDeviceStateFlags.PrimaryDevice) != DisplayDeviceStateFlags.None; } opentk_dev_available_res.Clear(); mode_count = 0; while (Functions.EnumDisplaySettings(dev1.DeviceName.ToString(), mode_count++, monitor_mode)) { DisplayResolution res = new DisplayResolution( monitor_mode.Position.X, monitor_mode.Position.Y, monitor_mode.PelsWidth, monitor_mode.PelsHeight, monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency); opentk_dev_available_res.Add(res); } // Construct the OpenTK DisplayDevice through the accumulated parameters. // The constructor will automatically add the DisplayDevice to the list // of available devices. opentk_dev = new DisplayDevice( opentk_dev_current_res, opentk_dev_primary, opentk_dev_available_res, opentk_dev_current_res.Bounds); available_device_names.Add(opentk_dev, dev1.DeviceName); } } }
public sealed override bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution) { DeviceMode mode = null; if (resolution != null) { mode = new DeviceMode(); mode.PelsWidth = resolution.Width; mode.PelsHeight = resolution.Height; mode.BitsPerPel = resolution.BitsPerPixel; mode.DisplayFrequency = (int)resolution.RefreshRate; mode.Fields = Constants.DM_BITSPERPEL | Constants.DM_PELSWIDTH | Constants.DM_PELSHEIGHT | Constants.DM_DISPLAYFREQUENCY; } return Constants.DISP_CHANGE_SUCCESSFUL == Functions.ChangeDisplaySettingsEx((string)device.Id, mode, IntPtr.Zero, ChangeDisplaySettingsEnum.Fullscreen, IntPtr.Zero); }
public void RefreshDisplayDevices() { lock (this.display_lock) { this.AvailableDevices.Clear(); DisplayResolution local_1 = (DisplayResolution) null; List<DisplayResolution> local_2 = new List<DisplayResolution>(); bool local_3 = false; int local_4 = 0; WindowsDisplayDevice local_6 = new WindowsDisplayDevice(); WindowsDisplayDevice temp_10 = new WindowsDisplayDevice(); while (Functions.EnumDisplayDevices((string) null, local_4++, local_6, 0)) { if ((local_6.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) != DisplayDeviceStateFlags.None) { DeviceMode local_7 = new DeviceMode(); if (Functions.EnumDisplaySettingsEx(((object) local_6.DeviceName).ToString(), DisplayModeSettingsEnum.CurrentSettings, local_7, 0) || Functions.EnumDisplaySettingsEx(((object) local_6.DeviceName).ToString(), DisplayModeSettingsEnum.RegistrySettings, local_7, 0)) { local_1 = new DisplayResolution(local_7.Position.X, local_7.Position.Y, local_7.PelsWidth, local_7.PelsHeight, local_7.BitsPerPel, (float) local_7.DisplayFrequency); local_3 = (local_6.StateFlags & DisplayDeviceStateFlags.PrimaryDevice) != DisplayDeviceStateFlags.None; } local_2.Clear(); int local_5_1 = 0; while (Functions.EnumDisplaySettings(((object) local_6.DeviceName).ToString(), local_5_1++, local_7)) { DisplayResolution local_8 = new DisplayResolution(local_7.Position.X, local_7.Position.Y, local_7.PelsWidth, local_7.PelsHeight, local_7.BitsPerPel, (float) local_7.DisplayFrequency); local_2.Add(local_8); } DisplayDevice local_0 = new DisplayDevice(local_1, local_3, (IEnumerable<DisplayResolution>) local_2, local_1.Bounds, (object) local_6.DeviceName); this.AvailableDevices.Add(local_0); if (local_3) this.Primary = local_0; } } } }
public void RefreshDisplayDevices() { lock (display_lock) { // Store an array of the current available DisplayDevice objects. // This is needed to preserve the original resolution. DisplayDevice[] previousDevices = AvailableDevices.ToArray(); AvailableDevices.Clear(); // We save all necessary parameters in temporary variables // and construct the device when every needed detail is available. // The main DisplayDevice constructor adds the newly constructed device // to the list of available devices. DisplayDevice opentk_dev; DisplayResolution opentk_dev_current_res = null; List<DisplayResolution> opentk_dev_available_res = new List<DisplayResolution>(); bool opentk_dev_primary = false; int device_count = 0, mode_count = 0; // Get available video adapters and enumerate all monitors WindowsDisplayDevice dev1 = new WindowsDisplayDevice(); while (Functions.EnumDisplayDevices(null, device_count++, dev1, 0)) { if ((dev1.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) == DisplayDeviceStateFlags.None) continue; DeviceMode monitor_mode = new DeviceMode(); // The second function should only be executed when the first one fails // (e.g. when the monitor is disabled) if (Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.CurrentSettings, monitor_mode, 0) || Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.RegistrySettings, monitor_mode, 0)) { VerifyMode(dev1, monitor_mode); float scale = GetScale(ref monitor_mode); opentk_dev_current_res = new DisplayResolution( (int)(monitor_mode.Position.X / scale), (int)(monitor_mode.Position.Y / scale), (int)(monitor_mode.PelsWidth / scale), (int)(monitor_mode.PelsHeight / scale), monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency); opentk_dev_primary = (dev1.StateFlags & DisplayDeviceStateFlags.PrimaryDevice) != DisplayDeviceStateFlags.None; } opentk_dev_available_res.Clear(); mode_count = 0; while (Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), mode_count++, monitor_mode, 0)) { VerifyMode(dev1, monitor_mode); float scale = GetScale(ref monitor_mode); DisplayResolution res = new DisplayResolution( (int)(monitor_mode.Position.X / scale), (int)(monitor_mode.Position.Y / scale), (int)(monitor_mode.PelsWidth / scale), (int)(monitor_mode.PelsHeight / scale), monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency); opentk_dev_available_res.Add(res); } // Construct the OpenTK DisplayDevice through the accumulated parameters. // The constructor will automatically add the DisplayDevice to the list // of available devices. #pragma warning disable 612,618 opentk_dev = new DisplayDevice( opentk_dev_current_res, opentk_dev_primary, opentk_dev_available_res, opentk_dev_current_res.Bounds, dev1.DeviceName); #pragma warning restore 612,618 // Set the original resolution if the DisplayDevice was previously available. foreach (DisplayDevice existingDevice in previousDevices) if ((string)existingDevice.Id == (string)opentk_dev.Id) opentk_dev.OriginalResolution = existingDevice.OriginalResolution; AvailableDevices.Add(opentk_dev); if (opentk_dev_primary) Primary = opentk_dev; Debug.Print("DisplayDevice {0} ({1}) supports {2} resolutions.", device_count, opentk_dev.IsPrimary ? "primary" : "secondary", opentk_dev.AvailableResolutions.Count); } } }
static void VerifyMode(WindowsDisplayDevice device, DeviceMode mode) { if (mode.BitsPerPel == 0) { Debug.Print( "[Warning] DisplayDevice '{0}' reported a mode with 0 bpp. Please create a bug report at http://www.opentk.com", device.DeviceName.ToString()); mode.BitsPerPel = 32; } }
private float GetScale(ref DeviceMode monitor_mode) { float scale = 1.0f; if ((monitor_mode.Fields & Constants.DM_LOGPIXELS) != 0) { scale = monitor_mode.LogPixels / 96.0f; } return scale; }
public void RefreshDisplayDevices() { lock (display_lock) { // Store an array of the current available DisplayDevice objects. // This is needed to preserve the original resolution. DisplayDevice[] previousDevices = AvailableDevices.ToArray(); AvailableDevices.Clear(); // We save all necessary parameters in temporary variables // and construct the device when every needed detail is available. // The main DisplayDevice constructor adds the newly constructed device // to the list of available devices. DisplayDevice opentk_dev; DisplayResolution opentk_dev_current_res = null; List <DisplayResolution> opentk_dev_available_res = new List <DisplayResolution>(); bool opentk_dev_primary = false; int device_count = 0, mode_count = 0; // Get available video adapters and enumerate all monitors WindowsDisplayDevice dev1 = new WindowsDisplayDevice(); while (Functions.EnumDisplayDevices(null, device_count++, dev1, 0)) { if ((dev1.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) == DisplayDeviceStateFlags.None) { continue; } DeviceMode monitor_mode = new DeviceMode(); // The second function should only be executed when the first one fails // (e.g. when the monitor is disabled) if (Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.CurrentSettings, monitor_mode, 0) || Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.RegistrySettings, monitor_mode, 0)) { VerifyMode(dev1, monitor_mode); float scale = GetScale(ref monitor_mode); opentk_dev_current_res = new DisplayResolution( (int)(monitor_mode.Position.X / scale), (int)(monitor_mode.Position.Y / scale), (int)(monitor_mode.PelsWidth / scale), (int)(monitor_mode.PelsHeight / scale), monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency); opentk_dev_primary = (dev1.StateFlags & DisplayDeviceStateFlags.PrimaryDevice) != DisplayDeviceStateFlags.None; } opentk_dev_available_res.Clear(); mode_count = 0; while (Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), mode_count++, monitor_mode, 0)) { VerifyMode(dev1, monitor_mode); float scale = GetScale(ref monitor_mode); DisplayResolution res = new DisplayResolution( (int)(monitor_mode.Position.X / scale), (int)(monitor_mode.Position.Y / scale), (int)(monitor_mode.PelsWidth / scale), (int)(monitor_mode.PelsHeight / scale), monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency); opentk_dev_available_res.Add(res); } // Construct the OpenTK DisplayDevice through the accumulated parameters. // The constructor will automatically add the DisplayDevice to the list // of available devices. #pragma warning disable 612,618 opentk_dev = new DisplayDevice( opentk_dev_current_res, opentk_dev_primary, opentk_dev_available_res, opentk_dev_current_res.Bounds, dev1.DeviceName); #pragma warning restore 612,618 // Set the original resolution if the DisplayDevice was previously available. foreach (DisplayDevice existingDevice in previousDevices) { if ((string)existingDevice.Id == (string)opentk_dev.Id) { opentk_dev.OriginalResolution = existingDevice.OriginalResolution; } } AvailableDevices.Add(opentk_dev); if (opentk_dev_primary) { Primary = opentk_dev; } Debug.Print("DisplayDevice {0} ({1}) supports {2} resolutions.", device_count, opentk_dev.IsPrimary ? "primary" : "secondary", opentk_dev.AvailableResolutions.Count); } } }
public void RefreshDisplayDevices() { lock (display_lock) { AvailableDevices.Clear(); // We save all necessary parameters in temporary variables // and construct the device when every needed detail is available. // The main DisplayDevice constructor adds the newly constructed device // to the list of available devices. DisplayDevice opentk_dev; DisplayResolution opentk_dev_current_res = null; List<DisplayResolution> opentk_dev_available_res = new List<DisplayResolution>(); bool opentk_dev_primary = false; int device_count = 0, mode_count = 0; // Get available video adapters and enumerate all monitors WindowsDisplayDevice dev1 = new WindowsDisplayDevice(), dev2 = new WindowsDisplayDevice(); while (Functions.EnumDisplayDevices(null, device_count++, dev1, 0)) { if ((dev1.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) == DisplayDeviceStateFlags.None) continue; DeviceMode monitor_mode = new DeviceMode(); // The second function should only be executed when the first one fails // (e.g. when the monitor is disabled) if (Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.CurrentSettings, monitor_mode, 0) || Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.RegistrySettings, monitor_mode, 0)) { VerifyMode(dev1, monitor_mode); opentk_dev_current_res = new DisplayResolution( monitor_mode.Position.X, monitor_mode.Position.Y, monitor_mode.PelsWidth, monitor_mode.PelsHeight, monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency); opentk_dev_primary = (dev1.StateFlags & DisplayDeviceStateFlags.PrimaryDevice) != DisplayDeviceStateFlags.None; } opentk_dev_available_res.Clear(); mode_count = 0; while (Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), mode_count++, monitor_mode, 0)) { VerifyMode(dev1, monitor_mode); DisplayResolution res = new DisplayResolution( monitor_mode.Position.X, monitor_mode.Position.Y, monitor_mode.PelsWidth, monitor_mode.PelsHeight, monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency); opentk_dev_available_res.Add(res); } // Construct the OpenTK DisplayDevice through the accumulated parameters. // The constructor will automatically add the DisplayDevice to the list // of available devices. opentk_dev = new DisplayDevice( opentk_dev_current_res, opentk_dev_primary, opentk_dev_available_res, opentk_dev_current_res.Bounds, dev1.DeviceName); AvailableDevices.Add(opentk_dev); if (opentk_dev_primary) Primary = opentk_dev; Debug.Print("DisplayDevice {0} ({1}) supports {2} resolutions.", device_count, opentk_dev.IsPrimary ? "primary" : "secondary", opentk_dev.AvailableResolutions.Count); } } }
public override sealed bool TryChangeResolution(DisplayDevice device, DisplayResolution resolution) { DeviceMode lpDevMode = (DeviceMode) null; if (resolution != (DisplayResolution) null) { lpDevMode = new DeviceMode(); lpDevMode.PelsWidth = resolution.Width; lpDevMode.PelsHeight = resolution.Height; lpDevMode.BitsPerPel = resolution.BitsPerPixel; lpDevMode.DisplayFrequency = (int) resolution.RefreshRate; lpDevMode.Fields = 6029312; } return 0 == Functions.ChangeDisplaySettingsEx((string) device.Id, lpDevMode, IntPtr.Zero, ChangeDisplaySettingsEnum.Fullscreen, IntPtr.Zero); }
public static extern BOOL EnumDisplaySettingsEx([MarshalAs(UnmanagedType.LPTStr)] LPCTSTR lpszDeviceName, DWORD iModeNum, [In, Out] DeviceMode lpDevMode, DWORD dwFlags);
public static bool EnumDisplaySettingsEx([MarshalAs(UnmanagedType.LPTStr)] string lpszDeviceName, DisplayModeSettingsEnum iModeNum, [In, Out] DeviceMode lpDevMode, int dwFlags);
internal static int ChangeDisplaySettings(DeviceMode device_mode, ChangeDisplaySettingsEnum flags);
public void RefreshDisplayDevices() { lock (display_lock) { AvailableDevices.Clear(); // We save all necessary parameters in temporary variables // and construct the device when every needed detail is available. // The main DisplayDevice constructor adds the newly constructed device // to the list of available devices. DisplayDevice opentk_dev; DisplayResolution opentk_dev_current_res = null; List <DisplayResolution> opentk_dev_available_res = new List <DisplayResolution>(); bool opentk_dev_primary = false; int device_count = 0, mode_count = 0; // Get available video adapters and enumerate all monitors WindowsDisplayDevice dev1 = new WindowsDisplayDevice(), dev2 = new WindowsDisplayDevice(); while (Functions.EnumDisplayDevices(null, device_count++, dev1, 0)) { if ((dev1.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) == DisplayDeviceStateFlags.None) { continue; } DeviceMode monitor_mode = new DeviceMode(); // The second function should only be executed when the first one fails // (e.g. when the monitor is disabled) if (Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.CurrentSettings, monitor_mode, 0) || Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.RegistrySettings, monitor_mode, 0)) { opentk_dev_current_res = new DisplayResolution( monitor_mode.Position.X, monitor_mode.Position.Y, monitor_mode.PelsWidth, monitor_mode.PelsHeight, monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency); opentk_dev_primary = (dev1.StateFlags & DisplayDeviceStateFlags.PrimaryDevice) != DisplayDeviceStateFlags.None; } opentk_dev_available_res.Clear(); mode_count = 0; while (Functions.EnumDisplaySettings(dev1.DeviceName.ToString(), mode_count++, monitor_mode)) { DisplayResolution res = new DisplayResolution( monitor_mode.Position.X, monitor_mode.Position.Y, monitor_mode.PelsWidth, monitor_mode.PelsHeight, monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency); opentk_dev_available_res.Add(res); } // Construct the OpenTK DisplayDevice through the accumulated parameters. // The constructor will automatically add the DisplayDevice to the list // of available devices. opentk_dev = new DisplayDevice( opentk_dev_current_res, opentk_dev_primary, opentk_dev_available_res, opentk_dev_current_res.Bounds, dev1.DeviceName); AvailableDevices.Add(opentk_dev); if (opentk_dev_primary) { Primary = opentk_dev; } Debug.Print("DisplayDevice {0} ({1}) supports {2} resolutions.", device_count, opentk_dev.IsPrimary ? "primary" : "secondary", opentk_dev.AvailableResolutions.Count); } } }
new Dictionary <DisplayDevice, string>(); // Needed for ChangeDisplaySettingsEx #region --- Constructors --- /// <summary>Queries available display devices and display resolutions.</summary> static WinDisplayDeviceDriver() { lock (display_lock) { // To minimize the need to add static methods to OpenTK.Graphics.DisplayDevice // we only allow settings to be set through its constructor. // Thus, we save all necessary parameters in temporary variables // and construct the device when every needed detail is available. // The main DisplayDevice constructor adds the newly constructed device // to the list of available devices. DisplayDevice opentk_dev; DisplayResolution opentk_dev_current_res = null; List <DisplayResolution> opentk_dev_available_res = new List <DisplayResolution>(); bool opentk_dev_primary = false; int device_count = 0, mode_count = 0; // Get available video adapters and enumerate all monitors WindowsDisplayDevice dev1 = new WindowsDisplayDevice(), dev2 = new WindowsDisplayDevice(); while (Functions.EnumDisplayDevices(null, device_count++, dev1, 0)) { if ((dev1.StateFlags & DisplayDeviceStateFlags.AttachedToDesktop) == DisplayDeviceStateFlags.None) { continue; } DeviceMode monitor_mode = new DeviceMode(); // The second function should only be executed when the first one fails // (e.g. when the monitor is disabled) if (Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.CurrentSettings, monitor_mode, 0) || Functions.EnumDisplaySettingsEx(dev1.DeviceName.ToString(), DisplayModeSettingsEnum.RegistrySettings, monitor_mode, 0)) { opentk_dev_current_res = new DisplayResolution( monitor_mode.Position.X, monitor_mode.Position.Y, monitor_mode.PelsWidth, monitor_mode.PelsHeight, monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency); opentk_dev_primary = (dev1.StateFlags & DisplayDeviceStateFlags.PrimaryDevice) != DisplayDeviceStateFlags.None; } opentk_dev_available_res.Clear(); mode_count = 0; while (Functions.EnumDisplaySettings(dev1.DeviceName.ToString(), mode_count++, monitor_mode)) { DisplayResolution res = new DisplayResolution( monitor_mode.Position.X, monitor_mode.Position.Y, monitor_mode.PelsWidth, monitor_mode.PelsHeight, monitor_mode.BitsPerPel, monitor_mode.DisplayFrequency); opentk_dev_available_res.Add(res); } // Construct the OpenTK DisplayDevice through the accumulated parameters. // The constructor will automatically add the DisplayDevice to the list // of available devices. opentk_dev = new DisplayDevice( opentk_dev_current_res, opentk_dev_primary, opentk_dev_available_res); available_device_names.Add(opentk_dev, dev1.DeviceName); } } }
internal static extern bool EnumDisplaySettings([MarshalAs(UnmanagedType.LPTStr)] string device_name, int graphics_mode, [In, Out] DeviceMode device_mode);
public static int ChangeDisplaySettingsEx([MarshalAs(UnmanagedType.LPTStr)] string lpszDeviceName, DeviceMode lpDevMode, IntPtr hwnd, ChangeDisplaySettingsEnum dwflags, IntPtr lParam);
public static extern int ChangeDisplaySettingsEx([MarshalAs(UnmanagedType.LPTStr)] string lpszDeviceName, DeviceMode lpDevMode, IntPtr hwnd, ChangeDisplaySettingsEnum dwflags, IntPtr lParam);
internal static extern int ChangeDisplaySettings(DeviceMode device_mode, ChangeDisplaySettingsEnum flags);
public IEnumerable<DisplayMode> GetDisplayModes() { List<DisplayMode> modes = new List<DisplayMode>(); bool done = false; int index = 0; while (!done) { DeviceMode currentMode = new DeviceMode(); IntPtr handle = Marshal.AllocHGlobal(Marshal.SizeOf(typeof(DeviceMode))); Marshal.StructureToPtr(currentMode, handle, true); done = (Functions.EnumDisplaySettings(null, index++, handle) != 0) ? false : true; int error = Marshal.GetLastWin32Error(); Marshal.PtrToStructure(handle, currentMode); Marshal.FreeHGlobal(handle); if (error != 0) { Console.WriteLine("Error: {0}", error); continue; } if (done) break; //DisplayMode mode = new DisplayMode(currentMode.PelsWidth, currentMode.PelsHeight); DisplayMode mode = new DisplayMode( currentMode.PelsWidth, currentMode.PelsHeight, new ColorMode(currentMode.BitsPerPel), 0, 0, 0, 0, false, false, false, currentMode.DisplayFrequency ); modes.Add(mode); } return modes.ToArray(); }