mirror of
https://github.com/Artemis-RGB/Artemis
synced 2025-12-13 05:48:35 +00:00
Catch and log WASAPI error
This commit is contained in:
parent
2073c5fdea
commit
fb558a1057
@ -128,7 +128,7 @@ namespace Artemis.DAL
|
||||
if (Profiles.Any(p => p.GameName == prof.GameName && p.Name == prof.Name &&
|
||||
p.KeyboardSlug == prof.KeyboardSlug))
|
||||
{
|
||||
Logger.Error("Didn't load duplicate profile: {0}", path);
|
||||
Logger.Info("Didn't load duplicate profile: {0}", path);
|
||||
}
|
||||
else
|
||||
{
|
||||
|
||||
@ -15,6 +15,7 @@ using Artemis.ViewModels.Profiles;
|
||||
using NAudio.CoreAudioApi;
|
||||
using NAudio.Wave;
|
||||
using Newtonsoft.Json;
|
||||
using NLog;
|
||||
|
||||
namespace Artemis.Profiles.Layers.Types.Audio
|
||||
{
|
||||
@ -24,6 +25,7 @@ namespace Artemis.Profiles.Layers.Types.Audio
|
||||
private readonly MMDevice _device;
|
||||
private readonly SampleAggregator _sampleAggregator = new SampleAggregator(1024);
|
||||
private readonly WasapiLoopbackCapture _waveIn;
|
||||
private static readonly Logger Logger = LogManager.GetCurrentClassLogger();
|
||||
private int _lines;
|
||||
private AudioPropertiesModel _previousSettings;
|
||||
|
||||
@ -38,7 +40,16 @@ namespace Artemis.Profiles.Layers.Types.Audio
|
||||
// Start listening for sound data
|
||||
_waveIn = new WasapiLoopbackCapture();
|
||||
_waveIn.DataAvailable += OnDataAvailable;
|
||||
_waveIn.StartRecording();
|
||||
|
||||
try
|
||||
{
|
||||
_waveIn.StartRecording();
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
Logger.Warn(e, "Failed to start WASAPI audio capture");
|
||||
throw;
|
||||
}
|
||||
}
|
||||
|
||||
[JsonIgnore]
|
||||
|
||||
@ -60,8 +60,8 @@ namespace Artemis.Utilities
|
||||
{
|
||||
var settings = SettingsProvider.Load<GeneralSettings>();
|
||||
var currentVersion = Assembly.GetExecutingAssembly().GetName().Version;
|
||||
// if ((settings.LastRanVersion != null) && (currentVersion > settings.LastRanVersion))
|
||||
// {
|
||||
if ((settings.LastRanVersion != null) && (currentVersion > settings.LastRanVersion))
|
||||
{
|
||||
Logger.Info("Updated from {0} to {1}, showing changelog.", settings.LastRanVersion, currentVersion);
|
||||
|
||||
// Ask the user whether he/she wants to see what's new
|
||||
@ -73,7 +73,7 @@ namespace Artemis.Utilities
|
||||
// If user wants to see changelog, show it to them
|
||||
if ((showChanges != null) && showChanges.Value)
|
||||
await ShowChanges(dialogService, currentVersion);
|
||||
// }
|
||||
}
|
||||
|
||||
settings.LastRanVersion = currentVersion;
|
||||
settings.Save();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user