|
|
|
|
@ -2,8 +2,6 @@ |
|
|
|
|
// Created: 2021-04-10 |
|
|
|
|
// Copyright(c) 2021 SimonG. All Rights Reserved. |
|
|
|
|
|
|
|
|
|
using System.Linq; |
|
|
|
|
using System.Runtime.InteropServices; |
|
|
|
|
using Lib.Audio.Interfaces; |
|
|
|
|
using NAudio.CoreAudioApi; |
|
|
|
|
|
|
|
|
|
@ -12,16 +10,18 @@ namespace Lib.Audio |
|
|
|
|
public class MasterControllable : IMasterControllable |
|
|
|
|
{ |
|
|
|
|
private readonly AudioEndpointVolume _audioEndpointVolume; |
|
|
|
|
private readonly string _name; |
|
|
|
|
private readonly IControllableCollector _controllableCollector; |
|
|
|
|
|
|
|
|
|
public MasterControllable(AudioEndpointVolume audioEndpointVolume, string name, IControllableCollector controllableCollector) |
|
|
|
|
{ |
|
|
|
|
_audioEndpointVolume = audioEndpointVolume; |
|
|
|
|
_name = name; |
|
|
|
|
Name = name; |
|
|
|
|
_controllableCollector = controllableCollector; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
public string Name { get; } |
|
|
|
|
public string? IconPath => null; |
|
|
|
|
|
|
|
|
|
public void SetVolume(float volume) |
|
|
|
|
{ |
|
|
|
|
// try |
|
|
|
|
@ -46,7 +46,7 @@ namespace Lib.Audio |
|
|
|
|
public void Mute() => _audioEndpointVolume.Mute = true; |
|
|
|
|
public void UnMute() => _audioEndpointVolume.Mute = false; |
|
|
|
|
|
|
|
|
|
public override string ToString() => _name; |
|
|
|
|
public override string ToString() => Name; |
|
|
|
|
// public override bool Equals(object? obj) |
|
|
|
|
// { |
|
|
|
|
// if (obj is not MasterControllable masterControllable) |
|
|
|
|
|