private static IBMDSwitcherFairlightAudioEqualizer GetEqualizer(IBMDSwitcherFairlightAudioSource src) { var equalizer = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioEqualizer>(src.GetEffect); Assert.NotNull(equalizer); return(equalizer); }
public static IBMDSwitcherFairlightAudioDynamicsProcessor GetDynamics(IBMDSwitcherFairlightAudioSource src) { var dynamics = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioDynamicsProcessor>(src.GetEffect); Assert.NotNull(dynamics); return(dynamics); }
protected static void EachSuperSourceBox(AtemMockServerWrapper helper, Action <AtemState, SuperSourceState.BoxState, IBMDSwitcherSuperSourceBox, SuperSourceId, SuperSourceBoxId, int> fcn, int iterations = 5) { var allBoxes = new List <Tuple <SuperSourceId, SuperSourceBoxId, IBMDSwitcherSuperSourceBox> >(); foreach (KeyValuePair <VideoSource, IBMDSwitcherInputSuperSource> ssrc in helper.GetSdkInputsOfType <IBMDSwitcherInputSuperSource>()) { SuperSourceId id = (SuperSourceId)(ssrc.Key - VideoSource.SuperSource); var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherSuperSourceBoxIterator>(ssrc.Value.CreateIterator); AtemSDKConverter.Iterate <IBMDSwitcherSuperSourceBox>(iterator.Next, (box, i) => { allBoxes.Add(Tuple.Create(id, (SuperSourceBoxId)i, box)); }); } var boxes = Randomiser.SelectionOfGroup(allBoxes); foreach (Tuple <SuperSourceId, SuperSourceBoxId, IBMDSwitcherSuperSourceBox> box in boxes) { AtemState stateBefore = helper.Helper.BuildLibState(); SuperSourceState.BoxState boxBefore = stateBefore.SuperSources[(int)box.Item1].Boxes[(int)box.Item2]; Assert.NotNull(boxBefore); for (int i = 0; i < iterations; i++) { fcn(stateBefore, boxBefore, box.Item3, box.Item1, box.Item2, i); } } }
private static IBMDSwitcherFairlightAudioCompressor GetCompressor(IBMDSwitcherFairlightAudioSource src) { IBMDSwitcherFairlightAudioDynamicsProcessor dynamics = TestFairlightInputSource.GetDynamics(src); var compressor = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioCompressor>(dynamics.GetProcessor); Assert.NotNull(compressor); return(compressor); }
private static IBMDSwitcherFairlightAudioExpander GetExpander(IBMDSwitcherFairlightAudioSource src) { IBMDSwitcherFairlightAudioDynamicsProcessor dynamics = TestFairlightInputSource.GetDynamics(src); var expander = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioExpander>(dynamics.GetProcessor); Assert.NotNull(expander); return(expander); }
private static IBMDSwitcherFairlightAudioEqualizer GetEqualizer(AtemMockServerWrapper helper) { IBMDSwitcherFairlightAudioMixer mixer = TestFairlightProgramOut.GetFairlightMixer(helper); var equalizer = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioEqualizer>(mixer.GetMasterOutEffect); Assert.NotNull(equalizer); return(equalizer); }
public static IBMDSwitcherInput GetInput(AtemMockServerWrapper helper, VideoSource targetId) { var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherInputIterator>(helper.SdkClient.SdkSwitcher.CreateIterator); iterator.GetById((long)targetId, out IBMDSwitcherInput input); Assert.NotNull(input); return(input); }
public static IBMDSwitcherFairlightAudioDynamicsProcessor GetDynamics(AtemMockServerWrapper helper) { var mixer = GetFairlightMixer(helper); var dynamics = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioDynamicsProcessor>(mixer.GetMasterOutEffect); Assert.NotNull(dynamics); return(dynamics); }
private static IBMDSwitcherFairlightAudioLimiter GetLimiter(AtemMockServerWrapper helper) { IBMDSwitcherFairlightAudioDynamicsProcessor dynamics = TestFairlightProgramOut.GetDynamics(helper); var limiter = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioLimiter>(dynamics.GetProcessor); Assert.NotNull(limiter); return(limiter); }
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, }; }); } } }); }
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, }; }); } }); }); }
public static IBMDSwitcherFairlightAudioInput GetInput(AtemMockServerWrapper helper, long targetId) { IBMDSwitcherFairlightAudioMixer mixer = TestFairlightProgramOut.GetFairlightMixer(helper); var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioInputIterator>(mixer.CreateIterator); iterator.GetById(targetId, out IBMDSwitcherFairlightAudioInput input); Assert.NotNull(input); return(input); }
private static IBMDSwitcherAudioMonitorOutput GetMonitor(AtemMockServerWrapper helper) { var mixer = TestAudioProgramOut.GetAudioMixer(helper); var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherAudioMonitorOutputIterator>(mixer.CreateIterator); var headphones = AtemSDKConverter.IterateList <IBMDSwitcherAudioMonitorOutput, IBMDSwitcherAudioMonitorOutput>(iterator.Next, (p, i) => p); return(headphones.Single()); }
public static IBMDSwitcherFairlightAudioHeadphoneOutput GetMonitor(AtemMockServerWrapper helper) { IBMDSwitcherFairlightAudioMixer mixer = TestFairlightProgramOut.GetFairlightMixer(helper); var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioHeadphoneOutputIterator>(mixer.CreateIterator); var monitors = AtemSDKConverter.IterateList <IBMDSwitcherFairlightAudioHeadphoneOutput, IBMDSwitcherFairlightAudioHeadphoneOutput>(iterator.Next, (s, i) => s); return(monitors.SingleOrDefault()); }
private static List <Tuple <IBMDSwitcherFairlightAudioEqualizerBand, uint> > GetSampleOfBands(IBMDSwitcherFairlightAudioEqualizer eq) { var it = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioEqualizerBandIterator>(eq.CreateIterator); var allBands = AtemSDKConverter .IterateList <IBMDSwitcherFairlightAudioEqualizerBand, Tuple <IBMDSwitcherFairlightAudioEqualizerBand, uint> >(it.Next, Tuple.Create); return(Randomiser.SelectionOfGroup(allBands, 3).ToList()); }
private void EachTalkback(AtemMockServerWrapper helper, Action <AtemState, SettingsState.TalkbackState, IBMDSwitcherTalkback, uint> fcn) { AtemState stateBefore = helper.Helper.BuildLibState(); var it = AtemSDKConverter.CastSdk <IBMDSwitcherTalkbackIterator>(helper.SdkClient.SdkSwitcher .CreateIterator); AtemSDKConverter.Iterate <IBMDSwitcherTalkback>(it.Next, (talkback, i) => { SettingsState.TalkbackState talkbackState = stateBefore.Settings.Talkback[(int)i]; fcn(stateBefore, talkbackState, talkback, i); }); }
private List <IBMDSwitcherMixMinusOutput> GetMixMinusOutputs(AtemMockServerWrapper helper) { var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherMixMinusOutputIterator>(helper.SdkClient.SdkSwitcher.CreateIterator); var result = new List <IBMDSwitcherMixMinusOutput>(); for (iterator.Next(out IBMDSwitcherMixMinusOutput r); r != null; iterator.Next(out r)) { result.Add(r); } return(result); }
private static IBMDSwitcherFairlightAudioSource GetSource(IBMDSwitcherFairlightAudioInput input, long?targetId = null) { var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioSourceIterator>(input.CreateIterator); if (targetId.HasValue) { iterator.GetById(targetId.Value, out IBMDSwitcherFairlightAudioSource src); return(src); } else { iterator.Next(out IBMDSwitcherFairlightAudioSource src); return(src); } }
private List <Tuple <uint, IBMDSwitcherMultiView> > GetMultiviewers(AtemMockServerWrapper helper) { var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherMultiViewIterator>(helper.SdkClient.SdkSwitcher.CreateIterator); var result = new List <Tuple <uint, IBMDSwitcherMultiView> >(); uint index = 0; for (iterator.Next(out IBMDSwitcherMultiView r); r != null; iterator.Next(out r)) { result.Add(Tuple.Create(index, r)); index++; } return(result); }
private static List <Tuple <DownstreamKeyId, IBMDSwitcherDownstreamKey> > GetKeyers(AtemMockServerWrapper helper) { var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherDownstreamKeyIterator>(helper.Helper.SdkSwitcher.CreateIterator); var result = new List <Tuple <DownstreamKeyId, IBMDSwitcherDownstreamKey> >(); DownstreamKeyId index = 0; for (iterator.Next(out IBMDSwitcherDownstreamKey r); r != null; iterator.Next(out r)) { result.Add(Tuple.Create(index, r)); index++; } return(result); }
public IBMDSwitcherInput GetSdkInput(long targetId) { var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherInputIterator>(Helper.SdkSwitcher.CreateIterator); for (iterator.Next(out IBMDSwitcherInput input); input != null; iterator.Next(out input)) { input.GetInputId(out long id); if (targetId == id) { return(input); } } return(null); }
protected static List <Tuple <MixEffectBlockId, T> > GetMixEffects <T>(AtemMockServerWrapper helper) where T : class { var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherMixEffectBlockIterator>(helper.SdkClient.SdkSwitcher.CreateIterator); var result = new List <Tuple <MixEffectBlockId, T> >(); int index = 0; for (iterator.Next(out IBMDSwitcherMixEffectBlock r); r != null; iterator.Next(out r)) { if (r is T rt) { result.Add(Tuple.Create((MixEffectBlockId)index, rt)); } index++; } return(result); }
public Dictionary <VideoSource, T> GetSdkInputsOfType <T>() where T : class { var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherInputIterator>(Helper.SdkSwitcher.CreateIterator); Dictionary <VideoSource, T> inputs = new Dictionary <VideoSource, T>(); for (iterator.Next(out IBMDSwitcherInput input); input != null; iterator.Next(out input)) { var colGen = input as T; if (colGen == null) { continue; } input.GetInputId(out long id); inputs[(VideoSource)id] = colGen; } return(inputs); }
protected static List <Tuple <MixEffectBlockId, UpstreamKeyId, T> > GetKeyers <T>(AtemMockServerWrapper helper) where T : class { var result = new List <Tuple <MixEffectBlockId, UpstreamKeyId, T> >(); List <Tuple <MixEffectBlockId, IBMDSwitcherMixEffectBlock> > mes = GetMixEffects <IBMDSwitcherMixEffectBlock>(helper); foreach (var me in mes) { var iterator = AtemSDKConverter.CastSdk <IBMDSwitcherKeyIterator>(me.Item2.CreateIterator); int o = 0; for (iterator.Next(out IBMDSwitcherKey r); r != null; iterator.Next(out r)) { if (r is T rt) { result.Add(Tuple.Create(me.Item1, (UpstreamKeyId)o, rt)); } o++; } } return(result); }
public void TestDynamicsGainReduction() { AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.FairlightMain, helper => { IBMDSwitcherFairlightAudioMixer mixer = GetFairlightMixer(helper); var cbCompressor = new DynamicEffectsLevelCallback(); var cbLimiter = new DynamicEffectsLevelCallback(); var dynamics = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioDynamicsProcessor>(mixer.GetMasterOutEffect); var limiter = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioLimiter>(dynamics.GetProcessor); var compressor = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioCompressor>(dynamics.GetProcessor); using (new UseCallback <DynamicEffectsLevelCallback>(cbCompressor, compressor.AddCallback, compressor.RemoveCallback)) using (new UseCallback <DynamicEffectsLevelCallback>(cbLimiter, limiter.AddCallback, limiter.RemoveCallback)) { for (int i = 0; i < 5; i++) { cbCompressor.Reset(); cbLimiter.Reset(); AtemState expectedState = helper.Helper.BuildLibState(); var testCmd = new FairlightMixerMasterLevelsCommand { CompressorGainReduction = Randomiser.Range(-100, 0), LimiterGainReduction = Randomiser.Range(-100, 0) }; expectedState.Fairlight.ProgramOut.Levels = new FairlightAudioState.LevelsState { Levels = new double[2], Peaks = new double[2], DynamicsInputLevels = new double[2], DynamicsInputPeaks = new double[2], DynamicsOutputLevels = new double[2], DynamicsOutputPeaks = new double[2], CompressorGainReductionLevel = testCmd.CompressorGainReduction, LimiterGainReductionLevel = testCmd.LimiterGainReduction }; 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 = new double[2], DynamicsInputPeaks = new double[2], DynamicsOutputLevels = new double[2], DynamicsOutputPeaks = new double[2], CompressorGainReductionLevel = cbCompressor.GainReduction.Single(), LimiterGainReductionLevel = cbLimiter.GainReduction.Single() }; }); } } }); }
public void TestDynamicsGainReduction() { AtemMockServerWrapper.Each(_output, _pool, null, DeviceTestCases.FairlightMain, helper => { EachRandomSource(helper, (stateBefore, srcState, inputId, src, i) => { var cbCompressor = new TestFairlightProgramOut.DynamicEffectsLevelCallback(); var cbLimiter = new TestFairlightProgramOut.DynamicEffectsLevelCallback(); var cbExpander = new TestFairlightProgramOut.DynamicEffectsLevelCallback(); var dynamics = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioDynamicsProcessor>(src.GetEffect); var limiter = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioLimiter>(dynamics.GetProcessor); var expander = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioExpander>(dynamics.GetProcessor); var compressor = AtemSDKConverter.CastSdk <IBMDSwitcherFairlightAudioCompressor>(dynamics.GetProcessor); using (new UseCallback <TestFairlightProgramOut.DynamicEffectsLevelCallback>(cbCompressor, compressor.AddCallback, compressor.RemoveCallback)) using (new UseCallback <TestFairlightProgramOut.DynamicEffectsLevelCallback>(cbLimiter, limiter.AddCallback, limiter.RemoveCallback)) using (new UseCallback <TestFairlightProgramOut.DynamicEffectsLevelCallback>(cbExpander, expander.AddCallback, expander.RemoveCallback)) { long sourceId = srcState.SourceId; var testCmd = new FairlightMixerSourceLevelsCommand { Index = (AudioSource)inputId, SourceId = sourceId, CompressorGainReduction = Randomiser.Range(-100, 0), LimiterGainReduction = Randomiser.Range(-100, 0), ExpanderGainReduction = Randomiser.Range(-100, 0) }; srcState.Levels = new FairlightAudioState.LevelsState { Levels = new double[2], Peaks = new double[2], DynamicsInputLevels = new double[2], DynamicsInputPeaks = new double[2], DynamicsOutputLevels = new double[2], DynamicsOutputPeaks = new double[2], CompressorGainReductionLevel = testCmd.CompressorGainReduction, LimiterGainReductionLevel = testCmd.LimiterGainReduction, ExpanderGainReductionLevel = testCmd.ExpanderGainReduction }; 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 = new double[2], DynamicsInputPeaks = new double[2], DynamicsOutputLevels = new double[2], DynamicsOutputPeaks = new double[2], CompressorGainReductionLevel = cbCompressor.GainReduction.Single(), LimiterGainReductionLevel = cbLimiter.GainReduction.Single(), ExpanderGainReductionLevel = cbExpander.GainReduction.Single(), }; }); } }); }); }