private static AudioState.InputState BuildInput(IBMDSwitcherAudioInput props) { var state = new AudioState.InputState(); props.GetType(out _BMDSwitcherAudioInputType type); state.Properties.SourceType = AtemEnumMaps.AudioSourceTypeMap.FindByValue(type); props.GetCurrentExternalPortType(out _BMDSwitcherExternalPortType externalType); state.Properties.PortType = AtemEnumMaps.AudioPortTypeMap.FindByValue(externalType); props.GetMixOption(out _BMDSwitcherAudioMixOption mixOption); state.Properties.MixOption = AtemEnumMaps.AudioMixOptionMap.FindByValue(mixOption); props.GetGain(out double gain); state.Properties.Gain = gain; props.GetBalance(out double balance); state.Properties.Balance = balance * 50; if (props is IBMDSwitcherAudioInputXLR xlrProps) { xlrProps.HasRCAToXLR(out int supportsXlr); if (supportsXlr != 0) { xlrProps.GetRCAToXLREnabled(out int xlrEnabled); state.Analog = new AudioState.InputState.AnalogState { RcaToXlr = xlrEnabled != 0 }; } } return(state); }
public void TestRcaToXlr() { bool tested = false; var handler = CommandGenerator.CreateAutoCommandHandler <AudioMixerInputSetCommand, AudioMixerInputGetV8Command>("RcaToXlrEnabled"); AtemMockServerWrapper.Each(_output, _pool, handler, DeviceTestCases.ClassicAudioXLRLevel, helper => { IEnumerable <long> useIds = helper.Helper.BuildLibState().Audio.Inputs.Keys.ToList(); foreach (long id in useIds) { if (GetInput(helper, id) is IBMDSwitcherAudioInputXLR input) { input.HasRCAToXLR(out int isAvailable); Assert.Equal(1, isAvailable); tested = true; AtemState stateBefore = helper.Helper.BuildLibState(); AudioState.InputState inputState = stateBefore.Audio.Inputs[id]; Assert.NotNull(inputState.Analog); for (int i = 0; i < 5; i++) { bool newValue = i % 2 == 0; inputState.Analog.RcaToXlr = newValue; helper.SendAndWaitForChange(null, () => { input.SetRCAToXLREnabled(newValue ? 1 : 0); }); } } } }); Assert.True(tested); }