diff --git a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs index 06d9d7b6..051ef88e 100644 --- a/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs +++ b/essentials-framework/Essentials DM/Essentials_DM/Chassis/DmpsRoutingController.cs @@ -818,74 +818,94 @@ namespace PepperDash.Essentials.DM Debug.Console(2, this, "Attempting a DM route from input {0} to output {1} {2}", inputSelector, outputSelector, sigType); var input = Convert.ToUInt32(inputSelector); // Cast can sometimes fail - var output = Convert.ToUInt32(outputSelector); - - if (input <= Dmps.NumberOfSwitcherInputs && output <= Dmps.NumberOfSwitcherOutputs) - { - // Check to see if there's an off timer waiting on this and if so, cancel - var key = new PortNumberType(output, sigType); - if (input == 0) - { - StartOffTimer(key); - } - else if (key.Number > 0) - { - if (RouteOffTimers.ContainsKey(key)) - { - Debug.Console(2, this, "{0} cancelling route off due to new source", output); - RouteOffTimers[key].Stop(); - RouteOffTimers.Remove(key); - } - } - - DMInput dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput; + var output = Convert.ToUInt32(outputSelector); + + var sigTypeIsUsbOrVideo = ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video) || + ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) || + ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput); + + if ((input <= Dmps.NumberOfSwitcherInputs && output <= Dmps.NumberOfSwitcherOutputs && + sigTypeIsUsbOrVideo) || + (input <= Dmps.NumberOfSwitcherInputs + 5 && output <= Dmps.NumberOfSwitcherOutputs && + (sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio)) + { + // Check to see if there's an off timer waiting on this and if so, cancel + var key = new PortNumberType(output, sigType); + if (input == 0) + { + StartOffTimer(key); + } + else if (key.Number > 0) + { + if (RouteOffTimers.ContainsKey(key)) + { + Debug.Console(2, this, "{0} cancelling route off due to new source", output); + RouteOffTimers[key].Stop(); + RouteOffTimers.Remove(key); + } + } + + DMOutput dmOutputCard = output == 0 ? null : Dmps.SwitcherOutputs[output] as DMOutput; - //if (inCard != null) - //{ - // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES - if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video) - { - //SystemControl.VideoEnter.BoolValue = true; - if (dmOutputCard != null) - dmOutputCard.VideoOut = dmInputCard; - } - - if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio) - { - if (dmOutputCard != null) - try - { - dmOutputCard.AudioOut = dmInputCard; - } - catch (NotSupportedException) - { - dmOutputCard.AudioOutSource = (eDmps34KAudioOutSource) input; - } - } - - if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) - { - if (dmOutputCard != null) - dmOutputCard.USBRoutedTo = dmInputCard; - } - - if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) - { - if (dmInputCard != null) - dmInputCard.USBRoutedTo = dmOutputCard; - } - //} - //else - //{ - // Debug.Console(1, this, "Unable to execute route from input {0} to output {1}. Input card not available", inputSelector, outputSelector); - //} - - } - else - { - Debug.Console(1, this, "Unable to execute route from input {0} to output {1}", inputSelector, outputSelector); - } + //if (inCard != null) + //{ + // NOTE THAT BITWISE COMPARISONS - TO CATCH ALL ROUTING TYPES + if ((sigType & eRoutingSignalType.Video) == eRoutingSignalType.Video) + { + DMInput dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput; + //SystemControl.VideoEnter.BoolValue = true; + if (dmOutputCard != null) + dmOutputCard.VideoOut = dmInputCard; + } + + if ((sigType & eRoutingSignalType.Audio) == eRoutingSignalType.Audio) + { + DMInput dmInputCard = null; + if (input <= Dmps.NumberOfSwitcherInputs) + { + dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput; + } + + if (dmOutputCard != null) + try + { + dmOutputCard.AudioOut = dmInputCard; + } + catch (NotSupportedException) + { + Debug.Console(1, this, "Routing input {0} audio to output {1}", + (eDmps34KAudioOutSource) input, (CrestronControlSystem.eDmps34K350COutputs) output); + + dmOutputCard.AudioOutSource = (eDmps34KAudioOutSource) input; + } + } + + if ((sigType & eRoutingSignalType.UsbOutput) == eRoutingSignalType.UsbOutput) + { + DMInput dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput; + if (dmOutputCard != null) + dmOutputCard.USBRoutedTo = dmInputCard; + } + + if ((sigType & eRoutingSignalType.UsbInput) == eRoutingSignalType.UsbInput) + { + DMInput dmInputCard = input == 0 ? null : Dmps.SwitcherInputs[input] as DMInput; + if (dmInputCard != null) + dmInputCard.USBRoutedTo = dmOutputCard; + } + //} + //else + //{ + // Debug.Console(1, this, "Unable to execute route from input {0} to output {1}. Input card not available", inputSelector, outputSelector); + //} + + } + else + { + Debug.Console(1, this, "Unable to execute route from input {0} to output {1}", inputSelector, + outputSelector); + } } catch (Exception e) {