ATEM API Iterator help

Ask software engineering and SDK questions for developers working on Mac OS X, Windows or Linux.
  • Author
  • Message
Offline

Bostjan Nagode

  • Posts: 6
  • Joined: Tue Sep 05, 2017 3:15 pm

ATEM API Iterator help

PostTue Sep 05, 2017 3:50 pm

Dear,

is there anyone that can help me with issue about DSK key, i just can't find the way to do:
-Get info about DSK1 On/off (status)
-Select key & fill input for DSK1 keyer

I'm doing in c# and vb.net, i have a code for input selection, take ME1 & ME 2, but my base problem is that i simply don't understand the iterator methods. Simply im stuck at "how to create iterator for Key functions" Any help would be really appreciated, any kind of it. Thanks to all in advance,

Best, Bostjan
Offline

Ian Morrish

  • Posts: 580
  • Joined: Sun Jan 18, 2015 9:24 pm
  • Location: New Zealand

Re: ATEM API Iterator help

PostThu Sep 07, 2017 7:51 pm

This GitHub project should get you started.
https://github.com/YSTV/BMDSwitcherApps
Regards,
Ian Morrish
Video Integrated Scripting Environment
(Windows PowerShell with ATEM driver + more)
https://ianmorrish.wordpress.com
Offline

Bostjan Nagode

  • Posts: 6
  • Joined: Tue Sep 05, 2017 3:15 pm

Re: ATEM API Iterator help

PostThu Sep 07, 2017 8:14 pm

Ian,
thanks a lot, i will test on ATEM tomorrow and will report back. Thanks again! I can see (hope clearly) the key iterator procedure. I will try further on with key fill and alpha selection and then with supersource... I will report back in case i travel into blind way...
Best, Bostjan
Offline

Ian Morrish

  • Posts: 580
  • Joined: Sun Jan 18, 2015 9:24 pm
  • Location: New Zealand

Re: ATEM API Iterator help

PostFri Sep 08, 2017 3:49 am

Just to warn you, DSK is relatively easy as it only needs a switcher object. Most other things also need a reference to a MixerEffect, and if you are talking about SuperSource then that is even more iterators.

There is also a good explanation on Aux's (which is the same way you have to get the SuperSource input) here viewtopic.php?f=12&t=41964&p=281558&hilit=aux#p242746
Regards,
Ian Morrish
Video Integrated Scripting Environment
(Windows PowerShell with ATEM driver + more)
https://ianmorrish.wordpress.com
Offline

Bostjan Nagode

  • Posts: 6
  • Joined: Tue Sep 05, 2017 3:15 pm

Re: ATEM API Iterator help

PostMon Sep 11, 2017 5:02 pm

Ian,

thanks for your asistance, The DSK is working as it should, thanks again.
If someone is in same trouble, i can provide sample in vb.net..

Best, Bostjan
Offline

Bostjan Nagode

  • Posts: 6
  • Joined: Tue Sep 05, 2017 3:15 pm

Re: ATEM API Iterator help

PostTue Sep 19, 2017 7:53 am

Hello,

Well, i have done DSK 1 and 2, that is now ok. But again, im going now to Supersource, where i must do a Box input selection. Any tip would be apreciated.

If i do

Dim m_SS_switcher_local As IBMDSwitcherSuperSourceBox
Dim meSSIterator As IBMDSwitcherSuperSourceBoxIterator
SwitcherAPIHelper.CreateIterator(m_SS_switcher_local, meSSIterator)
If meSSIterator IsNot Nothing Then
'meSSIterator is always returned Nothing
End if

But meSSiterator is always returning nothing...
According to documentation An IBMDSwitcherSuperSourceBox object will be returned after a successful call to IBMDSwitcherSuperSourceBoxIterator::Next method.

Thanks in advance,

Bostjan Nagode
Offline

Ian Morrish

  • Posts: 580
  • Joined: Sun Jan 18, 2015 9:24 pm
  • Location: New Zealand

Re: ATEM API Iterator help

PostTue Sep 19, 2017 8:31 pm

Hi,
Supersource must be obtained before your can get boxes. Supersource is based on an input, just like Aux. If you follow the Aux pattern I mention below, it will show you how to get this from iterating the inputs.
Regards,
Ian Morrish
Video Integrated Scripting Environment
(Windows PowerShell with ATEM driver + more)
https://ianmorrish.wordpress.com
Offline

Ian Morrish

  • Posts: 580
  • Joined: Sun Jan 18, 2015 9:24 pm
  • Location: New Zealand

Re: ATEM API Iterator help

PostWed Sep 20, 2017 7:35 pm

Based on the Aux example (credit to JohnB for this which helped me heaps). You need to use the Input iterator code from viewtopic.php?f=12&t=41964&p=281558&hilit=aux#p242755 to properly get the SuperSource object.

Look for the "if (InputPortType==" line and change to

if (inputPortType == _BMDSwitcherPortType.bmdSwitcherPortTypeSuperSource)

inside that conditional code...

IBMDSwitcherInputSuperSource superSource = (IBMDSwitcherInputSuperSource)input;
//put box iterator here using SwitcherAPIHelper.CreateIterator(superSource,meSSIterator)


I think your create iterator function just needs to use superSource, rather than
Regards,
Ian Morrish
Video Integrated Scripting Environment
(Windows PowerShell with ATEM driver + more)
https://ianmorrish.wordpress.com
Offline

Bostjan Nagode

  • Posts: 6
  • Joined: Tue Sep 05, 2017 3:15 pm

Re: ATEM API Iterator help

PostTue Sep 26, 2017 7:35 pm

Dear all,

thanks for your help, i have suceeded with SuperSourceBox control, it was quite easy on the end. If someone needs assistance, it's more than welcome.

Ian, Thanks a lot!

Best, Bostjan Nagode
Offline

mariareese

  • Posts: 1
  • Joined: Wed Sep 27, 2017 9:37 am

Re: ATEM API Iterator help

PostWed Sep 27, 2017 9:47 am

DSK is fair enough, but looking for more advancement .. having similar issue .. :(
Offline

Bostjan Nagode

  • Posts: 6
  • Joined: Tue Sep 05, 2017 3:15 pm

Re: ATEM API Iterator help

PostWed Sep 27, 2017 6:05 pm

Clumsy solution, it is in progress, but it's working:

Dim inputIterator As IBMDSwitcherInputIterator = Nothing
Dim inputIteratorPtr As IntPtr
Dim inputIteratorIID As Guid = GetType(IBMDSwitcherInputIterator).GUID
Me.m_switcher.CreateIterator(inputIteratorIID, inputIteratorPtr)
inputIterator = DirectCast(Marshal.GetObjectForIUnknown(inputIteratorPtr), IBMDSwitcherInputIterator)
If inputIterator IsNot Nothing Then
Dim inputin As IBMDSwitcherInput
inputIterator.[Next](inputin)
Dim SSCount As Integer = 0
While inputin IsNot Nothing
Dim inputPortType As BMDSwitcherAPI._BMDSwitcherPortType
inputin.GetPortType(inputPortType)
If inputPortType = BMDSwitcherAPI._BMDSwitcherPortType.bmdSwitcherPortTypeSuperSource Then

Dim SSAux As IBMDSwitcherInputSuperSource = DirectCast(inputin, IBMDSwitcherInputSuperSource)
Dim SS_boxiterator As IBMDSwitcherSuperSourceBoxIterator = Nothing
Dim inputIteratorBOXPtr As IntPtr
Dim inputIteratorBOXIID As Guid = GetType(IBMDSwitcherSuperSourceBoxIterator).GUID
SSAux.CreateIterator(inputIteratorBOXIID, inputIteratorBOXPtr)
SS_boxiterator = DirectCast(Marshal.GetObjectForIUnknown(inputIteratorBOXPtr), IBMDSwitcherSuperSourceBoxIterator)
Dim inputbox As IBMDSwitcherSuperSourceBox
SS_boxiterator.[Next](m_SS_0)
SS_boxiterator.[Next](m_SS_1)
SS_boxiterator.[Next](m_SS_2)
SS_boxiterator.[Next](m_SS_3)
SS_boxiterator.[Next](m_SS_4)
SSAux.GetInputFill(Super_source_input_BG)
m_SS_0.GetInputSource(Super_source_input_S1)
m_SS_1.GetInputSource(Super_source_input_S2)
m_SS_2.GetInputSource(Super_source_input_S3)
m_SS_3.GetInputSource(Super_source_input_S4)
End If
inputIterator.[Next](inputin)
End While
End If

So SSAux.CreateIterator(inputIteratorBOXIID, inputIteratorBOXPtr)
is the most important line. You must interate further on from your supersource.... (in my case SSAux).

Best, Bostjan
Offline

jimtahler

  • Posts: 1
  • Joined: Mon Aug 03, 2020 3:02 pm
  • Real Name: jim Tahler

Re: ATEM API Iterator help

PostTue Aug 04, 2020 1:39 pm

bostjan, i would like to converse with you about your VB.NET code. all i want to do is drive some relays to make tally lights work, so i only need to know which input is preview and which input is program. can you help?
Offline

chris08

  • Posts: 3
  • Joined: Thu Jul 01, 2021 10:09 pm
  • Real Name: Christian Dommel

Re: ATEM API Iterator help

PostMon Nov 22, 2021 12:51 am

I have the same problem in C#.
This parts works to get the input and to edit the background/foreground settings:

IBMDSwitcherInputIterator input_iterator = null;
IntPtr input_iterator_ptr;
Guid input_iterator_iid = typeof(IBMDSwitcherInputIterator).GUID;
m_switcher.CreateIterator(ref input_iterator_iid, out input_iterator_ptr);

if (input_iterator_ptr != null)
{
input_iterator = (IBMDSwitcherInputIterator)Marshal.GetObjectForIUnknown(input_iterator_ptr);
}
else
{
return false;
}

if (input_iterator != null)
{
long input_id = 6000;
IBMDSwitcherInput super_source;
input_iterator.GetById(input_id, out super_source);
atem_object_super_source_input = (IBMDSwitcherInputSuperSource)super_source;
return true;
}


But now I trie to control the 4 boxes and the border, but this don't work.

// ---- this don't work ----
IBMDSwitcherSuperSourceBoxIterator super_source_box_iterator = null;
IntPtr super_source_box_iterator_ptr;
Guid super_source_box_iterator_iid = typeof(IBMDSwitcherSuperSourceBoxIterator).GUID;
atem_object_super_source_input.CreateIterator(ref super_source_box_iterator_iid, out super_source_box_iterator_ptr);

if (super_source_box_iterator_ptr != null)
{
super_source_box_iterator = (IBMDSwitcherSuperSourceBoxIterator)Marshal.GetObjectForIUnknown(super_source_box_iterator_ptr);
}
else
{
return false;
}

if (super_source_box_iterator != null)
{
super_source_box_iterator.Next(out atem_object_super_source_box_1);
super_source_box_iterator.Next(out atem_object_super_source_box_2);
super_source_box_iterator.Next(out atem_object_super_source_box_3);
super_source_box_iterator.Next(out atem_object_super_source_box_4);
}

// ---- this also don't work ----
atem_object_super_source_border = (IBMDSwitcherSuperSourceBorder)super_source;


Can anybody help me?

Return to Software Developers

Who is online

Users browsing this forum: michaelZ and 17 guests