GetFloats for multiple indexes

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

Ben Harper

  • Posts: 37
  • Joined: Sun Jan 12, 2014 4:56 pm

GetFloats for multiple indexes

PostTue May 02, 2023 11:13 pm

Hi,
May be being silly here but for the life of me can't figure this out.
Reading ATEM status using the BMDSwitcherAPI

I have a Camera Controller that is notifying me on change for things like Aperture, Gain, etc.
It works for all the items in the protocol document where one Category/Parameter is one value
but I cannot work out the way for when it is multiple, for instance the four values I get from the gamma in colour category.
This works for iris
Code: Select all
double irisValue;
cameraValue.GetFloats(1, 0, 2, 1, out irisValue);

This gets me the value of 'red' I think. if I change '4' to any other value e.g. try and get indexes 0-3 or something, it fails with error of out of range
Code: Select all
double lift1;
cameraValue.GetFloats(1, 8, 0, 4, out lift1);

this gives an error, for instance
Code: Select all
double lift1;
cameraValue.GetFloats(1, 8, 0, 0, out lift1);
Offline

Cameron Nichols

Blackmagic Design

  • Posts: 443
  • Joined: Mon Sep 04, 2017 4:05 am

Re: GetFloats for multiple indexes

PostFri May 12, 2023 4:52 am

Hi Ben,

Try working with unmanaged code for this task:
Code: Select all
double[] readLiftAdjust = new double[4];
IntPtr readLiftAdjustPtr = Marshal.AllocHGlobal(Marshal.SizeOf(readLiftAdjust[0]) * readLiftAdjust.Length);

try
{
   unsafe
   {
      double* readLiftAdjustDeref = (double*)readLiftAdjustPtr.ToPointer();
      cameraControl.GetFloats(
         cameraNumber,                   // Camera number
         8,                              // Color Correction
         0,                              // Lift Adjust
         (uint)readLiftAdjust.Length,    // Array size
         out *readLiftAdjustDeref        // Single element array with the desired value
      );
   }
   Marshal.Copy(readLiftAdjustPtr, readLiftAdjust, 0, readLiftAdjust.Length);
}
finally
{
   Marshal.FreeHGlobal(readLiftAdjustPtr);
}
Regards
Cameron

Return to Software Developers

Who is online

Users browsing this forum: No registered users and 6 guests