예제 #1
0
        public void TestReset()
        {
            var target = new FairlightMixerSourceDynamicsResetCommand()
            {
                Compressor = true
            };
            var handler = CommandGenerator.MatchCommand(target);

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                TestFairlightInputSource.EachRandomSource(helper, (stateBefore, srcState, inputId, src, i) =>
                {
                    IBMDSwitcherFairlightAudioCompressor compressor = GetCompressor(src);

                    target.Index    = (AudioSource)inputId;
                    target.SourceId = srcState.SourceId;

                    uint timeBefore = helper.Server.CurrentTime;

                    helper.SendAndWaitForChange(null, () => { compressor.Reset(); });

                    // It should have sent a response, but we dont expect any comparable data
                    Assert.NotEqual(timeBefore, helper.Server.CurrentTime);
                }, 1);
            });
        }
예제 #2
0
 public static void ApplyCompressor(IBMDSwitcherFairlightAudioCompressor compressor,
                                    FairlightAudioState.CompressorState state)
 {
     compressor.GetEnabled(out int enabled);
     state.CompressorEnabled = enabled != 0;
     compressor.GetThreshold(out double threshold);
     state.Threshold = threshold;
     compressor.GetRatio(out double ratio);
     state.Ratio = ratio;
     compressor.GetAttack(out double attack);
     state.Attack = attack;
     compressor.GetRelease(out double release);
     state.Release = release;
     compressor.GetHold(out double hold);
     state.Hold = hold;
 }
예제 #3
0
        public void TestCompressorEnabled()
        {
            var handler =
                CommandGenerator
                .CreateAutoCommandHandler <FairlightMixerSourceCompressorSetCommand,
                                           FairlightMixerSourceCompressorGetCommand>("CompressorEnabled");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                TestFairlightInputSource.EachRandomSource(helper, (stateBefore, srcState, inputId, src, i) =>
                {
                    IBMDSwitcherFairlightAudioCompressor compressor = GetCompressor(src);
                    srcState.Dynamics.Compressor.CompressorEnabled  = i % 2 > 0;
                    helper.SendAndWaitForChange(stateBefore, () => { compressor.SetEnabled(i % 2); });
                });
            });
        }
예제 #4
0
        public void TestAttack()
        {
            var handler =
                CommandGenerator
                .CreateAutoCommandHandler <FairlightMixerSourceCompressorSetCommand,
                                           FairlightMixerSourceCompressorGetCommand>("Attack");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                TestFairlightInputSource.EachRandomSource(helper, (stateBefore, srcState, inputId, src, i) =>
                {
                    IBMDSwitcherFairlightAudioCompressor compressor = GetCompressor(src);

                    var target = Randomiser.Range(0.7, 100);
                    srcState.Dynamics.Compressor.Attack = target;
                    helper.SendAndWaitForChange(stateBefore, () => { compressor.SetAttack(target); });
                });
            });
        }
예제 #5
0
        public void TestReset()
        {
            var target = new FairlightMixerMasterDynamicsResetCommand {
                Compressor = true
            };
            var handler = CommandGenerator.MatchCommand(target);

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                IBMDSwitcherFairlightAudioCompressor compressor = GetCompressor(helper);

                uint timeBefore = helper.Server.CurrentTime;

                helper.SendAndWaitForChange(null, () => { compressor.Reset(); });

                // It should have sent a response, but we dont expect any comparable data
                Assert.NotEqual(timeBefore, helper.Server.CurrentTime);
            });
        }
예제 #6
0
        public void TestCompressorEnabled()
        {
            var handler =
                CommandGenerator
                .CreateAutoCommandHandler <FairlightMixerMasterCompressorSetCommand,
                                           FairlightMixerMasterCompressorGetCommand>("CompressorEnabled");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                IBMDSwitcherFairlightAudioCompressor compressor = GetCompressor(helper);

                AtemState stateBefore = helper.Helper.BuildLibState();

                for (int i = 0; i < 5; i++)
                {
                    stateBefore.Fairlight.ProgramOut.Dynamics.Compressor.CompressorEnabled = i % 2 > 0;
                    helper.SendAndWaitForChange(stateBefore, () => { compressor.SetEnabled(i % 2); });
                }
            });
        }
예제 #7
0
        public void TestRatio()
        {
            var handler =
                CommandGenerator
                .CreateAutoCommandHandler <FairlightMixerMasterCompressorSetCommand,
                                           FairlightMixerMasterCompressorGetCommand>("Ratio");

            AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.FairlightMain, helper =>
            {
                IBMDSwitcherFairlightAudioCompressor compressor = GetCompressor(helper);

                AtemState stateBefore = helper.Helper.BuildLibState();

                for (int i = 0; i < 5; i++)
                {
                    var target = Randomiser.Range(1.2, 20);
                    stateBefore.Fairlight.ProgramOut.Dynamics.Compressor.Ratio = target;
                    helper.SendAndWaitForChange(stateBefore, () => { compressor.SetRatio(target); });
                }
            });
        }