public void TestSwapProgramPreview() { var handler = CommandGenerator.CreateAutoCommandHandler <MultiviewPropertiesSetV8Command, MultiviewPropertiesGetV8Command>("ProgramPreviewSwapped"); AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.MultiviewSwapProgramPreview, helper => { foreach (Tuple <uint, IBMDSwitcherMultiView> mv in GetMultiviewers(helper)) { mv.Item2.SupportsProgramPreviewSwap(out int supportsSwap); Assert.Equal(1, supportsSwap); AtemState stateBefore = helper.Helper.BuildLibState(); MultiViewerState mvState = stateBefore.Settings.MultiViewers[(int)mv.Item1]; for (int i = 0; i < 5; i++) { bool newValue = i % 2 != 0; mvState.Properties.ProgramPreviewSwapped = newValue; /* * bool tmp = mvState.Windows[0].SupportsVuMeter; * mvState.Windows[0].SupportsVuMeter = mvState.Windows[1].SupportsVuMeter; * mvState.Windows[1].SupportsVuMeter = tmp; */ // mvState.Windows[0] helper.SendAndWaitForChange(stateBefore, () => { mv.Item2.SetProgramPreviewSwapped(newValue ? 1 : 0); }); } } }); }
private static Tuple <InfoState.MultiViewInfoState, MultiViewerState> BuildOne(IBMDSwitcherMultiView props) { var state = new MultiViewerState(); var info = new InfoState.MultiViewInfoState(); props.SupportsVuMeters(out int supportsVu); info.SupportsVuMeters = supportsVu != 0; props.SupportsProgramPreviewSwap(out int supportsSwap); info.SupportsProgramPreviewSwapped = supportsSwap != 0; props.SupportsQuadrantLayout(out int supportsQuadrants); info.SupportsQuadrantLayout = supportsQuadrants != 0; props.CanToggleSafeAreaEnabled(out int supportsToggleSafeArea); info.SupportsToggleSafeArea = supportsToggleSafeArea != 0; props.CanRouteInputs(out int canRoute); info.CanRouteInputs = canRoute != 0; #if !ATEM_v8_1 props.CanChangeLayout(out int canChangeLayout); info.CanChangeLayout = canChangeLayout != 0; props.CanAdjustVuMeterOpacity(out int canChangeVuOpacity); info.CanChangeVuMeterOpacity = canChangeVuOpacity != 0; #endif props.GetLayout(out _BMDSwitcherMultiViewLayout layout); state.Properties.Layout = (MultiViewLayoutV8)layout; props.GetProgramPreviewSwapped(out int swapped); state.Properties.ProgramPreviewSwapped = swapped != 0; if (info.SupportsVuMeters) { props.GetVuMeterOpacity(out double opacity); state.VuMeterOpacity = opacity * 100; } props.GetWindowCount(out uint count); state.Windows = Enumerable.Range(0, (int)count).Select(window => { props.GetWindowInput((uint)window, out long input); props.GetSafeAreaEnabled((uint)window, out int enabled); var st = new MultiViewerState.WindowState { Source = (VideoSource)input, SafeAreaEnabled = enabled != 0, }; if (info.SupportsToggleSafeArea) { props.CurrentInputSupportsSafeArea((uint)window, out int supportsSafeArea); st.SupportsSafeArea = supportsSafeArea != 0; } if (info.SupportsVuMeters) { props.CurrentInputSupportsVuMeter((uint)window, out int windowSupportsVu); st.SupportsVuMeter = windowSupportsVu != 0; props.GetVuMeterEnabled((uint)window, out int vuEnabled); st.VuMeterEnabled = vuEnabled != 0; } return(st); }).ToList(); return(Tuple.Create(info, state)); }