Skip to content

Commit

Permalink
Merge pull request #2076 from diogotr7/feature/small-fixes
Browse files Browse the repository at this point in the history
Fixed a few small things
  • Loading branch information
diogotr7 authored Jun 8, 2020
2 parents bf1db63 + 1200222 commit 3b99c7d
Show file tree
Hide file tree
Showing 8 changed files with 176 additions and 88 deletions.
17 changes: 13 additions & 4 deletions Project-Aurora/Project-Aurora/Profiles/LocalPCInformation.cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
using Aurora.Utils;
using NAudio.CoreAudioApi;
using System.Linq;
using System.Runtime.InteropServices;

namespace Aurora.Profiles {
/// <summary>
Expand Down Expand Up @@ -48,7 +49,8 @@ private MMDevice CaptureDevice {

private MMDevice RenderDevice {
get {
renderProxy.DeviceId = Global.Configuration.GSIAudioRenderDevice;
if (renderProxy != null)
renderProxy.DeviceId = Global.Configuration.GSIAudioRenderDevice;
return renderProxy?.Device;
}
}
Expand Down Expand Up @@ -150,9 +152,16 @@ private MMDevice RenderDevice {

static LocalPCInformation() {
// Do not create a capture device if audio capture is disabled. Otherwise it will create a mic icon in win 10 and people will think we're spies.
if (Global.Configuration.EnableAudioCapture)
captureProxy = new AudioDeviceProxy(Global.Configuration.GSIAudioCaptureDevice, DataFlow.Capture);
renderProxy = new AudioDeviceProxy(Global.Configuration.GSIAudioRenderDevice, DataFlow.Render);
try
{
if (Global.Configuration.EnableAudioCapture)
captureProxy = new AudioDeviceProxy(Global.Configuration.GSIAudioCaptureDevice, DataFlow.Capture);
renderProxy = new AudioDeviceProxy(Global.Configuration.GSIAudioRenderDevice, DataFlow.Render);
}
catch(COMException e)
{
Global.logger.Error("Error initializing audio device proxy in LocalPCInfo, this is probably caused by an incompatible audio software: " + e);
}
}
}

Expand Down
4 changes: 1 addition & 3 deletions Project-Aurora/Project-Aurora/Settings/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,7 @@ public class Configuration : INotifyPropertyChanged
public float idle_frequency;

//Hardware Monitor
public int HardwareMonitorUpdateRate;
public int HardwareMonitorUpdateRate { get; set; } = 300;

public VariableRegistry VarRegistry;

Expand Down Expand Up @@ -579,8 +579,6 @@ public Configuration()
idle_amount = 5;
idle_frequency = 2.5f;

HardwareMonitorUpdateRate = 200;

//Debug
BitmapDebugTopMost = false;
HttpDebugTopMost = false;
Expand Down
6 changes: 5 additions & 1 deletion Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
<CheckBox x:Name="timed_dimming_checkbox" Content="Enable timed blackout of the keyboard" HorizontalAlignment="Left" Margin="10,184,0,0" VerticalAlignment="Top" Checked="timed_dimming_checkbox_Checked" Unchecked="timed_dimming_checkbox_Checked"/>
<CheckBox x:Name="chkOverlayPreview" Content="Show Overlays and Underlays in Application Preview" HorizontalAlignment="Left" Margin="12,62,0,0" VerticalAlignment="Top" Checked="chkOverlayPreview_Checked" Unchecked="chkOverlayPreview_Checked"/>
<TextBlock HorizontalAlignment="Left" Margin="11,230,0,0" TextWrapping="Wrap" Text="Blackout start time:" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Left" Margin="12,254,0,0" TextWrapping="Wrap" Text="Blackout end time:" VerticalAlignment="Top"/>
<TextBlock HorizontalAlignment="Left" Margin="11,254,0,0" TextWrapping="Wrap" Text="Blackout end time:" VerticalAlignment="Top"/>
<CheckBox x:Name="timed_dimming_with_games_checkbox" Content="Apply timed blackout to game events" HorizontalAlignment="Left" Margin="10,205,0,0" VerticalAlignment="Top" Checked="timed_dimming_with_games_checkbox_Checked" Unchecked="timed_dimming_with_games_checkbox_Checked"/>
<ListBox x:Name="excluded_listbox" HorizontalAlignment="Left" Height="199" Margin="512,139,0,0" VerticalAlignment="Top" Width="160"/>
<TextBlock Text="Excluded Processes" HorizontalAlignment="Left" Margin="512,117,0,0" VerticalAlignment="Top" Width="113"/>
Expand Down Expand Up @@ -178,6 +178,10 @@
<TextBlock Text="GSI Recording Device:" Margin="511,89,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />
<ComboBox SelectedValue="{Binding Path=GSIAudioCaptureDevice, Mode=TwoWay}" ItemsSource="{x:Static u:AudioDeviceProxy.RecordingDevices}" DisplayMemberPath="Value" SelectedValuePath="Key" Margin="632,86,0,0" Width="185" HorizontalAlignment="Left" VerticalAlignment="Top" />
<TextBlock Text="?" TextDecorations="Underline" ToolTip="The audio recording device that will be used for the local PC information state values. Does not affect visualizer layer." ToolTipService.InitialShowDelay="0" Margin="822,89,0,0" HorizontalAlignment="Left" VerticalAlignment="Top" />

<TextBlock HorizontalAlignment="Left" Margin="12,278,0,0" TextWrapping="Wrap" Text="Hardware sensors update rate:" VerticalAlignment="Top" ToolTip="Used for CPU and GPU usage, etc"/>
<xctk:IntegerUpDown HorizontalAlignment="Left" Height="24" Margin="178,278,0,0" VerticalAlignment="Top" Width="50" Value="{Binding HardwareMonitorUpdateRate}" Maximum="2000" Minimum="100" MouseWheelActiveOnFocus="True" />

</Grid>
</TabItem>
<TabItem Header="Away Effects">
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -952,9 +952,9 @@ private void startDelayAmount_ValueChanged(object sender, RoutedPropertyChangedE
private void btnDumpSensors_Click(object sender, RoutedEventArgs e)
{
if (HardwareMonitor.TryDump())
Xceed.Wpf.Toolkit.MessageBox.Show("Successfully wrote sensor info to logs folder");
System.Windows.MessageBox.Show("Successfully wrote sensor info to logs folder");
else
Xceed.Wpf.Toolkit.MessageBox.Show("Eror dumping file. Consult log for details.");
System.Windows.MessageBox.Show("Eror dumping file. Consult log for details.");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -346,7 +346,7 @@ public override EffectLayer Render(IGameState gamestate)
break;

case AmbilightType.AverageColor:
var average = BitmapUtils.GetAverageColor(screen);
var average = BitmapUtils.GetRegionColor(screen, cropRegion);

if (Properties.BrightenImage)
average = ColorUtils.ChangeBrightness(average, Properties.BrightnessChange);
Expand Down
Loading

0 comments on commit 3b99c7d

Please sign in to comment.