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