Skip to content
This repository was archived by the owner on Aug 6, 2021. It is now read-only.

Commit 472f0dd

Browse files
committed
Saved/loaded update-rate into settings
1 parent fdf78e3 commit 472f0dd

File tree

2 files changed

+8
-4
lines changed

2 files changed

+8
-4
lines changed

KeyboardAudioVisualizer/ApplicationManager.cs

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,9 @@
77
using RGB.NET.Brushes;
88
using RGB.NET.Brushes.Gradients;
99
using RGB.NET.Core;
10+
using RGB.NET.Devices.CoolerMaster;
1011
using RGB.NET.Devices.Corsair;
12+
using RGB.NET.Devices.Logitech;
1113
using RGB.NET.Groups;
1214

1315
namespace KeyboardAudioVisualizer
@@ -46,12 +48,12 @@ public void InitializeDevices()
4648
{
4749
RGBSurface surface = RGBSurface.Instance;
4850

49-
surface.UpdateFrequency = 1 / 40.0; //TODO DarthAffe 03.08.2017: Settings
51+
surface.UpdateFrequency = 1 / MathHelper.Clamp(Settings.UpdateRate, 1, 40);
5052
surface.UpdateMode = UpdateMode.Continuous;
5153

5254
surface.LoadDevices(CorsairDeviceProvider.Instance);
53-
//surface.LoadDevices(LogitechDeviceProvider.Instance);
54-
//surface.LoadDevices(CoolerMasterDeviceProvider.Instance);
55+
surface.LoadDevices(LogitechDeviceProvider.Instance);
56+
surface.LoadDevices(CoolerMasterDeviceProvider.Instance);
5557

5658
ILedGroup background = new ListLedGroup(surface.Leds);
5759
background.Brush = new SolidColorBrush(new Color(64, 0, 0, 0)); //TODO DarthAffe 06.08.2017: A-Channel gives some kind of blur - settings!

KeyboardAudioVisualizer/UI/ConfigurationViewModel.cs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,9 @@ public double UpdateRate
1717
get => 1.0 / RGBSurface.Instance.UpdateFrequency;
1818
set
1919
{
20-
RGBSurface.Instance.UpdateFrequency = 1.0 / MathHelper.Clamp(value, 1, 40);
20+
double val = MathHelper.Clamp(value, 1, 40);
21+
ApplicationManager.Instance.Settings.UpdateRate = val;
22+
RGBSurface.Instance.UpdateFrequency = 1.0 / val;
2123
OnPropertyChanged();
2224
}
2325
}

0 commit comments

Comments
 (0)