Try hooking up talking state to mute state
Deploy to Gitea Releases / deploy-to-gitea-releases (push) Successful in 34s
Deploy to Gitea Releases / deploy-to-gitea-releases (push) Successful in 34s
This commit is contained in:
+5
-5
@@ -13,8 +13,6 @@ 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;
|
||||
@@ -24,9 +22,9 @@ internal class AudioDevice : IAudioSessionEventsHandler
|
||||
_logger = Log.ForContext<AudioDevice>();
|
||||
|
||||
_friendlyName = device.DeviceFriendlyName;
|
||||
_muted = device.AudioEndpointVolume.Mute;
|
||||
IsMuted = device.AudioEndpointVolume.Mute;
|
||||
|
||||
_logger.Information("AudioDevice: {name} {muted}", _friendlyName, _muted);
|
||||
_logger.Information("AudioDevice: {name} {muted}", _friendlyName, IsMuted);
|
||||
|
||||
device.AudioEndpointVolume.OnVolumeNotification += AudioEndpointVolume_OnVolumeNotification;
|
||||
device.AudioSessionManager.AudioSessionControl.RegisterEventClient(this);
|
||||
@@ -45,7 +43,7 @@ internal class AudioDevice : IAudioSessionEventsHandler
|
||||
{
|
||||
_logger.Information("AudioEndpointVolume_OnVolumeNotification: {name} {muted}", _friendlyName, data.Muted);
|
||||
|
||||
_muted = data.Muted;
|
||||
IsMuted = data.Muted;
|
||||
}
|
||||
|
||||
private void AudioSessionManager_OnSessionCreated(object sender, IAudioSessionControl newSession)
|
||||
@@ -69,6 +67,8 @@ internal class AudioDevice : IAudioSessionEventsHandler
|
||||
|
||||
public int ActiveSessionCount => _sessions.Values.Count(s => s.State == AudioSessionState.AudioSessionStateActive);
|
||||
|
||||
public bool IsMuted { get; private set; }
|
||||
|
||||
void IAudioSessionEventsHandler.OnVolumeChanged(float volume, bool isMuted)
|
||||
{
|
||||
_logger.Information("OnVolumeChanged: {name} {volume} {isMuted}", _friendlyName, volume, isMuted);
|
||||
|
||||
Reference in New Issue
Block a user