Page 1 of 1

ATEM API Iterator help

PostPosted: Tue Sep 05, 2017 3:50 pm
by Bostjan Nagode
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

Re: ATEM API Iterator help

PostPosted: Thu Sep 07, 2017 7:51 pm
by Ian Morrish
This GitHub project should get you started.
https://github.com/YSTV/BMDSwitcherApps

Re: ATEM API Iterator help

PostPosted: Thu Sep 07, 2017 8:14 pm
by Bostjan Nagode
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

Re: ATEM API Iterator help

PostPosted: Fri Sep 08, 2017 3:49 am
by Ian Morrish
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

Re: ATEM API Iterator help

PostPosted: Mon Sep 11, 2017 5:02 pm
by Bostjan Nagode
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

Re: ATEM API Iterator help

PostPosted: Tue Sep 19, 2017 7:53 am
by Bostjan Nagode
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

Re: ATEM API Iterator help

PostPosted: Tue Sep 19, 2017 8:31 pm
by Ian Morrish
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.

Re: ATEM API Iterator help

PostPosted: Wed Sep 20, 2017 7:35 pm
by Ian Morrish
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

Re: ATEM API Iterator help

PostPosted: Tue Sep 26, 2017 7:35 pm
by Bostjan Nagode
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

Re: ATEM API Iterator help

PostPosted: Wed Sep 27, 2017 9:47 am
by mariareese
DSK is fair enough, but looking for more advancement .. having similar issue .. :(

Re: ATEM API Iterator help

PostPosted: Wed Sep 27, 2017 6:05 pm
by Bostjan Nagode
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

Re: ATEM API Iterator help

PostPosted: Tue Aug 04, 2020 1:39 pm
by jimtahler
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?

Re: ATEM API Iterator help

PostPosted: Mon Nov 22, 2021 12:51 am
by chris08
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?