From 5b94d89bc36df25563599615a6b6b3e5bd0ff53c Mon Sep 17 00:00:00 2001 From: Alex Johnson Date: Wed, 15 Jun 2022 20:26:32 -0400 Subject: [PATCH] Improvements for DMPS3-4K-150 types --- .../PepperDashEssentialsBase/Global/Global.cs | 44 ++- .../Chassis/DmpsAudioOutputController.cs | 333 +++++++++++++----- .../Chassis/DmpsDigitalOutputController.cs | 8 +- .../Chassis/DmpsRoutingController.cs | 105 ++++-- 4 files changed, 356 insertions(+), 134 deletions(-) diff --git a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs index 9d792437..2bafc2ae 100644 --- a/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs +++ b/essentials-framework/Essentials Core/PepperDashEssentialsBase/Global/Global.cs @@ -6,6 +6,7 @@ using System.Collections.Generic; using Crestron.SimplSharp.CrestronIO; using Crestron.SimplSharp.CrestronDataStore; using Crestron.SimplSharpPro; +using Crestron.SimplSharpPro.DM; using PepperDash.Core; using PepperDash.Essentials.License; @@ -39,7 +40,14 @@ namespace PepperDash.Essentials.Core { get { - return ControlSystem.ControllerPrompt.ToLower().IndexOf("dmps") > -1; + if(ControlSystem.SystemControl != null) + { + if(ControlSystem.SystemControl.SystemControlType > 0) + { + return true; + } + } + return false; } } @@ -50,7 +58,39 @@ namespace PepperDash.Essentials.Core { get { - return ControlSystemIsDmpsType && ControlSystem.ControllerPrompt.ToLower().IndexOf("4k") > -1; + if(ControlSystem.SystemControl != null) + { + if(ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K150CSystemControl || + ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K200CSystemControl || + ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K250CSystemControl || + ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K300CSystemControl || + ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K350CSystemControl) + { + return true; + } + } + return false; + } + } + + /// + /// True when the processor type is a DMPS 4K 200/300/250/350 variant + /// + public static bool ControlSystemIsDmps4k3xxType + { + get + { + if(ControlSystem.SystemControl != null) + { + if(ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K200CSystemControl || + ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K250CSystemControl || + ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K300CSystemControl || + ControlSystem.SystemControl.SystemControlType == eSystemControlType.Dmps34K350CSystemControl) + { + return true; + } + } + return false; } } diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs index 60943270..c3ed2354 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsAudioOutputController.cs @@ -17,60 +17,89 @@ using PepperDash.Essentials.DM.Config; namespace PepperDash.Essentials.DM { /// - /// Exposes the volume levels for Program, Aux1 or Aux2 outputs on a DMPS3 chassis + /// Exposes the volume levels for Program, Aux1, Aux2, Codec1, Codec2, and Digital outputs on a DMPS3 chassis /// public class DmpsAudioOutputController : EssentialsBridgeableDevice { - Card.Dmps3OutputBase OutputCard; - public DmpsAudioOutput MasterVolumeLevel { get; private set; } public DmpsAudioOutput SourceVolumeLevel { get; private set; } public DmpsAudioOutput MicsMasterVolumeLevel { get; private set; } public DmpsAudioOutput Codec1VolumeLevel { get; private set; } public DmpsAudioOutput Codec2VolumeLevel { get; private set; } + public DmpsAudioOutputController(string key, string name, DMOutput card, Card.Dmps3DmHdmiAudioOutput.Dmps3AudioOutputStream stream) + : base(key, name) + { + card.BaseDevice.DMOutputChange += new DMOutputEventHandler(BaseDevice_DMOutputChange); + var output = new Dmps3AudioOutputWithMixerBase(stream); + MasterVolumeLevel = new DmpsAudioOutputWithMixer(output, eDmpsLevelType.Master); + SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source); + } + public DmpsAudioOutputController(string key, string name, DMOutput card, Card.Dmps3DmHdmiAudioOutput.Dmps3DmHdmiOutputStream stream) + : base(key, name) + { + card.BaseDevice.DMOutputChange += new DMOutputEventHandler(BaseDevice_DMOutputChange); + var output = new Dmps3AudioOutputWithMixerBase(stream); + MasterVolumeLevel = new DmpsAudioOutputWithMixer(output, eDmpsLevelType.Master); + SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source); + } + public DmpsAudioOutputController(string key, string name, Card.Dmps3OutputBase card) : base(key, name) { - OutputCard = card; - OutputCard.BaseDevice.DMOutputChange += new DMOutputEventHandler(BaseDevice_DMOutputChange); - - SourceVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Source); - MicsMasterVolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.MicsMaster); + card.BaseDevice.DMOutputChange += new DMOutputEventHandler(BaseDevice_DMOutputChange); if (card is Card.Dmps3ProgramOutput) { - var output = card as Card.Dmps3ProgramOutput; - MasterVolumeLevel = new DmpsAudioOutputWithMixerAndEq(card, eDmpsLevelType.Master, output.OutputMixer, output.OutputEqualizer); - Codec1VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec1); - Codec2VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec2); + var programOutput = card as Card.Dmps3ProgramOutput; + var output = new Dmps3AudioOutputWithMixerBase(card, programOutput.OutputMixer); + MasterVolumeLevel = new DmpsAudioOutputWithMixerAndEq(output, eDmpsLevelType.Master, programOutput.OutputEqualizer); + SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source); + MicsMasterVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.MicsMaster); + Codec1VolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Codec1); + Codec2VolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Codec2); } else if (card is Card.Dmps3Aux1Output) { - var output = card as Card.Dmps3Aux1Output; - MasterVolumeLevel = new DmpsAudioOutputWithMixerAndEq(card, eDmpsLevelType.Master, output.OutputMixer, output.OutputEqualizer); - Codec2VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec2); + var auxOutput = card as Card.Dmps3Aux1Output; + var output = new Dmps3AudioOutputWithMixerBase(card, auxOutput.OutputMixer); + MasterVolumeLevel = new DmpsAudioOutputWithMixerAndEq(output, eDmpsLevelType.Master, auxOutput.OutputEqualizer); + SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source); + MicsMasterVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.MicsMaster); + Codec2VolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Codec2); } else if (card is Card.Dmps3Aux2Output) { - var output = card as Card.Dmps3Aux2Output; - MasterVolumeLevel = new DmpsAudioOutputWithMixerAndEq(card, eDmpsLevelType.Master, output.OutputMixer, output.OutputEqualizer); - Codec1VolumeLevel = new DmpsAudioOutput(card, eDmpsLevelType.Codec1); + var auxOutput = card as Card.Dmps3Aux2Output; + var output = new Dmps3AudioOutputWithMixerBase(card, auxOutput.OutputMixer); + MasterVolumeLevel = new DmpsAudioOutputWithMixerAndEq(output, eDmpsLevelType.Master, auxOutput.OutputEqualizer); + SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source); + MicsMasterVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.MicsMaster); + Codec1VolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Codec1); } else if (card is Card.Dmps3DigitalMixOutput) { - var output = card as Card.Dmps3DigitalMixOutput; - MasterVolumeLevel = new DmpsAudioOutputWithMixer(card, eDmpsLevelType.Master, output.OutputMixer); + var mixOutput = card as Card.Dmps3DigitalMixOutput; + var output = new Dmps3AudioOutputWithMixerBase(card, mixOutput.OutputMixer); + MasterVolumeLevel = new DmpsAudioOutputWithMixer(output, eDmpsLevelType.Master); + SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source); + MicsMasterVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.MicsMaster); } else if (card is Card.Dmps3HdmiOutput) { - var output = card as Card.Dmps3HdmiOutput; - MasterVolumeLevel = new DmpsAudioOutputWithMixer(card, eDmpsLevelType.Master, output.OutputMixer); + var hdmiOutput = card as Card.Dmps3HdmiOutput; + var output = new Dmps3AudioOutputWithMixerBase(card, hdmiOutput.OutputMixer); + MasterVolumeLevel = new DmpsAudioOutputWithMixer(output, eDmpsLevelType.Master); + SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source); + MicsMasterVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.MicsMaster); } else if (card is Card.Dmps3DmOutput) { - var output = card as Card.Dmps3DmOutput; - MasterVolumeLevel = new DmpsAudioOutputWithMixer(card, eDmpsLevelType.Master, output.OutputMixer); + var dmOutput = card as Card.Dmps3DmOutput; + var output = new Dmps3AudioOutputWithMixerBase(card, dmOutput.OutputMixer); + MasterVolumeLevel = new DmpsAudioOutputWithMixer(output, eDmpsLevelType.Master); + SourceVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.Source); + MicsMasterVolumeLevel = new DmpsAudioOutput(output, eDmpsLevelType.MicsMaster); } } @@ -250,8 +279,8 @@ namespace PepperDash.Essentials.DM public class DmpsAudioOutputWithMixerAndEq : DmpsAudioOutputWithMixer { private CrestronControlSystem.Dmps3OutputEqualizer Eq; - public DmpsAudioOutputWithMixerAndEq(Card.Dmps3OutputBase output, eDmpsLevelType type, CrestronControlSystem.Dmps3OutputMixer mixer, CrestronControlSystem.Dmps3OutputEqualizer eq) - : base(output, type, mixer) + public DmpsAudioOutputWithMixerAndEq(Dmps3AudioOutputWithMixerBase output, eDmpsLevelType type, CrestronControlSystem.Dmps3OutputEqualizer eq) + : base(output, type) { Eq = eq; } @@ -265,19 +294,19 @@ namespace PepperDash.Essentials.DM public class DmpsAudioOutputWithMixer : DmpsAudioOutput { - IDmps3OutputMixer Mixer; + Dmps3AudioOutputWithMixerBase Output; - public DmpsAudioOutputWithMixer(Card.Dmps3OutputBase output, eDmpsLevelType type, IDmps3OutputMixer mixer) + public DmpsAudioOutputWithMixer(Dmps3AudioOutputWithMixerBase output, eDmpsLevelType type) : base(output, type) { - Mixer = mixer; + Output = output; GetVolumeMax(); GetVolumeMin(); } public void GetVolumeMin() { - MinLevel = (short)Mixer.MinVolumeFeedback.UShortValue; + MinLevel = (short)Output.MinVolumeFeedback.UShortValue; if (VolumeLevelScaledFeedback != null) { VolumeLevelScaledFeedback.FireUpdate(); @@ -286,7 +315,7 @@ namespace PepperDash.Essentials.DM public void GetVolumeMax() { - MaxLevel = (short)Mixer.MaxVolumeFeedback.UShortValue; + MaxLevel = (short)Output.MaxVolumeFeedback.UShortValue; if (VolumeLevelScaledFeedback != null) { VolumeLevelScaledFeedback.FireUpdate(); @@ -295,32 +324,22 @@ namespace PepperDash.Essentials.DM public void RecallPreset(ushort preset) { - if (Mixer is CrestronControlSystem.Dmps3OutputMixer) - { - var presetMixer = Mixer as CrestronControlSystem.Dmps3OutputMixer; - Debug.Console(1, "DMPS Recalling Preset {0}", preset); - presetMixer.PresetNumber.UShortValue = preset; - presetMixer.RecallPreset(); + Output.PresetNumber.UShortValue = preset; + Output.RecallPreset(); + if (!Global.ControlSystemIsDmps4kType) + { //Recall startup volume for main volume level as DMPS3(non-4K) presets don't affect the main volume RecallStartupVolume(); } - else if (Mixer is CrestronControlSystem.Dmps3AttachableOutputMixer) - { - var presetMixer = Mixer as CrestronControlSystem.Dmps3AttachableOutputMixer; - Debug.Console(1, "DMPS Recalling Preset {0}", preset); - presetMixer.PresetNumber.UShortValue = preset; - presetMixer.RecallPreset(); - } - } public void RecallStartupVolume() { - ushort startupVol = Mixer.StartupVolumeFeedback.UShortValue; + ushort startupVol = Output.StartupVolumeFeedback.UShortValue; //Reset startup vol due to bug on DMPS3 where getting the value from above method clears the startup volume - Mixer.StartupVolume.UShortValue = startupVol; - Debug.Console(1, "DMPS Recalling {0} Startup Volume {1}", Output.Name, startupVol); + Output.StartupVolume.UShortValue = startupVol; + Debug.Console(1, "DMPS Recalling Startup Volume {0}", startupVol); SetVolume(startupVol); MuteOff(); } @@ -329,7 +348,6 @@ namespace PepperDash.Essentials.DM public class DmpsAudioOutput : IBasicVolumeWithFeedback { private UShortInputSig Level; - protected Card.Dmps3OutputBase Output; private bool EnableVolumeSend; private ushort VolumeLevelInput; protected short MinLevel { get; set; } @@ -345,9 +363,8 @@ namespace PepperDash.Essentials.DM Action VolumeUpAction; Action VolumeDownAction; - public DmpsAudioOutput(Card.Dmps3OutputBase output, eDmpsLevelType type) + public DmpsAudioOutput(Dmps3AudioOutputBase output, eDmpsLevelType type) { - Output = output; VolumeLevelInput = 0; EnableVolumeSend = false; Type = type; @@ -359,47 +376,46 @@ namespace PepperDash.Essentials.DM case eDmpsLevelType.Master: { Level = output.MasterVolume; - - MuteFeedback = new BoolFeedback(new Func(() => Output.MasterMuteOnFeedBack.BoolValue)); - VolumeLevelFeedback = new IntFeedback(new Func(() => Output.MasterVolumeFeedBack.UShortValue)); - MuteOnAction = new Action(Output.MasterMuteOn); - MuteOffAction = new Action(Output.MasterMuteOff); - VolumeUpAction = new Action((b) => Output.MasterVolumeUp.BoolValue = b); - VolumeDownAction = new Action((b) => Output.MasterVolumeDown.BoolValue = b); + MuteFeedback = new BoolFeedback(new Func(() => output.MasterMuteOnFeedBack.BoolValue)); + VolumeLevelFeedback = new IntFeedback(new Func(() => output.MasterVolumeFeedBack.UShortValue)); + MuteOnAction = new Action(output.MasterMuteOn); + MuteOffAction = new Action(output.MasterMuteOff); + VolumeUpAction = new Action((b) => output.MasterVolumeUp.BoolValue = b); + VolumeDownAction = new Action((b) => output.MasterVolumeDown.BoolValue = b); break; } case eDmpsLevelType.MicsMaster: { - Level = output.MicMasterLevel; - - MuteFeedback = new BoolFeedback(new Func(() => Output.MicMasterMuteOnFeedBack.BoolValue)); - VolumeLevelFeedback = new IntFeedback(new Func(() => Output.MicMasterLevelFeedBack.UShortValue)); - MuteOnAction = new Action(Output.MicMasterMuteOn); - MuteOffAction = new Action(Output.MicMasterMuteOff); - VolumeUpAction = new Action((b) => Output.MicMasterLevelUp.BoolValue = b); - VolumeDownAction = new Action((b) => Output.MicMasterLevelDown.BoolValue = b); + if (output.Card is Card.Dmps3OutputBase) + { + var micOutput = output.Card as Card.Dmps3OutputBase; + Level = micOutput.MicMasterLevel; + MuteFeedback = new BoolFeedback(new Func(() => micOutput.MicMasterMuteOnFeedBack.BoolValue)); + VolumeLevelFeedback = new IntFeedback(new Func(() => micOutput.MicMasterLevelFeedBack.UShortValue)); + MuteOnAction = new Action(micOutput.MicMasterMuteOn); + MuteOffAction = new Action(micOutput.MicMasterMuteOff); + VolumeUpAction = new Action((b) => micOutput.MicMasterLevelUp.BoolValue = b); + VolumeDownAction = new Action((b) => micOutput.MicMasterLevelDown.BoolValue = b); + } break; } case eDmpsLevelType.Source: { Level = output.SourceLevel; - - MuteFeedback = new BoolFeedback(new Func(() => Output.SourceMuteOnFeedBack.BoolValue)); - VolumeLevelFeedback = new IntFeedback(new Func(() => Output.SourceLevelFeedBack.UShortValue)); - MuteOnAction = new Action(Output.SourceMuteOn); - MuteOffAction = new Action(Output.SourceMuteOff); - VolumeUpAction = new Action((b) => Output.SourceLevelUp.BoolValue = b); - VolumeDownAction = new Action((b) => Output.SourceLevelDown.BoolValue = b); + MuteFeedback = new BoolFeedback(new Func(() => output.SourceMuteOnFeedBack.BoolValue)); + VolumeLevelFeedback = new IntFeedback(new Func(() => output.SourceLevelFeedBack.UShortValue)); + MuteOnAction = new Action(output.SourceMuteOn); + MuteOffAction = new Action(output.SourceMuteOff); + VolumeUpAction = new Action((b) => output.SourceLevelUp.BoolValue = b); + VolumeDownAction = new Action((b) => output.SourceLevelDown.BoolValue = b); break; } case eDmpsLevelType.Codec1: { - var programOutput = output as Card.Dmps3ProgramOutput; - - if (programOutput != null) + if (output.Card is Card.Dmps3ProgramOutput) { + var programOutput = output.Card as Card.Dmps3ProgramOutput; Level = programOutput.Codec1Level; - MuteFeedback = new BoolFeedback(new Func(() => programOutput.CodecMute1OnFeedback.BoolValue)); VolumeLevelFeedback = new IntFeedback(new Func(() => programOutput.Codec1LevelFeedback.UShortValue)); MuteOnAction = new Action(programOutput.Codec1MuteOn); @@ -407,12 +423,10 @@ namespace PepperDash.Essentials.DM VolumeUpAction = new Action((b) => programOutput.Codec1LevelUp.BoolValue = b); VolumeDownAction = new Action((b) => programOutput.Codec1LevelDown.BoolValue = b); } - else + else if (output.Card is Card.Dmps3Aux2Output) { - var auxOutput = output as Card.Dmps3Aux2Output; - + var auxOutput = output.Card as Card.Dmps3Aux2Output; Level = auxOutput.Codec1Level; - MuteFeedback = new BoolFeedback(new Func(() => auxOutput.CodecMute1OnFeedback.BoolValue)); VolumeLevelFeedback = new IntFeedback(new Func(() => auxOutput.Codec1LevelFeedback.UShortValue)); MuteOnAction = new Action(auxOutput.Codec1MuteOn); @@ -424,12 +438,10 @@ namespace PepperDash.Essentials.DM } case eDmpsLevelType.Codec2: { - var programOutput = output as Card.Dmps3ProgramOutput; - - if (programOutput != null) + if (output.Card is Card.Dmps3ProgramOutput) { + var programOutput = output.Card as Card.Dmps3ProgramOutput; Level = programOutput.Codec2Level; - MuteFeedback = new BoolFeedback(new Func(() => programOutput.CodecMute1OnFeedback.BoolValue)); VolumeLevelFeedback = new IntFeedback(new Func(() => programOutput.Codec2LevelFeedback.UShortValue)); MuteOnAction = new Action(programOutput.Codec2MuteOn); @@ -437,12 +449,11 @@ namespace PepperDash.Essentials.DM VolumeUpAction = new Action((b) => programOutput.Codec2LevelUp.BoolValue = b); VolumeDownAction = new Action((b) => programOutput.Codec2LevelDown.BoolValue = b); } - else + else if (output.Card is Card.Dmps3Aux1Output) { - var auxOutput = output as Card.Dmps3Aux1Output; + var auxOutput = output.Card as Card.Dmps3Aux1Output; Level = auxOutput.Codec2Level; - MuteFeedback = new BoolFeedback(new Func(() => auxOutput.CodecMute2OnFeedback.BoolValue)); VolumeLevelFeedback = new IntFeedback(new Func(() => auxOutput.Codec2LevelFeedback.UShortValue)); MuteOnAction = new Action(auxOutput.Codec2MuteOn); @@ -463,7 +474,6 @@ namespace PepperDash.Essentials.DM public void SetVolumeScaled(ushort level) { - Debug.Console(2, Debug.ErrorLogLevel.None, "Scaling DMPS volume:{0} level:{1} min:{2} max:{3}", Output.Name, level.ToString(), MinLevel.ToString(), MaxLevel.ToString()); if (ushort.MaxValue + MinLevel != 0) { VolumeLevelInput = (ushort)(level * (MaxLevel - MinLevel) / ushort.MaxValue + MinLevel); @@ -477,7 +487,6 @@ namespace PepperDash.Essentials.DM public ushort ScaleVolumeFeedback(ushort level) { short signedLevel = (short)level; - Debug.Console(2, Debug.ErrorLogLevel.None, "Scaling DMPS volume:{0} feedback:{1} min:{2} max:{3}", Output.Name, signedLevel.ToString(), MinLevel.ToString(), MaxLevel.ToString()); if (MaxLevel - MinLevel != 0) { @@ -538,6 +547,150 @@ namespace PepperDash.Essentials.DM #endregion } + public class Dmps3AudioOutputWithMixerBase : Dmps3AudioOutputBase + { + public UShortOutputSig MinVolumeFeedback { get; private set; } + public UShortOutputSig MaxVolumeFeedback { get; private set; } + public UShortInputSig StartupVolume { get; private set; } + public UShortOutputSig StartupVolumeFeedback { get; private set; } + public UShortInputSig PresetNumber { get; private set; } + + public Action RecallPreset { get; private set; } + + public Dmps3AudioOutputWithMixerBase(Card.Dmps3OutputBase card, CrestronControlSystem.Dmps3OutputMixer mixer) + : base(card) + { + MinVolumeFeedback = mixer.MinVolumeFeedback; + MaxVolumeFeedback = mixer.MaxVolumeFeedback; + StartupVolume = mixer.StartupVolume; + StartupVolumeFeedback = mixer.StartupVolumeFeedback; + PresetNumber = mixer.PresetNumber; + + RecallPreset = new Action(mixer.RecallPreset); + } + + public Dmps3AudioOutputWithMixerBase(Card.Dmps3OutputBase card, CrestronControlSystem.Dmps3AttachableOutputMixer mixer) + : base(card) + { + MinVolumeFeedback = mixer.MinVolumeFeedback; + MaxVolumeFeedback = mixer.MaxVolumeFeedback; + StartupVolume = mixer.StartupVolume; + StartupVolumeFeedback = mixer.StartupVolumeFeedback; + PresetNumber = mixer.PresetNumber; + + RecallPreset = new Action(mixer.RecallPreset); + } + + public Dmps3AudioOutputWithMixerBase(Card.Dmps3DmHdmiAudioOutput.Dmps3AudioOutputStream stream) + : base(stream) + { + var mixer = stream.OutputMixer; + MinVolumeFeedback = mixer.MinVolumeFeedback; + MaxVolumeFeedback = mixer.MaxVolumeFeedback; + StartupVolume = mixer.StartupVolume; + StartupVolumeFeedback = mixer.StartupVolumeFeedback; + PresetNumber = stream.PresetNumber; + RecallPreset = new Action(stream.RecallPreset); + } + + public Dmps3AudioOutputWithMixerBase(Card.Dmps3DmHdmiAudioOutput.Dmps3DmHdmiOutputStream stream) + : base(stream) + { + var mixer = stream.OutputMixer; + MinVolumeFeedback = mixer.MinVolumeFeedback; + MaxVolumeFeedback = mixer.MaxVolumeFeedback; + StartupVolume = mixer.StartupVolume; + StartupVolumeFeedback = mixer.StartupVolumeFeedback; + PresetNumber = stream.PresetNumber; + RecallPreset = new Action(stream.RecallPreset); + } + } + public class Dmps3AudioOutputBase + { + public DMOutput Card { get; private set; } + public BoolOutputSig MasterMuteOffFeedBack { get; private set; } + public BoolOutputSig MasterMuteOnFeedBack { get; private set; } + public UShortInputSig MasterVolume { get; private set; } + public UShortOutputSig MasterVolumeFeedBack { get; private set; } + public BoolInputSig MasterVolumeUp { get; private set; } + public BoolInputSig MasterVolumeDown { get; private set; } + public BoolOutputSig SourceMuteOffFeedBack { get; private set; } + public BoolOutputSig SourceMuteOnFeedBack { get; private set; } + public UShortInputSig SourceLevel { get; private set; } + public UShortOutputSig SourceLevelFeedBack { get; private set; } + public BoolInputSig SourceLevelUp { get; private set; } + public BoolInputSig SourceLevelDown { get; private set; } + + public Action MasterMuteOff { get; private set; } + public Action MasterMuteOn { get; private set; } + public Action SourceMuteOff { get; private set; } + public Action SourceMuteOn { get; private set; } + + public Dmps3AudioOutputBase(Card.Dmps3OutputBase card) + { + Card = card; + MasterMuteOffFeedBack = card.MasterMuteOffFeedBack; + MasterMuteOnFeedBack = card.MasterMuteOnFeedBack; + MasterVolume = card.MasterVolume; + MasterVolumeFeedBack = card.MasterVolumeFeedBack; + MasterVolumeUp = card.MasterVolumeUp; + MasterVolumeDown = card.MasterVolumeDown; + SourceMuteOffFeedBack = card.SourceMuteOffFeedBack; + SourceMuteOnFeedBack = card.SourceMuteOnFeedBack; + SourceLevel = card.SourceLevel; + SourceLevelFeedBack = card.SourceLevelFeedBack; + SourceLevelUp = card.SourceLevelUp; + SourceLevelDown = card.SourceLevelDown; + + MasterMuteOff = new Action(card.MasterMuteOff); + MasterMuteOn = new Action(card.MasterMuteOn); + SourceMuteOff = new Action(card.SourceMuteOff); + SourceMuteOn = new Action(card.SourceMuteOn); + } + + public Dmps3AudioOutputBase(Card.Dmps3DmHdmiAudioOutput.Dmps3AudioOutputStream stream) + { + MasterMuteOffFeedBack = stream.MasterMuteOffFeedBack; + MasterMuteOnFeedBack = stream.MasterMuteOnFeedBack; + MasterVolume = stream.MasterVolume; + MasterVolumeFeedBack = stream.MasterVolumeFeedBack; + MasterVolumeUp = stream.MasterVolumeUp; + MasterVolumeDown = stream.MasterVolumeDown; + SourceMuteOffFeedBack = stream.SourceMuteOffFeedBack; + SourceMuteOnFeedBack = stream.SourceMuteOnFeedBack; + SourceLevel = stream.SourceLevel; + SourceLevelFeedBack = stream.SourceLevelFeedBack; + SourceLevelUp = stream.SourceLevelUp; + SourceLevelDown = stream.SourceLevelDown; + + MasterMuteOff = new Action(stream.MasterMuteOff); + MasterMuteOn = new Action(stream.MasterMuteOn); + SourceMuteOff = new Action(stream.SourceMuteOff); + SourceMuteOn = new Action(stream.SourceMuteOn); + } + + public Dmps3AudioOutputBase(Card.Dmps3DmHdmiAudioOutput.Dmps3DmHdmiOutputStream stream) + { + MasterMuteOffFeedBack = stream.MasterMuteOffFeedBack; + MasterMuteOnFeedBack = stream.MasterMuteOnFeedBack; + MasterVolume = stream.MasterVolume; + MasterVolumeFeedBack = stream.MasterVolumeFeedBack; + MasterVolumeUp = stream.MasterVolumeUp; + MasterVolumeDown = stream.MasterVolumeDown; + SourceMuteOffFeedBack = stream.SourceMuteOffFeedBack; + SourceMuteOnFeedBack = stream.SourceMuteOnFeedBack; + SourceLevel = stream.SourceLevel; + SourceLevelFeedBack = stream.SourceLevelFeedBack; + SourceLevelUp = stream.SourceLevelUp; + SourceLevelDown = stream.SourceLevelDown; + + MasterMuteOff = new Action(stream.MasterMuteOff); + MasterMuteOn = new Action(stream.MasterMuteOn); + SourceMuteOff = new Action(stream.SourceMuteOff); + SourceMuteOn = new Action(stream.SourceMuteOn); + } + } + public enum eDmpsLevelType { Master, diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsDigitalOutputController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsDigitalOutputController.cs index 49b5c1c5..70465783 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsDigitalOutputController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsDigitalOutputController.cs @@ -15,7 +15,7 @@ namespace PepperDash.Essentials.DM /// /// /// - public class DmpsDigitalOutputController : Device, IRoutingNumericWithFeedback, IHasFeedback + public class DmpsDigitalOutputController : Device, IRoutingNumeric, IHasFeedback { public Card.Dmps3OutputBase OutputCard { get; protected set; } @@ -161,11 +161,5 @@ namespace PepperDash.Essentials.DM } #endregion - - #region IRoutingFeedback Members - - public event EventHandler NumericSwitchChange; - - #endregion } } \ No newline at end of file diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 55c49a96..074880e6 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -418,17 +418,11 @@ namespace PepperDash.Essentials.DM private void LinkInputsToApi(BasicTriList trilist, DmpsRoutingControllerJoinMap joinMap) { - if (Global.ControlSystemIsDmps4kType) + if (Global.ControlSystemIsDmps4k3xxType) { - //DMPS-4K audio inputs 1-5 are aux inputs, add them after regular dm cards - for (ushort i = 1; i <= 5; i++) - { - trilist.StringInput[joinMap.InputAudioNames.JoinNumber + i - 1 + (ushort)Dmps.SwitcherInputs.Count].StringValue = String.Format("Aux Input {0}", i); - } - //Add DMPS-4K mixer input names to end of inputs - trilist.StringInput[joinMap.InputAudioNames.JoinNumber + (uint)Dmps.SwitcherInputs.Count + 5].StringValue = "Digital Mixer 1"; - trilist.StringInput[joinMap.InputAudioNames.JoinNumber + (uint)Dmps.SwitcherInputs.Count + 6].StringValue = "Digital Mixer 2"; + trilist.StringInput[joinMap.InputAudioNames.JoinNumber + (uint)Dmps.SwitcherInputs.Count + 4].StringValue = "Digital Mixer 1"; + trilist.StringInput[joinMap.InputAudioNames.JoinNumber + (uint)Dmps.SwitcherInputs.Count + 5].StringValue = "Digital Mixer 2"; } for (uint i = 1; i <= Dmps.SwitcherInputs.Count; i++) { @@ -445,9 +439,19 @@ namespace PepperDash.Essentials.DM if (InputNameFeedbacks.ContainsKey(ioSlot) && InputNameFeedbacks[ioSlot] != null) { - InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]); - InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputVideoNames.JoinNumber + ioSlotJoin]); - InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputAudioNames.JoinNumber + ioSlotJoin]); + if (Dmps.SwitcherInputs[ioSlot] is Card.Dmps3AnalogAudioInput) + { + for (uint j = ioSlot; j < ioSlot + 5; j++) + { + InputNameFeedbacks[j].LinkInputSig(trilist.StringInput[joinMap.InputAudioNames.JoinNumber + j - 1]); + } + } + else + { + InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputNames.JoinNumber + ioSlotJoin]); + InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputVideoNames.JoinNumber + ioSlotJoin]); + InputNameFeedbacks[ioSlot].LinkInputSig(trilist.StringInput[joinMap.InputAudioNames.JoinNumber + ioSlotJoin]); + } } trilist.SetStringSigAction(joinMap.InputNames.JoinNumber + ioSlotJoin, s => @@ -509,7 +513,7 @@ namespace PepperDash.Essentials.DM }); AudioOutputFeedbacks[outputCard.Number] = new IntFeedback(() => { - if (!Global.ControlSystemIsDmps4kType) + if (!Global.ControlSystemIsDmps4k3xxType) { if (outputCard.AudioOutFeedback != null) { @@ -526,9 +530,9 @@ namespace PepperDash.Essentials.DM if (DigitalAudioOutputs[outputCard.Number].AudioSourceNumericFeedback.UShortValue == 0) return 0; else if (DigitalAudioOutputs[outputCard.Number].AudioSourceNumericFeedback.UShortValue == 1) - return (ushort)Dmps.SwitcherInputs.Count + 6; + return (ushort)Dmps.SwitcherInputs.Count + 5; else if (DigitalAudioOutputs[outputCard.Number].AudioSourceNumericFeedback.UShortValue == 2) - return (ushort)Dmps.SwitcherInputs.Count + 7; + return (ushort)Dmps.SwitcherInputs.Count + 6; else if (DigitalAudioOutputs[outputCard.Number].AudioSourceNumericFeedback.UShortValue == 3) return (ushort)outputCard.VideoOutFeedback.Number; else @@ -552,7 +556,7 @@ namespace PepperDash.Essentials.DM else if ((ushort)outputCard.AudioOutSourceFeedback <= 5) { //Move analog inputs to after regular dm cards - return (ushort)outputCard.AudioOutSourceFeedback + (ushort)Dmps.SwitcherInputs.Count; + return (ushort)outputCard.AudioOutSourceFeedback + (ushort)Dmps.SwitcherInputs.Count - 1; } else { @@ -586,7 +590,7 @@ namespace PepperDash.Essentials.DM }); OutputAudioRouteNameFeedbacks[outputCard.Number] = new StringFeedback(() => { - if (!Global.ControlSystemIsDmps4kType) + if (!Global.ControlSystemIsDmps4k3xxType) { if (outputCard.AudioOutFeedback != null && outputCard.AudioOutFeedback.NameFeedback != null) { @@ -692,7 +696,6 @@ namespace PepperDash.Essentials.DM else if (inputCard is Card.Dmps3HdmiInput) { var hdmiInputCard = inputCard as Card.Dmps3HdmiInput; - var cecPort = hdmiInputCard.HdmiInputPort; AddInputPortWithDebug(number, string.Format("HdmiIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Hdmi, cecPort); @@ -724,17 +727,37 @@ namespace PepperDash.Essentials.DM else if (inputCard is Card.Dmps3DmInput) { var hdmiInputCard = inputCard as Card.Dmps3DmInput; - var cecPort = hdmiInputCard.DmInputPort; AddInputPortWithDebug(number, string.Format("DmIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.DmCat, cecPort); } + else if (inputCard is Card.Dmps3VgaInput) + { + AddInputPortWithDebug(number, string.Format("VgaIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Vga); + } else if (inputCard is Card.Dmps3AirMediaInput) { - var airMediaInputCard = inputCard as Card.Dmps3AirMediaInput; - AddInputPortWithDebug(number, string.Format("AirMediaIn{0}", number), eRoutingSignalType.Audio | eRoutingSignalType.Video, eRoutingPortConnectionType.Streaming); } + else if (inputCard is Card.Dmps3AnalogAudioInput) + { + for (uint i = 0; i <= 4; i++) + { + uint j = i + 1; + uint input = i + number; + InputNameFeedbacks[input] = new StringFeedback(() => + { + if (InputNames.ContainsKey(input)) + { + return InputNames[input]; + } + else + { + return String.Format("Aux Input {0}", j); + } + }); + } + } } @@ -796,7 +819,6 @@ namespace PepperDash.Essentials.DM else if (outputCard is Card.Dmps3DmOutput) { AddDmOutputPort(number); - var audioOutput = new DmpsAudioOutputController(string.Format("processor-digitalAudioOutput{0}", number), string.Format("Dm Audio Output {0}", number), outputCard as Card.Dmps3DmOutput); DeviceManager.AddDevice(audioOutput); } @@ -807,6 +829,19 @@ namespace PepperDash.Essentials.DM DigitalAudioOutputs.Add(number, audioOutput); DeviceManager.AddDevice(audioOutput); } + else if (outputCard is Card.Dmps3DmHdmiAudioOutput) + { + var hdmiOutputCard = outputCard as Card.Dmps3DmHdmiAudioOutput; + var cecPort = hdmiOutputCard.HdmiOutputPort; + AddHdmiOutputPort(number, cecPort); + AddDmOutputPort(number); + AddAudioOnlyOutputPort(number, "Program"); + + var audioOutput = new DmpsAudioOutputController(string.Format("processor-programAudioOutput", number), string.Format("Program Audio Output {0}", number), hdmiOutputCard, hdmiOutputCard.AudioOutputStream); + DeviceManager.AddDevice(audioOutput); + var digitalAudioOutput = new DmpsAudioOutputController(string.Format("processor-digitalAudioOutput{0}", number), string.Format("Hdmi Audio Output {0}", number), hdmiOutputCard, hdmiOutputCard.DmHdmiOutputStream); + DeviceManager.AddDevice(digitalAudioOutput); + } else if (outputCard is Card.Dmps3ProgramOutput) { AddAudioOnlyOutputPort(number, "Program"); @@ -1041,7 +1076,7 @@ namespace PepperDash.Essentials.DM } else if (args.EventId == DMOutputEventIds.AudioOutEventId) { - if (!Global.ControlSystemIsDmps4kType) + if (!Global.ControlSystemIsDmps4k3xxType) { if (outputCard != null && outputCard.AudioOutFeedback != null) { @@ -1180,7 +1215,7 @@ namespace PepperDash.Essentials.DM if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio) { - if(!Global.ControlSystemIsDmps4kType) + if (!Global.ControlSystemIsDmps4k3xxType) { output.AudioOut = input; } @@ -1198,7 +1233,7 @@ namespace PepperDash.Essentials.DM else if (Dmps.SystemControl.SystemControlType == eSystemControlType.Dmps34K350CSystemControl) output.AudioOutSource = eDmps34KAudioOutSource.AirMedia9; } - else if (input.Number <= Dmps.SwitcherInputs.Count) + else if (input.Number < Dmps.SwitcherInputs.Count) { //Shift video inputs by 5 for weird DMPS3-4K indexing output.AudioOutSource = (eDmps34KAudioOutSource)(input.Number + 5); @@ -1206,7 +1241,7 @@ namespace PepperDash.Essentials.DM else { //Shift analog inputs back to inputs 1-5 - output.AudioOutSource = (eDmps34KAudioOutSource)(input.Number - Dmps.SwitcherInputs.Count); + output.AudioOutSource = (eDmps34KAudioOutSource)(input.Number - Dmps.SwitcherInputs.Count + 1); } } } @@ -1261,7 +1296,7 @@ namespace PepperDash.Essentials.DM else if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio) { //Special case for DMPS-4K digital audio output - if (Global.ControlSystemIsDmps4kType) + if (Global.ControlSystemIsDmps4k3xxType) { if (DigitalAudioOutputs.ContainsKey(outputSelector)) { @@ -1269,37 +1304,37 @@ namespace PepperDash.Essentials.DM { DigitalAudioOutputs[outputSelector].ExecuteNumericSwitch(0, 0, eRoutingSignalType.Audio); } - else if (inputSelector <= Dmps.SwitcherInputs.Count) //DMPS-4K video inputs, set to audio follows video + else if (inputSelector < Dmps.SwitcherInputs.Count) //DMPS-4K video inputs, set to audio follows video { DigitalAudioOutputs[outputSelector].ExecuteNumericSwitch(3, 0, eRoutingSignalType.Audio); //Force video route since it is now set so audio follows video ExecuteNumericSwitch(inputSelector, outputSelector, eRoutingSignalType.Video); } - else if (inputSelector == Dmps.SwitcherInputs.Count + 6) + else if (inputSelector == Dmps.SwitcherInputs.Count + 5) { //Set to mix 1 DigitalAudioOutputs[outputSelector].ExecuteNumericSwitch(1, 0, eRoutingSignalType.Audio); } - else if (inputSelector == Dmps.SwitcherInputs.Count + 7) + else if (inputSelector == Dmps.SwitcherInputs.Count + 6) { //Set to mix 2 DigitalAudioOutputs[outputSelector].ExecuteNumericSwitch(2, 0, eRoutingSignalType.Audio); } } - else if (inputSelector <= (Dmps.SwitcherInputs.Count + 5) && outputSelector <= Dmps.SwitcherOutputs.Count) + else if (inputSelector <= (Dmps.SwitcherInputs.Count + 4) && outputSelector <= Dmps.SwitcherOutputs.Count) { var output = Dmps.SwitcherOutputs[outputSelector] as DMOutput; if (inputSelector == 0) { output.AudioOutSource = eDmps34KAudioOutSource.NoRoute; } - else if(inputSelector > Dmps.SwitcherInputs.Count) + else if(inputSelector >= (Dmps.SwitcherInputs.Count)) { //Shift analog inputs back to inputs 1-5 - Debug.Console(1, this, "Attempting analog route input {0} to output {1}", inputSelector - Dmps.SwitcherInputs.Count, outputSelector); - output.AudioOutSource = (eDmps34KAudioOutSource)(inputSelector - Dmps.SwitcherInputs.Count); + Debug.Console(1, this, "Attempting analog route input {0} to output {1}", inputSelector - Dmps.SwitcherInputs.Count + 1, outputSelector); + output.AudioOutSource = (eDmps34KAudioOutSource)(inputSelector - Dmps.SwitcherInputs.Count + 1); } - else if (inputSelector <= Dmps.SwitcherInputs.Count) + else if (inputSelector < Dmps.SwitcherInputs.Count) { var input = Dmps.SwitcherInputs[inputSelector] as DMInput; if (input.CardInputOutputType == eCardInputOutputType.Dmps3AirMediaInput || input.CardInputOutputType == eCardInputOutputType.Dmps3AirMediaNoStreamingInput)