Home > APIs > AppServer API > Examples > Timeline and Transport Control > Getting and Setting Channel Gang Properties
Getting and Setting Channel Gang Properties
Getting and Setting Channel Gang Properties
The image below is the channel ganging window in AppCenter Pro configuration. You will see the Ganging option in the Configuration panel only if you have AppCenter Pro licensed for your K2. Contact GVDeveloperSupport@grassvalley.com for more information.
To get or set channel ganging properties via the AppServer API do the following:
If you do not want to own the channel, you can query whether a channel is ganged and to which gang it belongs from the channel status interface:
[C#] string appName = "YourApplicationName"; string channel = "C1"; // create a chanstatus object IChanStatus ichanStatus = iappServer.CreateChanStatus(appName, channel); // get multiple properties object[] results = (object[]) ichanStatus.GetStatus("ganged+gangindex"); // "ganged" is either true or false // not ganged: "gangindex" == -1; gang 1: "gangindex" == 0; gang 2: "gangindex" == 1 foreach (object obj in results) { Console.WriteLine("obj = " + obj); } ichanStatus.Dispose();
[C++] // create a chanstatus object IChanStatusPtr spChanStatus; HRESULT hr = spAppServer->CreateChanStatus(_bstr_t("YourApplicationName"), _bstr_t("C1"), &spChanStatus); VARIANT varResult; // get multiple properties hr = spChanStatus->GetStatus(_bstr_t("ganged+gangindex"), &varResult); // "ganged" is either true or false // not ganged: "gangindex" == -1; gang 1: "gangindex" == 0; gang 2: "gangindex" == 1 SAFEARRAY *pArray = varResult.parray; VARIANT *pVar = NULL; long arrIndex[1]; arrIndex[0] = 0; SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar); BOOL bGanged = (pVar->boolVal == VARIANT_TRUE); arrIndex[0] = 1; SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar); int nGangIndex= pVar->iVal; printf("Ganged: %d Gang Index: %d\n\n", bGanged, nGangIndex); hr = spController->CloseChannel();
If you want to set the gang properties, you'll need to create a controller for the channel and set or get properties like this:
[C#] string appName = "YourApplicationName"; string channel = "C1"; bool isNewController = false; // create a controller ISimpleController icontroller = iappServer.CreateController( appName, channel, out isNewController); // not ganged: set "gangindex" = -1 // gang 1: set "gangindex" = 0 // gang 2: set "gangindex" = 1 icontroller.SetChannelProperty("gangindex", 0); // to use a single channel to control the gang: set "singlecontroller" = true icontroller.SetChannelProperty("singlecontroller", true); // to record audio from more than one channel: set "consolidateaudio" = true icontroller.SetChannelProperty("consolidateaudio", false); // to record video from more than one channel: set "consolidatevideo" = true icontroller.SetChannelProperty("consolidatevideo", true);
[C++] short nIsNewController; ISimpleControllerPtr spController; HRESULT hr = spAppServer->CreateController(_bstr_t("YourApplicationName"), _bstr_t("C1"), &nIsNewController, &spController); // not ganged: set "gangindex" = -1 // gang 1: set "gangindex" = 0 // gang 2: set "gangindex" = 1 spController->SetChannelProperty(_bstr_t("gangindex"), 0); // tp use a single channel to control the gang: set "singlecontroller" = true VARIANT_BOOL singlecontroller(FALSE); spController->SetChannelProperty(_bstr_t("singlecontroller"), singlecontroller); // to record audio from more than one channel: set "consolidateaudio" = true VARIANT_BOOL consolidateaudio(FALSE); spController->SetChannelProperty(_bstr_t("consolidateaudio"), consolidateaudio); // to record video from more than one channel: set "consolidatevideo" = true VARIANT_BOOL consolidatevideo(FALSE); spController->SetChannelProperty(_bstr_t("consolidatevideo"), consolidatevideo); VARIANT varResult; // get all gang properties of the channel // note: currently the "singlecontroller" property only returns // a valid value if the channel IS ganged. hr = spController->GetChannelProperty(_bstr_t("ganged+gangindex+singlecontroller+ consolidatevideo+consolidateaudio"), &varResult); SAFEARRAY *pArray = varResult.parray; VARIANT *pVar = NULL; long arrIndex[1]; arrIndex[0] = 0; SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar); BOOL bGanged = (pVar->boolVal == VARIANT_TRUE); arrIndex[0] = 1; SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar); int nGangIndex= pVar->iVal; arrIndex[0] = 2; SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar); BOOL bSingleController = (pVar->boolVal == VARIANT_TRUE); arrIndex[0] = 3; SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar); BOOL bConsolidateVideo = (pVar->boolVal == VARIANT_TRUE); arrIndex[0] = 4; SafeArrayPtrOfIndex(pArray, arrIndex, (void **)&pVar); BOOL bConsolidateAudio = (pVar->boolVal == VARIANT_TRUE); printf("Ganged: %d Gang Index: %d Single Controller: %d Consolidate Video: %d Consolidate Audio: %d\n\n", bGanged, nGangIndex, bSingleController, bConsolidateVideo, bConsolidateAudio); hr = spController->CloseChannel();