From 26090060248cb586615919514211989a4d850210 Mon Sep 17 00:00:00 2001 From: Andrew Welker Date: Fri, 8 Mar 2024 21:12:27 -0600 Subject: [PATCH] feat: implement ILevelControls on DspBase Also added DspLevelControlPoint class --- .../DSP/DspBase.cs | 34 +++++++++++++++---- 1 file changed, 28 insertions(+), 6 deletions(-) diff --git a/src/PepperDash.Essentials.Devices.Common/DSP/DspBase.cs b/src/PepperDash.Essentials.Devices.Common/DSP/DspBase.cs index 7f28ae3d..a40daac5 100644 --- a/src/PepperDash.Essentials.Devices.Common/DSP/DspBase.cs +++ b/src/PepperDash.Essentials.Devices.Common/DSP/DspBase.cs @@ -6,12 +6,13 @@ using Crestron.SimplSharp; using PepperDash.Essentials.Devices.Common.Codec; using PepperDash.Core; using PepperDash.Essentials.Core; +using PepperDash.Essentials.Core.DeviceTypeInterfaces; namespace PepperDash.Essentials.Devices.Common.DSP { - public abstract class DspBase : EssentialsDevice + public abstract class DspBase : EssentialsDevice, ILevelControls { - public Dictionary LevelControlPoints { get; private set; } + public Dictionary LevelControlPoints { get; private set; } public Dictionary DialerControlPoints { get; private set; } @@ -40,15 +41,36 @@ namespace PepperDash.Essentials.Devices.Common.DSP // Typical presets: // call default preset to restore levels and mutes - public abstract class DspControlPoint + public abstract class DspControlPoint :IKeyed { - string Key { get; set; } + public string Key { get; } + + protected DspControlPoint(string key) => Key = key; } + public abstract class DspLevelControlPoint :DspControlPoint, IBasicVolumeWithFeedback + { + public BoolFeedback MuteFeedback { get; } + public IntFeedback VolumeLevelFeedback { get; } - public class DspDialerBase + protected DspLevelControlPoint(string key, Func muteFeedbackFunc, Func volumeLevelFeedbackFunc) : base(key) + { + MuteFeedback = new BoolFeedback(muteFeedbackFunc); + VolumeLevelFeedback = new IntFeedback(volumeLevelFeedbackFunc); + } + + public abstract void MuteOff(); + public abstract void MuteOn(); + public abstract void MuteToggle(); + public abstract void SetVolume(ushort level); + public abstract void VolumeDown(bool pressRelease); + public abstract void VolumeUp(bool pressRelease); + } + + + public abstract class DspDialerBase:DspControlPoint { - + protected DspDialerBase(string key) : base(key) { } }