1
0
mirror of https://github.com/Artemis-RGB/Artemis synced 2025-12-13 05:48:35 +00:00

Added a general-setting to tune the rate of screen-captures

This commit is contained in:
Darth Affe 2016-11-01 16:14:38 +01:00
parent e9cc4ad22c
commit fabab2755b
3 changed files with 28 additions and 11 deletions

View File

@ -20,7 +20,7 @@ namespace Artemis.Profiles.Layers.Types.AmbientLight.ScreenCapturing
private static IScreenCapture _screenCapture;
public static double StandByTime { get; set; } = 3;
public static double UpdateRate { get; set; } = 1f / 20f; // DarthAffe 29.10.2016: I think 20 FPS should be enough as default
public static double UpdateRate { get; set; } = 1.0 / 20.0; // DarthAffe 29.10.2016: I think 20 FPS should be enough as default
public static ScreenCaptureMode ScreenCaptureMode { get; set; } = ScreenCaptureMode.DirectX9;
public static int LastCaptureWidth { get; private set; }
@ -33,7 +33,7 @@ namespace Artemis.Profiles.Layers.Types.AmbientLight.ScreenCapturing
private static IScreenCapture GetScreenCapture()
{
if (_lastScreenCaptureMode == ScreenCaptureMode)
if (_lastScreenCaptureMode == ScreenCaptureMode && _screenCapture != null)
return _screenCapture;
DisposeScreenCapture();

View File

@ -3,6 +3,7 @@ using System.ComponentModel;
using System.IO;
using System.Windows;
using Artemis.DAL;
using Artemis.Profiles.Layers.Types.AmbientLight.ScreenCapturing;
using Artemis.Utilities;
using Caliburn.Micro;
using MahApps.Metro;
@ -59,6 +60,10 @@ namespace Artemis.Settings
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public string Theme { get; set; }
[DefaultValue(20)]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public int ScreenCaptureFPS { get; set; }
[DefaultValue("Info")]
[JsonProperty(DefaultValueHandling = DefaultValueHandling.Populate)]
public string LogLevel { get; set; }
@ -71,6 +76,7 @@ namespace Artemis.Settings
ApplyAutorun();
ApplyTheme();
ApplyGamestatePort();
ApplyScreenCaptureFPS();
Logging.SetupLogging(LogLevel);
}
@ -109,7 +115,7 @@ namespace Artemis.Settings
{
// Ignored, only happens when running from VS
}
}
}
@ -138,5 +144,10 @@ namespace Artemis.Settings
}
});
}
public void ApplyScreenCaptureFPS()
{
ScreenCaptureManager.UpdateRate = 1.0 / ScreenCaptureFPS;
}
}
}

View File

@ -6,8 +6,7 @@
xmlns:controls="http://metro.mahapps.com/winfx/xaml/controls"
xmlns:cal="http://www.caliburnproject.org"
mc:Ignorable="d"
d:DesignHeight="600" d:DesignWidth="300"
Width="270">
d:DesignHeight="600" d:DesignWidth="300">
<Grid>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="Auto" />
@ -25,6 +24,7 @@
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
<RowDefinition Height="*" />
</Grid.RowDefinitions>
@ -89,27 +89,33 @@
Style="{StaticResource MahApps.Metro.Styles.ToggleSwitchButton.Win10}"
HorizontalAlignment="Right" />
<!-- Screen capturing -->
<Label Grid.Row="8" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Screen-Capture FPS:" />
<controls:NumericUpDown Grid.Row="8" Grid.Column="1" Margin="10" VerticalAlignment="Center"
HorizontalAlignment="Right" Width="140" Minimum="1" Maximum="60"
Value="{Binding Path=GeneralSettings.ScreenCaptureFPS, Mode=TwoWay}" />
<!-- Logging -->
<Label Grid.Row="8" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
<Label Grid.Row="9" Grid.Column="0" Margin="5" VerticalAlignment="Center" HorizontalAlignment="Left"
Content="Log level:" />
<ComboBox Grid.Row="8" Grid.Column="1" x:Name="LogLevels" Margin="10" VerticalAlignment="Center"
<ComboBox Grid.Row="9" Grid.Column="1" x:Name="LogLevels" Margin="10" VerticalAlignment="Center"
HorizontalAlignment="Right"
Width="140" />
<Button Grid.Row="9" Grid.Column="1" Margin="10" x:Name="ShowDebug" Content="Show debugger"
<Button Grid.Row="10" Grid.Column="1" Margin="10" x:Name="ShowDebug" Content="Show debugger"
VerticalAlignment="Center" Width="90" HorizontalAlignment="Right"
Style="{DynamicResource SquareButtonStyle}" />
<!-- Buttons -->
<Button Grid.Row="10" Grid.Column="0" Margin="10" x:Name="ResetSettings" Content="Reset settings"
<Button Grid.Row="11" Grid.Column="0" Margin="10" x:Name="ResetSettings" Content="Reset settings"
VerticalAlignment="Center" HorizontalAlignment="Left" Width="90"
Style="{DynamicResource SquareButtonStyle}" />
<Button Grid.Row="10" Grid.Column="1" Margin="11" x:Name="SaveSettings" Content="Save changes"
<Button Grid.Row="11" Grid.Column="1" Margin="11" x:Name="SaveSettings" Content="Save changes"
VerticalAlignment="Center" HorizontalAlignment="Right" Width="90"
Style="{DynamicResource SquareButtonStyle}" />
<!-- Version -->
<Grid Grid.Row="11" Grid.Column="0" Grid.ColumnSpan="2" Margin="10" VerticalAlignment="Bottom">
<Grid Grid.Row="12" Grid.Column="0" Grid.ColumnSpan="2" Margin="10" VerticalAlignment="Bottom">
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />