本文整理汇总了C++中AFfilehandle::getInstrument方法的典型用法代码示例。如果您正苦于以下问题:C++ AFfilehandle::getInstrument方法的具体用法?C++ AFfilehandle::getInstrument怎么用?C++ AFfilehandle::getInstrument使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类AFfilehandle
的用法示例。
在下文中一共展示了AFfilehandle::getInstrument方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: _af_instparam_get
/*
This routine gets instrument parameters.
npv is number of valid AUpvlist pairs
*/
void _af_instparam_get (AFfilehandle file, int instid, AUpvlist pvlist, int npv,
bool forceLong)
{
if (!_af_filehandle_ok(file))
return;
Instrument *instrument = file->getInstrument(instid);
if (!instrument)
return;
if (AUpvgetmaxitems(pvlist) < npv)
npv = AUpvgetmaxitems(pvlist);
for (int i=0; i < npv; i++)
{
int param;
AUpvgetparam(pvlist, i, ¶m);
int j;
if ((j = _af_instparam_index_from_id(file->m_fileFormat, param)) == -1)
/* no parameter with that id; ignore */
continue;
int type = _af_units[file->m_fileFormat].instrumentParameters[j].type;
/*
forceLong is true when this routine called by
afGetInstParamLong().
*/
if (forceLong && type != AU_PVTYPE_LONG)
{
_af_error(AF_BAD_INSTPTYPE, "type of instrument parameter %d is not AU_PVTYPE_LONG", param);
continue;
}
AUpvsetvaltype(pvlist, i, type);
switch (type)
{
case AU_PVTYPE_LONG:
AUpvsetval(pvlist, i, &instrument->values[j].l);
break;
case AU_PVTYPE_DOUBLE:
AUpvsetval(pvlist, i, &instrument->values[j].d);
break;
case AU_PVTYPE_PTR:
AUpvsetval(pvlist, i, &instrument->values[j].v);
break;
default:
_af_error(AF_BAD_INSTPTYPE, "invalid instrument parameter type %d", type);
return;
}
}
}
示例2: _af_instparam_set
/*
This routine checks and sets instrument parameters.
npv is number of valid AUpvlist pairs.
*/
void _af_instparam_set (AFfilehandle file, int instid, AUpvlist pvlist, int npv)
{
if (!_af_filehandle_ok(file))
return;
if (!file->checkCanWrite())
return;
Instrument *instrument = file->getInstrument(instid);
if (!instrument)
return;
if (AUpvgetmaxitems(pvlist) < npv)
npv = AUpvgetmaxitems(pvlist);
for (int i=0; i < npv; i++)
{
int param;
AUpvgetparam(pvlist, i, ¶m);
int j;
if ((j = _af_instparam_index_from_id(file->m_fileFormat, param)) == -1)
/* no parameter with that id; ignore */
continue;
if (!file->isInstrumentParameterValid(pvlist, i))
/* bad parameter value; ignore */
continue;
int type = _af_units[file->m_fileFormat].instrumentParameters[j].type;
switch (type)
{
case AU_PVTYPE_LONG:
AUpvgetval(pvlist, i, &instrument->values[j].l);
break;
case AU_PVTYPE_DOUBLE:
AUpvgetval(pvlist, i, &instrument->values[j].d);
break;
case AU_PVTYPE_PTR:
AUpvgetval(pvlist, i, &instrument->values[j].v);
break;
default:
return;
}
}
}