本文整理汇总了C++中Context::EnumerateExistingNodes方法的典型用法代码示例。如果您正苦于以下问题:C++ Context::EnumerateExistingNodes方法的具体用法?C++ Context::EnumerateExistingNodes怎么用?C++ Context::EnumerateExistingNodes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Context
的用法示例。
在下文中一共展示了Context::EnumerateExistingNodes方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: openCommon
void openCommon()
{
XnStatus nRetVal = XN_STATUS_OK;
g_bIsDepthOn = false;
g_bIsImageOn = false;
g_bIsIROn = false;
g_bIsAudioOn = false;
NodeInfoList list;
nRetVal = g_Context.EnumerateExistingNodes(list);
if (nRetVal == XN_STATUS_OK)
{
for (NodeInfoList::Iterator it = list.Begin(); it != list.End(); ++it)
{
switch ((*it).GetDescription().Type)
{
case XN_NODE_TYPE_DEVICE:
(*it).GetInstance(g_Device);
break;
case XN_NODE_TYPE_DEPTH:
g_bIsDepthOn = true;
(*it).GetInstance(g_Depth);
break;
case XN_NODE_TYPE_IMAGE:
g_bIsImageOn = true;
(*it).GetInstance(g_Image);
break;
case XN_NODE_TYPE_IR:
g_bIsIROn = true;
(*it).GetInstance(g_IR);
break;
case XN_NODE_TYPE_AUDIO:
g_bIsAudioOn = true;
(*it).GetInstance(g_Audio);
break;
case XN_NODE_TYPE_PLAYER:
g_bIsPlayerOn = true;
(*it).GetInstance(g_Player);
}
}
}
XnCallbackHandle hDummy;
g_Context.RegisterToErrorStateChange(onErrorStateChanged, NULL, hDummy);
initConstants();
readFrame();
}
示例2: openCommon
/**
* Inicia los nodos de información provinientes de Kinect
*
*/
void openCommon(){
XnStatus nRetVal = XN_STATUS_OK;
NodeInfoList list;
nRetVal = g_Context.EnumerateExistingNodes(list);
if (nRetVal == XN_STATUS_OK){
for (NodeInfoList::Iterator it = list.Begin(); it != list.End(); ++it){
switch ((*it).GetDescription().Type){
case XN_NODE_TYPE_DEPTH:
(*it).GetInstance(g_DepthGenerator);
break;
case XN_NODE_TYPE_IMAGE:
(*it).GetInstance(g_ImageGenerator);
break;
case XN_NODE_TYPE_USER:
(*it).GetInstance(g_UserGenerator);
break;
case XN_NODE_TYPE_PLAYER:
(*it).GetInstance(g_Player);
break;
}
}
}
}//openCommon
示例3: UpdateFrameSync
XnStatus GeneratorWatcher::UpdateFrameSync()
{
// go over all nodes, and find the frame synced one
Context context;
m_generator.GetContext(context);
NodeInfoList nodes;
XnStatus nRetVal = context.EnumerateExistingNodes(nodes);
XN_IS_STATUS_OK(nRetVal);
for (NodeInfoList::Iterator it = nodes.Begin(); it != nodes.End(); ++it)
{
NodeInfo info = *it;
// make sure this is a generator
if (xnIsTypeDerivedFrom(info.GetDescription().Type, XN_NODE_TYPE_GENERATOR))
{
Generator otherGen;
nRetVal = info.GetInstance(otherGen);
XN_IS_STATUS_OK(nRetVal);
if (m_generator.GetFrameSyncCap().IsFrameSyncedWith(otherGen))
{
nRetVal = NotifyStringPropChanged(XN_PROP_FRAME_SYNCED_WITH, otherGen.GetName());
XN_IS_STATUS_OK(nRetVal);
return XN_STATUS_OK;
}
}
}
// if we got here, we're not frame synced
nRetVal = NotifyStringPropChanged(XN_PROP_FRAME_SYNCED_WITH, "");
XN_IS_STATUS_OK(nRetVal);
return XN_STATUS_OK;
}
示例4: main
int main(int argc, char* argv[])
{
XnStatus nRetVal = XN_STATUS_OK;
Context context;
EnumerationErrors errors;
Mode mode;
// default mode
#if XN_PLATFORM == XN_PLATFORM_WIN32
mode = MODE_PLAY;
#else
mode = MODE_RECORD;
#endif
// check if mode was provided by user
if (argc > 1)
{
if (strcmp(argv[1], "play") == 0)
{
mode = MODE_PLAY;
}
else if (strcmp(argv[1], "record") == 0)
{
mode = MODE_RECORD;
}
else
{
printUsage(argv[0]);
return -1;
}
}
// make sure mode is valid
#if XN_PLATFORM != XN_PLATFORM_WIN32
if (mode == MODE_PLAY)
{
printf("Playing is not supported on this platform!\n");
return -1;
}
#endif
ScriptNode scriptNode;
nRetVal = context.InitFromXmlFile(SAMPLE_XML_PATH, scriptNode);
if (nRetVal == XN_STATUS_NO_NODE_PRESENT)
{
XnChar strError[1024];
errors.ToString(strError, 1024);
printf("%s\n", strError);
return (nRetVal);
}
else if (nRetVal != XN_STATUS_OK)
{
printf("Open failed: %s\n", xnGetStatusString(nRetVal));
return (nRetVal);
}
// find audio nodes
AudioGenerator gens[nSupportedNodes];
XnUInt32 nNodes = 0;
NodeInfoList list;
nRetVal = context.EnumerateExistingNodes(list, XN_NODE_TYPE_AUDIO);
CHECK_RC(nRetVal, "Enumerate audio nodes");
for (NodeInfoList::Iterator it = list.Begin(); it != list.End(); ++it)
{
NodeInfo info = *it;
nRetVal = info.GetInstance(gens[nNodes]);
CHECK_RC(nRetVal, "Get audio node");
nNodes++;
}
if (nNodes == 0)
{
printf("No audio node was found!\n");
return -1;
}
if (mode == MODE_PLAY)
{
nRetVal = play(context, gens, nNodes);
}
else if (mode == MODE_RECORD)
{
nRetVal = record(context, gens, nNodes);
}
scriptNode.Release();
for (int i = 0; i < nSupportedNodes; ++i)
gens[i].Release();
context.Release();
return nRetVal;
}