diff --git a/PepperDashEssentials/Audio/EssentialsVolumeLevelConfig.cs b/PepperDashEssentials/Audio/EssentialsVolumeLevelConfig.cs index 12108564..d8af5a55 100644 --- a/PepperDashEssentials/Audio/EssentialsVolumeLevelConfig.cs +++ b/PepperDashEssentials/Audio/EssentialsVolumeLevelConfig.cs @@ -55,7 +55,7 @@ namespace PepperDash.Essentials return null; } - // DSP format: deviceKey--levelName, biampTesira-1--master + // DSP/DMPS format: deviceKey--levelName, biampTesira-1--master match = Regex.Match(DeviceKey, @"([-_\w]+)--(.+)"); if (match.Success) { @@ -67,6 +67,27 @@ namespace PepperDash.Essentials if (dsp.LevelControlPoints.ContainsKey(levelTag)) // should always... return dsp.LevelControlPoints[levelTag]; } + + var dmps = DeviceManager.GetDeviceForKey(devKey) as DmpsAudioOutputController; + if (dmps != null) + { + var levelTag = match.Groups[2].Value; + switch (levelTag) + { + case "master": + return dmps.MasterVolumeLevel; + case "source": + return dmps.SourceVolumeLevel; + case "micsmaster": + return dmps.MicsMasterVolumeLevel; + case "codec1": + return dmps.Codec1VolumeLevel; + case "codec2": + return dmps.Codec2VolumeLevel; + default: + return dmps.MasterVolumeLevel; + } + } // No volume for some reason. We have failed as developers return null; } diff --git a/PepperDashEssentials/ControlSystem.cs b/PepperDashEssentials/ControlSystem.cs index e40cce4e..8f3be4e1 100644 --- a/PepperDashEssentials/ControlSystem.cs +++ b/PepperDashEssentials/ControlSystem.cs @@ -47,28 +47,29 @@ namespace PepperDash.Essentials /// public override void InitializeSystem() { - _startTimer = new CTimer(StartSystem,StartupTime); - - // If the control system is a DMPS type, we need to wait to exit this method until all devices have had time to activate // to allow any HD-BaseT DM endpoints to register first. - if (Global.ControlSystemIsDmpsType) + bool preventInitializationComplete = Global.ControlSystemIsDmpsType; + if (preventInitializationComplete) { Debug.Console(1, "******************* InitializeSystem() Entering **********************"); - - _initializeEvent = new CEvent(); - + _startTimer = new CTimer(StartSystem, preventInitializationComplete, StartupTime); + _initializeEvent = new CEvent(true, false); DeviceManager.AllDevicesRegistered += (o, a) => { _initializeEvent.Set(); - Debug.Console(1, "******************* InitializeSystem() Exiting **********************"); }; - _initializeEvent.Wait(30000); + Debug.Console(1, "******************* InitializeSystem() Exiting **********************"); + SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true; + } + else + { + _startTimer = new CTimer(StartSystem, preventInitializationComplete, StartupTime); } } - private void StartSystem(object obj) + private void StartSystem(object preventInitialization) { DeterminePlatform(); @@ -125,7 +126,10 @@ namespace PepperDash.Essentials return; } - SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true; + if (!(bool)preventInitialization) + { + SystemMonitor.ProgramInitialization.ProgramInitializationComplete = true; + } } /// diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs index ec3553a1..bfea158e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmHdBaseTEndpointController.cs @@ -28,6 +28,8 @@ namespace PepperDash.Essentials.DM InputPorts = new RoutingPortCollection {DmIn}; OutputPorts = new RoutingPortCollection {HDBaseTSink}; + PreventRegistration = true; + rmc.Register(); } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs index 529f740a..d92d9620 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmc4k100C1GController.cs @@ -32,7 +32,9 @@ namespace PepperDash.Essentials.DM eRoutingPortConnectionType.Hdmi, null, this) {Port = _rmc}; InputPorts = new RoutingPortCollection {DmIn}; - OutputPorts = new RoutingPortCollection {HdmiOut}; + OutputPorts = new RoutingPortCollection {HdmiOut}; + PreventRegistration = true; + rmc.Register(); } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs index 5d644a2a..e237c3a5 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Receivers/DmRmcHelper.cs @@ -329,6 +329,9 @@ namespace PepperDash.Essentials.DM DmRmcPropertiesConfig props, string pKey, uint ipid) { var parentDev = DeviceManager.GetDeviceForKey(pKey); + CrestronGenericBaseDevice rx; + bool useChassisForOfflineFeedback = false; + if (parentDev is DmpsRoutingController) { var dmps = parentDev as DmpsRoutingController; @@ -342,22 +345,33 @@ namespace PepperDash.Essentials.DM return null; } // Must use different constructor for DMPS4K types. No IPID - if (Global.ControlSystemIsDmps4kType || typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g") + if (Global.ControlSystemIsDmps4kType) { - var rmc = GetDmRmcControllerForDmps4k(key, name, typeName, dmps, props.ParentOutputNumber); - Debug.Console(0, "DM endpoint output {0} is for Dmps4k, changing online feedback to chassis", num); - rmc.IsOnline.SetValueFunc(() => dmps.OutputEndpointOnlineFeedbacks[num].BoolValue); + rx = GetDmRmcControllerForDmps4k(key, name, typeName, dmps, props.ParentOutputNumber); + useChassisForOfflineFeedback = true; + } + else + { + rx = GetDmRmcControllerForDmps(key, name, typeName, ipid, dmps, props.ParentOutputNumber); + if (typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g") + { + useChassisForOfflineFeedback = true; + } + } + if (useChassisForOfflineFeedback) + { + Debug.Console(0, "DM endpoint output {0} does not have direct online feedback, changing online feedback to chassis", num); + rx.IsOnline.SetValueFunc(() => dmps.OutputEndpointOnlineFeedbacks[num].BoolValue); dmps.OutputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => { - foreach (var feedback in rmc.Feedbacks) + foreach (var feedback in rx.Feedbacks) { if (feedback != null) feedback.FireUpdate(); } }; - return rmc; } - return GetDmRmcControllerForDmps(key, name, typeName, ipid, dmps, props.ParentOutputNumber); + return rx; } else if (parentDev is DmChassisController) { @@ -380,23 +394,33 @@ namespace PepperDash.Essentials.DM if (chassis is DmMd8x8Cpu3 || chassis is DmMd16x16Cpu3 || chassis is DmMd32x32Cpu3 || chassis is DmMd8x8Cpu3rps || chassis is DmMd16x16Cpu3rps || chassis is DmMd32x32Cpu3rps || - chassis is DmMd128x128 || chassis is DmMd64x64 - || typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g") + chassis is DmMd128x128 || chassis is DmMd64x64) { - var rmc = GetDmRmcControllerForCpu3Chassis(key, name, typeName, chassis, num, parentDev); - Debug.Console(0, "DM endpoint output {0} is for Cpu3, changing online feedback to chassis", num); - rmc.IsOnline.SetValueFunc(() => controller.OutputEndpointOnlineFeedbacks[num].BoolValue); - controller.OutputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => - { - foreach (var feedback in rmc.Feedbacks) - { - if (feedback != null) - feedback.FireUpdate(); - } - }; - return rmc; + rx = GetDmRmcControllerForCpu3Chassis(key, name, typeName, chassis, num, parentDev); + useChassisForOfflineFeedback = true; } - return GetDmRmcControllerForCpu2Chassis(key, name, typeName, ipid, chassis, num, parentDev); + else + { + rx = GetDmRmcControllerForCpu2Chassis(key, name, typeName, ipid, chassis, num, parentDev); + if (typeName == "hdbasetrx" || typeName == "dmrmc4k100c1g") + { + useChassisForOfflineFeedback = true; + } + } + if (useChassisForOfflineFeedback) + { + Debug.Console(0, "DM endpoint output {0} does not have direct online feedback, changing online feedback to chassis", num); + rx.IsOnline.SetValueFunc(() => controller.OutputEndpointOnlineFeedbacks[num].BoolValue); + controller.OutputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => + { + foreach (var feedback in rx.Feedbacks) + { + if (feedback != null) + feedback.FireUpdate(); + } + }; + } + return rx; } catch (Exception e) { @@ -499,9 +523,7 @@ namespace PepperDash.Essentials.DM Debug.Console(0, "[{0}] WARNING: Cannot create DM-RMC device: {1}", key, e.Message); return null; } - } - - + } } public class DmRmcControllerFactory : EssentialsDeviceFactory diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs index 5bbf5fd5..3c7ffffa 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4k100Controller.cs @@ -78,6 +78,8 @@ namespace PepperDash.Essentials.DM IsOnline.SetValueFunc(() => controller.InputEndpointOnlineFeedbacks[num].BoolValue); controller.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate(); } + PreventRegistration = true; + tx.Register(); } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs index c1a5cec7..bb7d9e3d 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTx4kz100Controller.cs @@ -72,6 +72,7 @@ namespace PepperDash.Essentials.DM HdmiIn.Port = Tx; PreventRegistration = true; + tx.Register(); } public override void LinkToApi(BasicTriList trilist, uint joinStart, string joinMapKey, EiscApiAdvanced bridge) diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs index d707ebd3..86160ced 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/DmTxHelpers.cs @@ -126,6 +126,7 @@ namespace PepperDash.Essentials.DM var parentDev = DeviceManager.GetDeviceForKey(pKey); DMInput dmInput; BasicDmTxControllerBase tx; + bool useChassisForOfflineFeedback = false; if (parentDev is DmChassisController) { @@ -155,15 +156,23 @@ namespace PepperDash.Essentials.DM chassis is DmMd128x128 || chassis is DmMd64x64) { tx = GetDmTxForChassisWithoutIpId(key, name, typeName, dmInput); - Debug.Console(0, "DM endpoint output {0} is for Cpu3, changing online feedback to chassis", num); - tx.IsOnline.SetValueFunc(() => switchDev.InputEndpointOnlineFeedbacks[num].BoolValue); - switchDev.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => tx.IsOnline.FireUpdate(); - return tx; + useChassisForOfflineFeedback = true; } else { - return GetDmTxForChassisWithIpId(key, name, typeName, ipid, dmInput); + tx = GetDmTxForChassisWithIpId(key, name, typeName, ipid, dmInput); + if (typeName == "hdbasettx" || typeName == "dmtx4k100c1g") + { + useChassisForOfflineFeedback = true; + } } + if (useChassisForOfflineFeedback) + { + Debug.Console(0, "DM endpoint output {0} does not have direct online feedback, changing online feedback to chassis", num); + tx.IsOnline.SetValueFunc(() => switchDev.InputEndpointOnlineFeedbacks[num].BoolValue); + switchDev.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => tx.IsOnline.FireUpdate(); + } + return tx; } catch (Exception e) { @@ -203,15 +212,23 @@ namespace PepperDash.Essentials.DM if(Global.ControlSystemIsDmps4kType) { tx = GetDmTxForChassisWithoutIpId(key, name, typeName, dmInput); - Debug.Console(0, "DM endpoint output {0} is for DMPS3-4K, changing online feedback to chassis", num); - tx.IsOnline.SetValueFunc(() => dmpsDev.InputEndpointOnlineFeedbacks[num].BoolValue); - dmpsDev.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => tx.IsOnline.FireUpdate(); - return tx; + useChassisForOfflineFeedback = true; } else { - return GetDmTxForChassisWithIpId(key, name, typeName, ipid, dmInput); + tx = GetDmTxForChassisWithIpId(key, name, typeName, ipid, dmInput); + if (typeName == "hdbasettx" || typeName == "dmtx4k100c1g") + { + useChassisForOfflineFeedback = true; + } } + if (useChassisForOfflineFeedback) + { + Debug.Console(0, "DM endpoint output {0} does not have direct online feedback, changing online feedback to chassis", num); + tx.IsOnline.SetValueFunc(() => dmpsDev.InputEndpointOnlineFeedbacks[num].BoolValue); + dmpsDev.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => tx.IsOnline.FireUpdate(); + } + return tx; } catch (Exception e) { diff --git a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/HDBaseTTxController.cs b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/HDBaseTTxController.cs index bedf1aad..a40ee68b 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/HDBaseTTxController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Endpoints/Transmitters/HDBaseTTxController.cs @@ -52,6 +52,9 @@ namespace PepperDash.Essentials.DM IsOnline.SetValueFunc(() => controller.InputEndpointOnlineFeedbacks[num].BoolValue); controller.InputEndpointOnlineFeedbacks[num].OutputChange += (o, a) => IsOnline.FireUpdate(); } + + PreventRegistration = true; + tx.Register(); } #region IRoutingInputs Members