public void TestTally() { AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.All, helper => { List <VideoSource> inputIds = helper.Helper.BuildLibState().Settings.Inputs .Where(i => i.Value.Properties.InternalPortType == InternalPortType.External).Select(i => i.Key) .ToList(); TallyBySourceCommand tallyCmd = helper.Server.GetParsedDataDump().OfType <TallyBySourceCommand>().Single(); foreach (VideoSource id in Randomiser.SelectionOfGroup(inputIds)) { AtemState stateBefore = helper.Helper.BuildLibState(); InputState.TallyState tallyState = stateBefore.Settings.Inputs[id].Tally; for (int i = 0; i < 5; i++) { bool isProgram = tallyState.ProgramTally = Randomiser.RangeInt(10) > 5; bool isPreview = tallyState.PreviewTally = Randomiser.RangeInt(10) > 5; tallyCmd.Tally[id] = Tuple.Create(isProgram, isPreview); helper.SendFromServerAndWaitForChange(stateBefore, tallyCmd); } } }); }
/// <summary> /// Capture any input that is active on program/preview /// </summary> /// <param name="tallyBySourceCommand"></param> private void OnTally(TallyBySourceCommand tallyBySourceCommand) { if (AtemSettings.Tally == false) { return; } foreach (var source in tallyBySourceCommand.Tally) { var input = AtemStatus.Inputs.FirstOrDefault(c => c.Id == source.Key.ToString()); if (input == null) { return; } input.Program = source.Value.Item1; input.Preview = source.Value.Item2; Log.LogTrace("OnTally {name},{program},{preview}", input.LongName, input.Program, input.Preview); } }