Add logging and track mute state
Deploy to Gitea Releases / deploy-to-gitea-releases (push) Successful in 33s

This commit is contained in:
2026-08-18 15:18:25 -04:00
parent ca956f207b
commit 5aeefebc47
+7 -1
View File
@@ -4,7 +4,6 @@ using Serilog;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Windows.Threading;
namespace WorkIndicator;
@@ -14,6 +13,8 @@ internal class AudioDevice : IAudioSessionEventsHandler
private readonly string _friendlyName;
private readonly Dictionary<string, AudioSessionControl> _sessions = new();
private bool _muted;
public delegate void AudioSessionsChangedDelegate();
public event AudioSessionsChangedDelegate AudioSessionsChanged;
@@ -23,6 +24,9 @@ internal class AudioDevice : IAudioSessionEventsHandler
_logger = Log.ForContext<AudioDevice>();
_friendlyName = device.DeviceFriendlyName;
_muted = device.AudioEndpointVolume.Mute;
_logger.Information("AudioDevice: {name} {muted}", _friendlyName, _muted);
device.AudioEndpointVolume.OnVolumeNotification += AudioEndpointVolume_OnVolumeNotification;
device.AudioSessionManager.AudioSessionControl.RegisterEventClient(this);
@@ -40,6 +44,8 @@ internal class AudioDevice : IAudioSessionEventsHandler
private void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data)
{
_logger.Information("AudioEndpointVolume_OnVolumeNotification: {name} {muted}", _friendlyName, data.Muted);
_muted = data.Muted;
}
private void AudioSessionManager_OnSessionCreated(object sender, IAudioSessionControl newSession)