- Posts: 1
- Joined: Wed Oct 24, 2018 7:26 pm
- Real Name: emmanuel Casert
Hi,
I'm trying to develop a control panel for my ATEM TVS switcher. This would run on a mini-pc with a touchscreen monitor.( see GUI screenshot attached) I have also a custom control panel hardware based on arduino and connected through USB to the mini-PC.
This control panel sends button pressed events and position value of 4 sliders. These sliders are intended to control the Video transition (T-Bar), the master program audio volume and 2 audio channel volume.
Some other buttons provide basic function like AUTO, CUT, transition MIX, WIPE, DIP. Feedback from the software allows buttons leds to goes on and off, and provides external Tally leds control.
I have almost successfully implemented everything now, except the audio input volume control. There is my pain point since a couple of days... I didn't find any sample source c# code that does this job.
Master volume control works fine as it gets controlled directly by
IBMDSwitcherAudioMixer m_audiomixer;
m_audiomixer = (BMDSwitcherAPI.IBMDSwitcherAudioMixer)m_switcher;
m_audiomixer.GetProgramOutGain(out Curgain); for feedback
and m_audiomixer.SetProgramOutGain(out Curgain);for setting
I could not find a way to control AudioInput the same way. I have managed to create a monitoring chain using the ugly iterator process :
IBMDSwitcherAudioInputIterator AinputIterator = null;
IntPtr AinputIteratorPtr;
Guid AinputIteratorIID = typeof(IBMDSwitcherAudioInputIterator).GUID;
m_audiomixer.CreateIterator(ref AinputIteratorIID, out AinputIteratorPtr);
if (AinputIteratorPtr != null)
{
AinputIterator =(IBMDSwitcherAudioInputIterator)Marshal.GetObjectForIUnknown(AinputIteratorPtr);
}
if (AinputIteratorPtr != null)
{
IBMDSwitcherAudioInput Ainput;
AinputIterator.Next(out Ainput);
while (Ainput != null)
{
AudioInputMonitor m_audioInputMonitor = new AudioInputMonitor(Ainput);
Ainput.AddCallback(m_audioInputMonitor);
m_audioInputMonitor.GainChanged += new SwitcherEventHandler(OnAInputGainChanged);
m_audioInputMonitor.IsMixedInChanged += new SwitcherEventHandler(OnIsMixedInChanged);
m_audioInputMonitors.Add(m_audioInputMonitor);
AinputIterator.Next(out Ainput);
}
}
This triggers my OnAInputGainChanged and OnIsMixedInChanged functions but how can I know which channel gain or MixedIn has changed ? I've tried to run an iterator but it looks to take too much time and the function reruns before it has been completed.
The eventhandler should at least pass the InputID so a command like audio_mixer.input(InputID).GetGain (out Gain) would return the changed value in only one step.
Could you provide a working sample c# source code that controls the audio mixer ( and set sliders position feedback) ? This would really help me !
Thanks in advance !
Emmanuel
I'm trying to develop a control panel for my ATEM TVS switcher. This would run on a mini-pc with a touchscreen monitor.( see GUI screenshot attached) I have also a custom control panel hardware based on arduino and connected through USB to the mini-PC.
This control panel sends button pressed events and position value of 4 sliders. These sliders are intended to control the Video transition (T-Bar), the master program audio volume and 2 audio channel volume.
Some other buttons provide basic function like AUTO, CUT, transition MIX, WIPE, DIP. Feedback from the software allows buttons leds to goes on and off, and provides external Tally leds control.
I have almost successfully implemented everything now, except the audio input volume control. There is my pain point since a couple of days... I didn't find any sample source c# code that does this job.
Master volume control works fine as it gets controlled directly by
IBMDSwitcherAudioMixer m_audiomixer;
m_audiomixer = (BMDSwitcherAPI.IBMDSwitcherAudioMixer)m_switcher;
m_audiomixer.GetProgramOutGain(out Curgain); for feedback
and m_audiomixer.SetProgramOutGain(out Curgain);for setting
I could not find a way to control AudioInput the same way. I have managed to create a monitoring chain using the ugly iterator process :
IBMDSwitcherAudioInputIterator AinputIterator = null;
IntPtr AinputIteratorPtr;
Guid AinputIteratorIID = typeof(IBMDSwitcherAudioInputIterator).GUID;
m_audiomixer.CreateIterator(ref AinputIteratorIID, out AinputIteratorPtr);
if (AinputIteratorPtr != null)
{
AinputIterator =(IBMDSwitcherAudioInputIterator)Marshal.GetObjectForIUnknown(AinputIteratorPtr);
}
if (AinputIteratorPtr != null)
{
IBMDSwitcherAudioInput Ainput;
AinputIterator.Next(out Ainput);
while (Ainput != null)
{
AudioInputMonitor m_audioInputMonitor = new AudioInputMonitor(Ainput);
Ainput.AddCallback(m_audioInputMonitor);
m_audioInputMonitor.GainChanged += new SwitcherEventHandler(OnAInputGainChanged);
m_audioInputMonitor.IsMixedInChanged += new SwitcherEventHandler(OnIsMixedInChanged);
m_audioInputMonitors.Add(m_audioInputMonitor);
AinputIterator.Next(out Ainput);
}
}
This triggers my OnAInputGainChanged and OnIsMixedInChanged functions but how can I know which channel gain or MixedIn has changed ? I've tried to run an iterator but it looks to take too much time and the function reruns before it has been completed.
The eventhandler should at least pass the InputID so a command like audio_mixer.input(InputID).GetGain (out Gain) would return the changed value in only one step.
Could you provide a working sample c# source code that controls the audio mixer ( and set sliders position feedback) ? This would really help me !
Thanks in advance !
Emmanuel
- Attachments
-
- softpanel
- panel.png (143.69 KiB) Viewed 1980 times