Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
5aeefebc47 |
+7
-1
@@ -4,7 +4,6 @@ using Serilog;
|
|||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Windows.Threading;
|
|
||||||
|
|
||||||
namespace WorkIndicator;
|
namespace WorkIndicator;
|
||||||
|
|
||||||
@@ -14,6 +13,8 @@ internal class AudioDevice : IAudioSessionEventsHandler
|
|||||||
private readonly string _friendlyName;
|
private readonly string _friendlyName;
|
||||||
private readonly Dictionary<string, AudioSessionControl> _sessions = new();
|
private readonly Dictionary<string, AudioSessionControl> _sessions = new();
|
||||||
|
|
||||||
|
private bool _muted;
|
||||||
|
|
||||||
public delegate void AudioSessionsChangedDelegate();
|
public delegate void AudioSessionsChangedDelegate();
|
||||||
|
|
||||||
public event AudioSessionsChangedDelegate AudioSessionsChanged;
|
public event AudioSessionsChangedDelegate AudioSessionsChanged;
|
||||||
@@ -23,6 +24,9 @@ internal class AudioDevice : IAudioSessionEventsHandler
|
|||||||
_logger = Log.ForContext<AudioDevice>();
|
_logger = Log.ForContext<AudioDevice>();
|
||||||
|
|
||||||
_friendlyName = device.DeviceFriendlyName;
|
_friendlyName = device.DeviceFriendlyName;
|
||||||
|
_muted = device.AudioEndpointVolume.Mute;
|
||||||
|
|
||||||
|
_logger.Information("AudioDevice: {name} {muted}", _friendlyName, _muted);
|
||||||
|
|
||||||
device.AudioEndpointVolume.OnVolumeNotification += AudioEndpointVolume_OnVolumeNotification;
|
device.AudioEndpointVolume.OnVolumeNotification += AudioEndpointVolume_OnVolumeNotification;
|
||||||
device.AudioSessionManager.AudioSessionControl.RegisterEventClient(this);
|
device.AudioSessionManager.AudioSessionControl.RegisterEventClient(this);
|
||||||
@@ -40,6 +44,8 @@ internal class AudioDevice : IAudioSessionEventsHandler
|
|||||||
private void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data)
|
private void AudioEndpointVolume_OnVolumeNotification(AudioVolumeNotificationData data)
|
||||||
{
|
{
|
||||||
_logger.Information("AudioEndpointVolume_OnVolumeNotification: {name} {muted}", _friendlyName, data.Muted);
|
_logger.Information("AudioEndpointVolume_OnVolumeNotification: {name} {muted}", _friendlyName, data.Muted);
|
||||||
|
|
||||||
|
_muted = data.Muted;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void AudioSessionManager_OnSessionCreated(object sender, IAudioSessionControl newSession)
|
private void AudioSessionManager_OnSessionCreated(object sender, IAudioSessionControl newSession)
|
||||||
|
|||||||
Reference in New Issue
Block a user