本文整理汇总了C++中TTObject::attributes方法的典型用法代码示例。如果您正苦于以下问题:C++ TTObject::attributes方法的具体用法?C++ TTObject::attributes怎么用?C++ TTObject::attributes使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTObject
的用法示例。
在下文中一共展示了TTObject::attributes方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: wrapTTModularClassAsMaxClass
TTErr wrapTTModularClassAsMaxClass(TTSymbol& ttblueClassName, const char* maxClassName, WrappedClassPtr* c, ModularSpec* specificities)
{
TTObject o;
TTValue v, args;
WrappedClass* wrappedMaxClass = NULL;
TTSymbol TTName;
t_symbol *MaxName = NULL;
TTUInt16 i;
jamoma_init();
common_symbols_init();
if (!wrappedMaxClasses)
wrappedMaxClasses = hashtab_new(0);
wrappedMaxClass = new WrappedClass;
wrappedMaxClass->maxClassName = gensym(maxClassName);
wrappedMaxClass->maxClass = class_new( maxClassName,
(method)wrappedModularClass_new,
(method)wrappedModularClass_free,
sizeof(WrappedModularInstance),
(method)0L,
A_GIMME,
0);
wrappedMaxClass->ttblueClassName = ttblueClassName;
wrappedMaxClass->validityCheck = NULL;
wrappedMaxClass->validityCheckArgument = NULL;
wrappedMaxClass->options = NULL;
wrappedMaxClass->maxNamesToTTNames = hashtab_new(0);
wrappedMaxClass->specificities = specificities;
#ifdef AUDIO_EXTERNAL
// Setup our class to work with MSP
class_dspinit(wrappedMaxClass->maxClass);
#endif
// Create a temporary instance of the class so that we can query it.
o = TTObject(ttblueClassName);
// Register Messages as Max method
o.messages(v);
for (i = 0; i < v.size(); i++)
{
TTName = v[i];
if (TTName == TTSymbol("test") ||
TTName == TTSymbol("getProcessingBenchmark") ||
TTName == TTSymbol("resetBenchmarking"))
continue;
else if ((MaxName = jamoma_TTName_To_MaxName(TTName)))
{
hashtab_store(wrappedMaxClass->maxNamesToTTNames, MaxName, (t_object*)(TTName.rawpointer()));
class_addmethod(wrappedMaxClass->maxClass, (method)wrappedModularClass_anything, MaxName->s_name, A_GIMME, 0);
}
}
// Register Attributes as Max attr
o.attributes(v);
for (i = 0; i < v.size(); i++) {
TTAttributePtr attr = NULL;
t_symbol *maxType = _sym_atom;
TTName = v[i];
#ifdef AUDIO_EXTERNAL
// the enable word is already used by a message declared in the dsp_init method
if (TTName == TTSymbol("enable"))
continue;
#endif
// we want to hide service attribute for Max external
if (TTName == TTSymbol("service"))
continue;
if ((MaxName = jamoma_TTName_To_MaxName(TTName))) {
if (TTName == kTTSym_bypass && wrappedMaxClass->maxClassName != gensym("j.in") && wrappedMaxClass->maxClassName != gensym("j.in~"))
continue;
o.instance()->findAttribute(TTName, &attr);
if (attr->type == kTypeFloat32)
maxType = _sym_float32;
else if (attr->type == kTypeFloat64)
maxType = _sym_float64;
else if (attr->type == kTypeSymbol || attr->type == kTypeString)
maxType = _sym_symbol;
else if (attr->type == kTypeLocalValue)
maxType = _sym_atom;
hashtab_store(wrappedMaxClass->maxNamesToTTNames, MaxName, (t_object*)(TTName.rawpointer()));
class_addattr(wrappedMaxClass->maxClass, attr_offset_new(MaxName->s_name, maxType, 0, (method)wrappedModularClass_attrGet, (method)wrappedModularClass_attrSet, 0));
// Add display styles for the Max 5 inspector
if (attr->type == kTypeBoolean)
CLASS_ATTR_STYLE(wrappedMaxClass->maxClass, (char*)TTName.c_str(), 0, "onoff");
if (TTName == TTSymbol("fontFace"))
CLASS_ATTR_STYLE(wrappedMaxClass->maxClass, "fontFace", 0, "font");
}
//.........这里部分代码省略.........