diff --git a/Project-Aurora/Project-Aurora/Profiles/LocalPCInformation.cs b/Project-Aurora/Project-Aurora/Profiles/LocalPCInformation.cs
index cc31840ca..675e6c2d8 100644
--- a/Project-Aurora/Project-Aurora/Profiles/LocalPCInformation.cs
+++ b/Project-Aurora/Project-Aurora/Profiles/LocalPCInformation.cs
@@ -35,28 +35,21 @@ public class LocalPCInformation : Node {
#endregion
#region Audio Properties
- private static readonly MMDeviceEnumerator mmDeviceEnumerator = new MMDeviceEnumerator();
- private static readonly NAudio.Wave.WaveInEvent waveInEvent = new NAudio.Wave.WaveInEvent();
+ private static readonly AudioDeviceProxy captureProxy;
+ private static readonly AudioDeviceProxy renderProxy;
- ///
- /// Gets the default endpoint for output (playback) devices e.g. speakers, headphones, etc.
- /// This will return null if there are no playback devices available.
- ///
- private MMDevice DefaultAudioOutDevice {
+ private MMDevice CaptureDevice {
get {
- try { return mmDeviceEnumerator.GetDefaultAudioEndpoint(DataFlow.Render, Role.Console); }
- catch { return null; }
+ if (captureProxy != null)
+ captureProxy.DeviceId = Global.Configuration.GSIAudioCaptureDevice;
+ return captureProxy?.Device;
}
}
- ///
- /// Gets the default endpoint for input (recording) devices e.g. microphones.
- /// This will return null if there are no recording devices available.
- ///
- private MMDevice DefaultAudioInDevice {
+ private MMDevice RenderDevice {
get {
- try { return mmDeviceEnumerator.GetDefaultAudioEndpoint(DataFlow.Capture, Role.Console); }
- catch { return null; }
+ renderProxy.DeviceId = Global.Configuration.GSIAudioRenderDevice;
+ return renderProxy?.Device;
}
}
@@ -64,32 +57,32 @@ private MMDevice DefaultAudioInDevice {
/// Current system volume (as set from the speaker icon)
///
// Note: Manually checks if muted to return 0 since this is not taken into account with the MasterVolumeLevelScalar.
- public float SystemVolume => SystemVolumeIsMuted ? 0 : DefaultAudioOutDevice?.AudioEndpointVolume.MasterVolumeLevelScalar * 100 ?? 0;
+ public float SystemVolume => SystemVolumeIsMuted ? 0 : RenderDevice?.AudioEndpointVolume.MasterVolumeLevelScalar * 100 ?? 0;
///
/// Gets whether the system volume is muted.
///
- public bool SystemVolumeIsMuted => DefaultAudioOutDevice?.AudioEndpointVolume.Mute ?? true;
+ public bool SystemVolumeIsMuted => RenderDevice?.AudioEndpointVolume.Mute ?? true;
///
/// The volume level that is being recorded by the default microphone even when muted.
///
- public float MicrophoneLevel => DefaultAudioInDevice?.AudioMeterInformation.MasterPeakValue * 100 ?? 0;
+ public float MicrophoneLevel => CaptureDevice?.AudioMeterInformation.MasterPeakValue * 100 ?? 0;
///
/// The volume level that is being emitted by the default speaker even when muted.
///
- public float SpeakerLevel => DefaultAudioOutDevice?.AudioMeterInformation.MasterPeakValue * 100 ?? 0;
+ public float SpeakerLevel => RenderDevice?.AudioMeterInformation.MasterPeakValue * 100 ?? 0;
///
/// The volume level that is being recorded by the default microphone if not muted.
///
- public float MicLevelIfNotMuted => MicrophoneIsMuted ? 0 : DefaultAudioInDevice?.AudioMeterInformation.MasterPeakValue * 100 ?? 0;
+ public float MicLevelIfNotMuted => MicrophoneIsMuted ? 0 : CaptureDevice?.AudioMeterInformation.MasterPeakValue * 100 ?? 0;
///
/// Gets whether the default microphone is muted.
///
- public bool MicrophoneIsMuted => DefaultAudioInDevice?.AudioEndpointVolume.Mute ?? true;
+ public bool MicrophoneIsMuted => CaptureDevice?.AudioEndpointVolume.Mute ?? true;
#endregion
#region Device Properties
@@ -153,23 +146,13 @@ private MMDevice DefaultAudioInDevice {
///
public bool IsDesktopLocked => DesktopUtils.IsDesktopLocked;
- static LocalPCInformation() {
- void StartStopRecording() {
- // We must start recording to be able to capture audio in, but only do this if the user has the option set. Allowing them
- // to turn it off will give them piece of mind we're not spying on them and will stop the Windows 10 mic icon appearing.
- try {
- if (Global.Configuration.EnableAudioCapture)
- waveInEvent.StartRecording();
- else
- waveInEvent.StopRecording();
- } catch { }
- }
+ private bool pendingAudioDeviceUpdate = false;
- StartStopRecording();
- Global.Configuration.PropertyChanged += (sender, e) => {
- if (e.PropertyName == "EnableAudioCapture")
- StartStopRecording();
- };
+ 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);
}
}
diff --git a/Project-Aurora/Project-Aurora/Project-Aurora.csproj b/Project-Aurora/Project-Aurora/Project-Aurora.csproj
index d9cee6439..ad8c646dd 100644
--- a/Project-Aurora/Project-Aurora/Project-Aurora.csproj
+++ b/Project-Aurora/Project-Aurora/Project-Aurora.csproj
@@ -701,6 +701,7 @@
Window_ProcessSelection.xaml
+
diff --git a/Project-Aurora/Project-Aurora/Settings/Configuration.cs b/Project-Aurora/Project-Aurora/Settings/Configuration.cs
index 35fa66a06..9ed26a8a6 100755
--- a/Project-Aurora/Project-Aurora/Settings/Configuration.cs
+++ b/Project-Aurora/Project-Aurora/Settings/Configuration.cs
@@ -515,6 +515,9 @@ public class Configuration : INotifyPropertyChanged
public List ProfileOrder { get; set; } = new List();
+ public string GSIAudioRenderDevice { get; set; } = AudioDeviceProxy.DEFAULT_DEVICE_ID;
+ public string GSIAudioCaptureDevice { get; set; } = AudioDeviceProxy.DEFAULT_DEVICE_ID;
+
public Configuration()
{
//First Time Installs
diff --git a/Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml b/Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml
index 0b5ff0e73..239bc8501 100755
--- a/Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml
+++ b/Project-Aurora/Project-Aurora/Settings/Control_Settings.xaml
@@ -8,7 +8,7 @@
xmlns:EnumDeviceKeys="clr-namespace:Aurora.Devices"
xmlns:EnumPercentEffectType="clr-namespace:Aurora.Settings"
xmlns:EnumInteractiveEffects="clr-namespace:Aurora.Profiles.Desktop"
- xmlns:EnumValueConverters="clr-namespace:Aurora.Utils"
+ xmlns:u="clr-namespace:Aurora.Utils"
xmlns:xctk="http://schemas.xceed.com/wpf/xaml/toolkit"
xmlns:Controls="clr-namespace:Aurora.Controls" xmlns:params="http://schemas.codeplex.com/elysium/params" x:Class="Aurora.Settings.Control_Settings"
mc:Ignorable="d"
@@ -20,12 +20,12 @@
-
+
-
+
@@ -35,7 +35,7 @@
-
+
@@ -45,7 +45,7 @@
-
+
@@ -55,7 +55,7 @@
-
+
@@ -65,7 +65,7 @@
-
+
@@ -75,7 +75,7 @@
-
+
@@ -85,7 +85,7 @@
-
+
@@ -95,7 +95,7 @@
-
+
@@ -105,7 +105,7 @@
-
+
@@ -115,7 +115,7 @@
-
+
@@ -132,10 +132,10 @@
-
-
-
-
+
+
+
+
@@ -170,7 +170,14 @@
-
+
+
+
+
+
+
+
+
@@ -376,7 +383,7 @@
-
+