コード例 #1
0
        public void TestInputTalkbackGain()
        {
            var  handler = CommandGenerator.CreateAutoCommandHandler <FairlightMixerMonitorSetCommand, FairlightMixerMonitorGetCommand>("InputTalkbackGain");
            bool tested  = false;

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                var monitor = GetMonitor(helper);
                if (monitor == null)
                {
                    return;
                }
                tested = true;

                AtemState stateBefore = helper.Helper.BuildLibState();
                FairlightAudioState.MonitorOutputState monState = stateBefore.Fairlight.Monitors.Single();

                for (int i = 0; i < 5; i++)
                {
                    var target = Randomiser.Range(-60, 0);
                    monState.InputTalkbackGain = target;
                    helper.SendAndWaitForChange(stateBefore, () => { monitor.SetInputTalkbackGain(target); });
                }
            });
            Assert.True(tested);
        }
コード例 #2
0
        public void TestTally()
        {
            AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.FairlightMain, helper =>
            {
                IBMDSwitcherFairlightAudioMixer mixer = GetFairlightMixer(helper);
                AtemState stateBefore = helper.Helper.BuildLibState();

                for (int i = 0; i < 5; i++)
                {
                    var cmd = new FairlightMixerTallyCommand
                    {
                        Tally = new Dictionary <Tuple <AudioSource, long>, bool>()
                    };

                    Assert.NotEmpty(stateBefore.Fairlight.Tally);

                    // the sdk is a bit picky about ids, so best to go with what it expects
                    foreach (KeyValuePair <Tuple <AudioSource, long>, bool> k in stateBefore.Fairlight.Tally)
                    {
                        bool isMixedIn   = Randomiser.Range(0, 1) > 0.7;
                        cmd.Tally[k.Key] = isMixedIn;
                    }

                    stateBefore.Fairlight.Tally = cmd.Tally;
                    helper.SendAndWaitForChange(stateBefore, () => { helper.Server.SendCommands(cmd); });
                }
            });
        }
コード例 #3
0
        public void TestTally()
        {
            AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.ClassicAudioMain, helper =>
            {
                AtemState stateBefore = helper.Helper.BuildLibState();

                for (int i = 0; i < 5; i++)
                {
                    var cmd = new AudioMixerTallyCommand
                    {
                        Inputs = new Dictionary <AudioSource, bool>()
                    };

                    Assert.NotEmpty(stateBefore.Audio.Tally);

                    // the sdk is a bit picky about ids, so best to go with what it expects
                    foreach (KeyValuePair <AudioSource, bool> k in stateBefore.Audio.Tally)
                    {
                        bool isMixedIn    = Randomiser.Range(0, 1) > 0.7;
                        cmd.Inputs[k.Key] = isMixedIn;
                    }

                    stateBefore.Audio.Tally = cmd.Inputs;
                    helper.SendAndWaitForChange(stateBefore, () => { helper.Server.SendCommands(cmd); });
                }
            });
        }
コード例 #4
0
        public void TestBalance()
        {
            var  handler = CreateAutoCommandHandler("Balance");
            bool tested  = false;

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.ClassicAudioMain, helper =>
            {
                IEnumerable <long> useIds = helper.Helper.BuildLibState().Audio.Inputs.Keys.ToList();
                foreach (long id in useIds)
                {
                    AtemState stateBefore = helper.Helper.BuildLibState();
                    var inputState        = stateBefore.Audio.Inputs[id].Properties;

                    IBMDSwitcherAudioInput input = GetInput(helper, id);
                    tested = true;

                    for (int i = 0; i < 5; i++)
                    {
                        var target         = Randomiser.Range(-50, 50);
                        inputState.Balance = target;
                        helper.SendAndWaitForChange(stateBefore, () => { input.SetBalance(target / 50); });
                    }
                }
            });
            Assert.True(tested);
        }
コード例 #5
0
        public void TestDynamicsLevelsAndPeaks()
        {
            AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.FairlightMain, helper =>
            {
                IBMDSwitcherFairlightAudioMixer mixer = GetFairlightMixer(helper);

                var cb       = new DynamicsLevelCallback();
                var dynamics = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioDynamicsProcessor>(mixer.GetMasterOutEffect);
                using (new UseCallback <DynamicsLevelCallback>(cb, dynamics.AddCallback, dynamics.RemoveCallback))
                {
                    for (int i = 0; i < 5; i++)
                    {
                        cb.Reset();

                        AtemState expectedState = helper.Helper.BuildLibState();
                        FairlightAudioState.ProgramOutState pgmOutState = expectedState.Fairlight.ProgramOut;

                        var testCmd = new FairlightMixerMasterLevelsCommand
                        {
                            InputLeftLevel   = Randomiser.Range(-100, 0),
                            InputRightLevel  = Randomiser.Range(-100, 0),
                            InputLeftPeak    = Randomiser.Range(-100, 0),
                            InputRightPeak   = Randomiser.Range(-100, 0),
                            OutputLeftLevel  = Randomiser.Range(-100, 0),
                            OutputRightLevel = Randomiser.Range(-100, 0),
                            OutputLeftPeak   = Randomiser.Range(-100, 0),
                            OutputRightPeak  = Randomiser.Range(-100, 0),
                        };

                        expectedState.Fairlight.ProgramOut.Levels = new FairlightAudioState.LevelsState
                        {
                            Levels = new double[2],
                            Peaks  = new double[2],
                            DynamicsInputLevels  = new[] { testCmd.InputLeftLevel, testCmd.InputRightLevel },
                            DynamicsInputPeaks   = new[] { testCmd.InputLeftPeak, testCmd.InputRightPeak },
                            DynamicsOutputLevels = new[] { testCmd.OutputLeftLevel, testCmd.OutputRightLevel },
                            DynamicsOutputPeaks  = new[] { testCmd.OutputLeftPeak, testCmd.OutputRightPeak },
                        };

                        helper.SendAndWaitForChange(expectedState, () =>
                        {
                            helper.Server.SendCommands(testCmd);
                        }, -1, (sdkState, libState) =>
                        {
                            sdkState.Fairlight.ProgramOut.Levels = new FairlightAudioState.LevelsState
                            {
                                Levels = new double[2],
                                Peaks  = new double[2],
                                DynamicsInputLevels  = cb.InputLevels,
                                DynamicsInputPeaks   = cb.InputPeaks,
                                DynamicsOutputLevels = cb.OutputLevels,
                                DynamicsOutputPeaks  = cb.OutputPeaks,
                            };
                        });
                    }
                }
            });
        }
コード例 #6
0
        public void TestDynamicsLevelsAndPeaks()
        {
            AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.FairlightMain, helper =>
            {
                EachRandomSource(helper, (stateBefore, srcState, inputId, src, i) =>
                {
                    var cb       = new TestFairlightProgramOut.DynamicsLevelCallback();
                    var dynamics = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioDynamicsProcessor>(src.GetEffect);
                    using (new UseCallback <TestFairlightProgramOut.DynamicsLevelCallback>(cb, dynamics.AddCallback, dynamics.RemoveCallback))
                    {
                        cb.Reset();

                        long sourceId = srcState.SourceId;
                        var testCmd   = new FairlightMixerSourceLevelsCommand
                        {
                            Index    = (AudioSource)inputId,
                            SourceId = sourceId,

                            InputLeftLevel   = Randomiser.Range(-100, 0),
                            InputLeftPeak    = Randomiser.Range(-100, 0),
                            InputRightLevel  = Randomiser.Range(-100, 0),
                            InputRightPeak   = Randomiser.Range(-100, 0),
                            OutputLeftLevel  = Randomiser.Range(-100, 0),
                            OutputLeftPeak   = Randomiser.Range(-100, 0),
                            OutputRightLevel = Randomiser.Range(-100, 0),
                            OutputRightPeak  = Randomiser.Range(-100, 0),
                        };

                        srcState.Levels = new FairlightAudioState.LevelsState
                        {
                            Levels = new double[2],
                            Peaks  = new double[2],
                            DynamicsInputLevels  = new[] { testCmd.InputLeftLevel, testCmd.InputRightLevel },
                            DynamicsInputPeaks   = new[] { testCmd.InputLeftPeak, testCmd.InputRightPeak },
                            DynamicsOutputLevels = new[] { testCmd.OutputLeftLevel, testCmd.OutputRightLevel },
                            DynamicsOutputPeaks  = new[] { testCmd.OutputLeftPeak, testCmd.OutputRightPeak },
                        };

                        helper.SendAndWaitForChange(stateBefore, () =>
                        {
                            helper.Server.SendCommands(testCmd);
                        }, -1, (sdkState, libState) =>
                        {
                            var srcState    = sdkState.Fairlight.Inputs[(long)testCmd.Index].Sources.Single(s => s.SourceId == testCmd.SourceId);
                            srcState.Levels = new FairlightAudioState.LevelsState
                            {
                                Levels = new double[2],
                                Peaks  = new double[2],
                                DynamicsInputLevels  = cb.InputLevels,
                                DynamicsInputPeaks   = cb.InputPeaks,
                                DynamicsOutputLevels = cb.OutputLevels,
                                DynamicsOutputPeaks  = cb.OutputPeaks,
                            };
                        });
                    }
                });
            });
        }
コード例 #7
0
 public void TestBlankStillDownload()
 {
     DoDownload(3, 3000, (width, height) =>
     {
         var bytes = MediaPoolUtil.SolidColour(width * height,
                                               (byte)Randomiser.Range(50, 200), (byte)Randomiser.Range(50, 200),
                                               (byte)Randomiser.Range(50, 200), (byte)Randomiser.Range(50, 200));
         return(Tuple.Create(bytes, FrameEncodingUtil.EncodeRLE(bytes)));
     });
 }
コード例 #8
0
        private static void FillRandomData(CameraControlGetCommand cmd, params CameraControlDataType[] omitTypes)
        {
            cmd.Input     = (VideoSource)(Randomiser.RangeInt(20) + 50);
            cmd.Category  = Randomiser.RangeInt(10) + 20;
            cmd.Parameter = Randomiser.RangeInt(10) + 15;

            cmd.Type = Randomiser.EnumValue <CameraControlDataType>(omitTypes);
            switch (cmd.Type)
            {
            case CameraControlDataType.Bool:
                cmd.BoolData = Enumerable.Range(0, Randomiser.RangeInt(8, 8))     // TODO - higher has issues
                               .Select(i => Randomiser.Range(0, 10) >= 5)
                               .ToArray();
                break;

            case CameraControlDataType.SInt8:
                cmd.IntData = Enumerable.Range(0, Randomiser.RangeInt(1, 8))     // TODO - higher has issues
                              .Select(i => Randomiser.RangeInt(sbyte.MinValue, sbyte.MaxValue))
                              .ToArray();
                break;

            case CameraControlDataType.SInt16:
                cmd.IntData = Enumerable.Range(0, Randomiser.RangeInt(1, 4))
                              .Select(i => Randomiser.RangeInt(short.MinValue, short.MaxValue))
                              .ToArray();
                break;

            case CameraControlDataType.SInt32:
                cmd.IntData = Enumerable.Range(0, Randomiser.RangeInt(1, 2))
                              .Select(i => Randomiser.RangeInt(-500000, 500000))
                              .ToArray();
                break;

            case CameraControlDataType.SInt64:
                cmd.LongData = Enumerable.Range(0, 1)
                               .Select(i => (long)Randomiser.RangeInt(-5000000, 5000000))
                               .ToArray();
                break;

            case CameraControlDataType.String:
                cmd.StringData = Randomiser.String(32);
                break;

            case CameraControlDataType.Float:
                cmd.FloatData = Enumerable.Range(0, Randomiser.RangeInt(1, 4))
                                .Select(i => Randomiser.Range(0, 1))
                                .ToArray();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #9
0
        public void TestLevelsAndPeaks()
        {
            AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.FairlightMain, helper =>
            {
                EachRandomSource(helper, (stateBefore, srcState, inputId, src, i) =>
                {
                    var cb = new MainLevelCallback();
                    using (new UseCallback <MainLevelCallback>(cb, src.AddCallback, src.RemoveCallback))
                    {
                        cb.Reset();

                        long sourceId = srcState.SourceId;
                        var testCmd   = new FairlightMixerSourceLevelsCommand
                        {
                            Index    = (AudioSource)inputId,
                            SourceId = sourceId,

                            LeftLevel  = Randomiser.Range(-100, 0),
                            RightLevel = Randomiser.Range(-100, 0),
                            LeftPeak   = Randomiser.Range(-100, 0),
                            RightPeak  = Randomiser.Range(-100, 0),
                        };

                        srcState.Levels = new FairlightAudioState.LevelsState
                        {
                            Levels = new[] { testCmd.LeftLevel, testCmd.RightLevel },
                            Peaks  = new[] { testCmd.LeftPeak, testCmd.RightPeak },
                            DynamicsInputLevels  = new double[2],
                            DynamicsInputPeaks   = new double[2],
                            DynamicsOutputLevels = new double[2],
                            DynamicsOutputPeaks  = new double[2],
                        };

                        helper.SendAndWaitForChange(stateBefore, () =>
                        {
                            helper.Server.SendCommands(testCmd);
                        }, -1, (sdkState, libState) =>
                        {
                            var srcState    = sdkState.Fairlight.Inputs[(long)testCmd.Index].Sources.Single(s => s.SourceId == testCmd.SourceId);
                            srcState.Levels = new FairlightAudioState.LevelsState
                            {
                                Levels = cb.Levels,
                                Peaks  = cb.Peaks,
                                DynamicsInputLevels  = new double[2],
                                DynamicsInputPeaks   = new double[2],
                                DynamicsOutputLevels = new double[2],
                                DynamicsOutputPeaks  = new double[2],
                            };
                        });
                    }
                });
            });
        }
コード例 #10
0
        public void TestMaskRight()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <DownstreamKeyMaskSetCommand, DownstreamKeyPropertiesGetCommand>("MaskRight");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.All, helper =>
            {
                EachKeyer(helper, (stateBefore, state, props, id, i) =>
                {
                    double target = Randomiser.Range(-9, 9, 1000);
                    state.Properties.MaskRight = target;
                    helper.SendAndWaitForChange(stateBefore, () => { props.SetMaskRight(target); });
                });
            });
        }
        public void TestAttack()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <FairlightMixerSourceExpanderSetCommand, FairlightMixerSourceExpanderGetCommand>("Attack");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                TestFairlightInputSource.EachRandomSource(helper, (stateBefore, srcState, inputId, src, i) =>
                {
                    IBMDSwitcherFairlightAudioExpander expander = GetExpander(src);

                    var target = Randomiser.Range(0.7, 30);
                    srcState.Dynamics.Expander.Attack = target;
                    helper.SendAndWaitForChange(stateBefore, () => { expander.SetAttack(target); });
                });
            });
        }
コード例 #12
0
        public void TestLuma()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <ColorGeneratorSetCommand, ColorGeneratorGetCommand>("Luma");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.All, helper =>
            {
                EachColor(helper, (stateBefore, state, props, id, i) =>
                {
                    Assert.NotNull(state);

                    var target = Randomiser.Range(0, 100, 10);
                    state.Luma = target;
                    helper.SendAndWaitForChange(stateBefore, () => { props.SetLuma(target / 100); });
                });
            });
        }
コード例 #13
0
        public void TestStereoSimulation()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <FairlightMixerSourceSetCommand, FairlightMixerSourceGetCommand>("StereoSimulation");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightDelay, helper =>
            {
                EachRandomSource(helper, (stateBefore, srcState, inputId, src, i) =>
                {
                    helper.SendAndWaitForChange(stateBefore, () =>
                    {
                        var target = Randomiser.Range(0, 100, 100);
                        srcState.StereoSimulation = target;
                        src.SetStereoSimulationIntensity(target);
                    });
                });
            });
        }
コード例 #14
0
        public void TestFaderGain()
        {
            var  handler = CommandGenerator.CreateAutoCommandHandler <FairlightMixerSourceSetCommand, FairlightMixerSourceGetCommand>("FaderGain");
            bool tested  = false;

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                EachRandomSource(helper, (stateBefore, srcState, inputId, src, i) =>
                {
                    tested             = true;
                    var target         = Randomiser.Range();
                    srcState.FaderGain = target;
                    helper.SendAndWaitForChange(stateBefore, () => { src.SetFaderGain(target); });
                });
            });
            Assert.True(tested);
        }
        public void TestGain()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <FairlightMixerMasterSetCommand, FairlightMixerMasterGetCommand>("EqualizerGain");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                IBMDSwitcherFairlightAudioEqualizer equalizer = GetEqualizer(helper);
                AtemState stateBefore = helper.Helper.BuildLibState();

                for (int i = 0; i < 5; i++)
                {
                    double target = Randomiser.Range(-20, 20);
                    stateBefore.Fairlight.ProgramOut.Equalizer.Gain = target;
                    helper.SendAndWaitForChange(stateBefore, () => { equalizer.SetGain(target); });
                }
            });
        }
コード例 #16
0
        public void TestQFactor()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <FairlightMixerSourceEqualizerBandSetCommand, FairlightMixerSourceEqualizerBandGetCommand>("QFactor");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                ForSampleOfBands(helper, (stateBefore, bandState, band, inputId, sourceId, index) =>
                {
                    for (int i = 0; i < 3; i++)
                    {
                        double target     = Randomiser.Range(0.3, 10.3);
                        bandState.QFactor = target;
                        helper.SendAndWaitForChange(stateBefore, () => { band.SetQFactor(target); });
                    }
                });
            });
        }
コード例 #17
0
        public void TestTalkbackGain()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <AudioMixerHeadphoneSetCommand, AudioMixerHeadphoneGetCommand>("TalkbackGain");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.ClassicAudioHeadphones, helper =>
            {
                IBMDSwitcherAudioHeadphoneOutput headphones = GetHeadphones(helper);
                AtemState stateBefore = helper.Helper.BuildLibState();
                AudioState.HeadphoneOutputState hpState = stateBefore.Audio.HeadphoneOutputs.Single();

                for (int i = 0; i < 5; i++)
                {
                    double target        = Randomiser.Range();
                    hpState.TalkbackGain = target;
                    helper.SendAndWaitForChange(stateBefore, () => { headphones.SetInputTalkbackGain(target); });
                }
            });
        }
コード例 #18
0
        public void TestInnerWidth()
        {
            bool tested  = false;
            var  handler = CommandGenerator.CreateAutoCommandHandler <SuperSourceBorderSetCommand, SuperSourceBorderGetCommand>("InnerWidth");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.SuperSource, helper =>
            {
                EachSuperSourceBorder(helper, (stateBefore, ssrcBefore, sdk, ssrcId, i) =>
                {
                    tested = true;

                    double target         = Randomiser.Range(0, 16, 100);
                    ssrcBefore.InnerWidth = target;
                    helper.SendAndWaitForChange(stateBefore, () => { sdk.SetBorderWidthIn(target); });
                });
            });
            Assert.True(tested);
        }
コード例 #19
0
        public void TestHold()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <FairlightMixerMasterLimiterSetCommand, FairlightMixerMasterLimiterGetCommand>("Hold");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                IBMDSwitcherFairlightAudioLimiter limiter = GetLimiter(helper);

                AtemState stateBefore = helper.Helper.BuildLibState();

                for (int i = 0; i < 5; i++)
                {
                    var target = Randomiser.Range(0, 4000);
                    stateBefore.Fairlight.ProgramOut.Dynamics.Limiter.Hold = target;
                    helper.SendAndWaitForChange(stateBefore, () => { limiter.SetHold(target); });
                }
            });
        }
コード例 #20
0
        public void TestSizeX()
        {
            bool tested  = false;
            var  handler = CommandGenerator.CreateAutoCommandHandler <MixEffectKeyDVESetCommand, MixEffectKeyDVEGetCommand>("SizeX");

            AtemMockServerWrapper.Each(Output, Pool, handler, DeviceTestCases.All, helper =>
            {
                SelectionOfKeyers <IBMDSwitcherKeyFlyParameters>(helper, (stateBefore, keyerBefore, sdkKeyer, meId, keyId, i) =>
                {
                    tested = true;

                    double target         = Randomiser.Range(0, 99.99);
                    keyerBefore.DVE.SizeX = target;
                    helper.SendAndWaitForChange(stateBefore, () => { sdkKeyer.SetSizeX(target); });
                });
            });
            Assert.True(tested);
        }
コード例 #21
0
        public void TestMaskRight()
        {
            bool tested  = false;
            var  handler = CommandGenerator.CreateAutoCommandHandler <MixEffectKeyMaskSetCommand, MixEffectKeyPropertiesGetCommand>("MaskRight");

            AtemMockServerWrapper.Each(Output, Pool, handler, DeviceTestCases.All, helper =>
            {
                SelectionOfKeyers <IBMDSwitcherKey>(helper, (stateBefore, keyerBefore, sdkKeyer, meId, keyId, i) =>
                {
                    tested = true;

                    double target = Randomiser.Range(-16, 16, 1000);
                    keyerBefore.Properties.MaskRight = target;
                    helper.SendAndWaitForChange(stateBefore, () => { sdkKeyer.SetMaskRight(target); });
                });
            });
            Assert.True(tested);
        }
コード例 #22
0
        public void TestPositionY()
        {
            bool tested  = false;
            var  handler = CommandGenerator.CreateAutoCommandHandler <SuperSourceBoxSetV8Command, SuperSourceBoxGetV8Command>("PositionY");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.SuperSource, helper =>
            {
                EachSuperSourceBox(helper, (stateBefore, boxBefore, sdk, ssrcId, boxId, i) =>
                {
                    tested = true;

                    var target          = Randomiser.Range(-34, 34, 100);
                    boxBefore.PositionY = target;
                    helper.SendAndWaitForChange(stateBefore, () => { sdk.SetPositionY(target); });
                });
            });
            Assert.True(tested);
        }
コード例 #23
0
        public void TestHandlePosition()
        {
            bool tested  = false;
            var  handler = CommandGenerator.CreateAutoCommandHandler <TransitionPositionSetCommand, TransitionPositionGetCommand>("HandlePosition", true);

            AtemMockServerWrapper.Each(Output, Pool, handler, DeviceTestCases.All, helper =>
            {
                EachMixEffect <IBMDSwitcherMixEffectBlock>(helper, (stateBefore, meBefore, sdk, meId, i) =>
                {
                    tested = true;

                    var target = Randomiser.Range(0, 0.9999, 10000);
                    meBefore.Transition.Position.HandlePosition = target;
                    helper.SendAndWaitForChange(stateBefore, () => { sdk.SetTransitionPosition(target); });
                });
            });
            Assert.True(tested);
        }
コード例 #24
0
        public void TestArtGain()
        {
            bool tested  = false;
            var  handler = CommandGenerator.CreateAutoCommandHandler <SuperSourcePropertiesSetV8Command, SuperSourcePropertiesGetV8Command>("ArtGain");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.SuperSource, helper =>
            {
                EachSuperSource(helper, (stateBefore, ssrcBefore, sdk, ssrcId, i) =>
                {
                    tested = true;

                    var target = Randomiser.Range(0, 100, 10);
                    ssrcBefore.Properties.ArtGain = target;
                    helper.SendAndWaitForChange(stateBefore, () => { sdk.SetGain(target / 100); });
                });
            });
            Assert.True(tested);
        }
コード例 #25
0
        public void TestGain()
        {
            var handler = CommandGenerator.CreateAutoCommandHandler <AudioMixerMonitorSetCommand, AudioMixerMonitorGetCommand>("Gain");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.ClassicAudioMonitors, helper =>
            {
                IBMDSwitcherAudioMonitorOutput monitor = GetMonitor(helper);
                AtemState stateBefore = helper.Helper.BuildLibState();
                AudioState.MonitorOutputState monState = stateBefore.Audio.MonitorOutputs.Single();

                for (int i = 0; i < 5; i++)
                {
                    double target = Randomiser.Range();
                    monState.Gain = target;
                    helper.SendAndWaitForChange(stateBefore, () => { monitor.SetGain(target); });
                }
            });
        }
コード例 #26
0
        public void TestLevelsAndPeaks()
        {
            AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.ClassicAudioMain, helper =>
            {
                IBMDSwitcherAudioMixer mixer = GetAudioMixer(helper);

                var cb = new ProgramOutLevelCallback();
                using (new UseCallback <ProgramOutLevelCallback>(cb, mixer.AddCallback, mixer.RemoveCallback))
                {
                    for (int i = 0; i < 5; i++)
                    {
                        cb.Reset();

                        AtemState expectedState = helper.Helper.BuildLibState();

                        var testCmd = new AudioMixerLevelsCommand()
                        {
                            MasterLeftLevel  = Randomiser.Range(-100, 0),
                            MasterRightLevel = Randomiser.Range(-100, 0),
                            MasterLeftPeak   = Randomiser.Range(-100, 0),
                            MasterRightPeak  = Randomiser.Range(-100, 0),
                        };

                        expectedState.Audio.ProgramOut.Levels = new AudioState.LevelsState
                        {
                            Levels = new[] { testCmd.MasterLeftLevel, testCmd.MasterRightLevel },
                            Peaks  = new[] { testCmd.MasterLeftPeak, testCmd.MasterRightPeak },
                        };

                        helper.SendAndWaitForChange(expectedState, () =>
                        {
                            helper.Server.SendCommands(testCmd);
                        }, -1, (sdkState, libState) =>
                        {
                            sdkState.Audio.ProgramOut.Levels = new AudioState.LevelsState
                            {
                                Levels = cb.Levels,
                                Peaks  = cb.Peaks,
                            };
                        });
                    }
                }
            });
        }
コード例 #27
0
        private static void FillRandomOffsetData(CameraControlGetCommand cmd)
        {
            switch (cmd.Type)
            {
            case CameraControlDataType.Bool:
                cmd.BoolData = cmd.BoolData
                               .Select(i => Randomiser.Range(0, 10) >= 5)
                               .ToArray();
                break;

            case CameraControlDataType.SInt8:
                cmd.IntData = cmd.IntData
                              .Select(i => Randomiser.RangeInt(sbyte.MinValue - i, sbyte.MaxValue - i))
                              .ToArray();
                break;

            case CameraControlDataType.SInt16:
                cmd.IntData = cmd.IntData
                              .Select(i => Randomiser.RangeInt(short.MinValue - i, short.MaxValue - i))
                              .ToArray();
                break;

            case CameraControlDataType.SInt32:
                cmd.IntData = cmd.IntData
                              .Select(i => Randomiser.RangeInt(-50000, 50000))
                              .ToArray();
                break;

            case CameraControlDataType.SInt64:
                cmd.LongData = cmd.LongData
                               .Select(i => (long)Randomiser.RangeInt(-50000, 50000))
                               .ToArray();
                break;

            case CameraControlDataType.Float:
                cmd.FloatData = cmd.FloatData
                                .Select(i => Randomiser.Range(0 - i, 1 - i))
                                .ToArray();
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }
コード例 #28
0
        public void TestLightSourceDirection()
        {
            bool tested  = false;
            var  handler = CommandGenerator.CreateAutoCommandHandler <MixEffectKeyDVESetCommand, MixEffectKeyDVEGetCommand>("LightSourceDirection");

            AtemMockServerWrapper.Each(Output, Pool, handler, DeviceTestCases.All, helper =>
            {
                SelectionOfKeyers <IBMDSwitcherKeyDVEParameters>(helper, (stateBefore, keyerBefore, sdkKeyer, meId, keyId, i) =>
                {
                    tested = true;
                    Assert.NotNull(keyerBefore.DVE);

                    var target = Randomiser.Range(0, 359.9, 10);
                    keyerBefore.DVE.LightSourceDirection = target;
                    helper.SendAndWaitForChange(stateBefore, () => { sdkKeyer.SetLightSourceDirection(target); });
                });
            });
            Assert.True(tested);
        }
コード例 #29
0
        public void TestClip()
        {
            bool tested  = false;
            var  handler = CommandGenerator.CreateAutoCommandHandler <MixEffectKeyLumaSetCommand, MixEffectKeyLumaGetCommand>("Clip");

            AtemMockServerWrapper.Each(Output, Pool, handler, DeviceTestCases.All, helper =>
            {
                SelectionOfKeyers <IBMDSwitcherKeyLumaParameters>(helper, (stateBefore, keyerBefore, sdkKeyer, meId, keyId, i) =>
                {
                    tested = true;
                    Assert.NotNull(keyerBefore.Luma);

                    var target            = Randomiser.Range(0, 100, 10);
                    keyerBefore.Luma.Clip = target;
                    helper.SendAndWaitForChange(stateBefore, () => { sdkKeyer.SetClip(target / 100); });
                });
            });
            Assert.True(tested);
        }
コード例 #30
0
        public void TestInverse()
        {
            bool tested  = false;
            var  handler = CommandGenerator.CreateAutoCommandHandler <MixEffectKeyPatternSetCommand, MixEffectKeyPatternGetCommand>("Inverse");

            AtemMockServerWrapper.Each(Output, Pool, handler, DeviceTestCases.All, helper =>
            {
                SelectionOfKeyers <IBMDSwitcherKeyPatternParameters>(helper, (stateBefore, keyerBefore, sdkKeyer, meId, keyId, i) =>
                {
                    tested = true;
                    Assert.NotNull(keyerBefore.Pattern);

                    var target = Randomiser.Range(0, 1, 10000);
                    keyerBefore.Pattern.Inverse = i % 2 != 0;
                    helper.SendAndWaitForChange(stateBefore, () => { sdkKeyer.SetInverse(i % 2); });
                });
            });
            Assert.True(tested);
        }