当前位置: 首页>>代码示例>>C++>>正文


C++ TTSymbol类代码示例

本文整理汇总了C++中TTSymbol的典型用法代码示例。如果您正苦于以下问题:C++ TTSymbol类的具体用法?C++ TTSymbol怎么用?C++ TTSymbol使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


在下文中一共展示了TTSymbol类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。

示例1: main

int main(int argc, const char * argv[])
{
	std::cout << "BEGIN testing for AnalysisLib...\n";                  // CUSTOMIZE
    TTLoadJamomaExtension_AnalysisLib();                                // CUSTOMIZE
	
	TTValue classNames;
	
	// if the follow group tag is present within the thisTTClassTags definition, the class will be tested
    TTValue testClassesWithTheseTags(TT("dspAnalysisLib"));             // CUSTOMIZE
	TTObject::GetRegisteredClassNamesForTags(classNames, testClassesWithTheseTags);
	
	for (int i=0; i<classNames.size(); i++) {
		TTSymbol name = classNames[i];

		try {
			TTObject obj(name);
			std::cout << "TESTING " << name.string() << std::endl;
			obj.send("test");
		}
		catch (...) {
			TTLogMessage("UnitTest Failure to instantiate object of class %s! \n", name.c_str());
			continue;
		}
	}
	
	std::cout << "END testing of AnalysisLib!\n";                       // CUSTOMIZE
    return 0;
}
开发者ID:ChristianFrisson,项目名称:JamomaCore,代码行数:28,代码来源:test.cpp

示例2: OpGetOperand

MaxErr OpGetOperand(OpPtr self, ObjectPtr attr, AtomCount* argc, AtomPtr* argv)
{
	TTValue v;
	
	self->audioGraphObject->getUnitGenerator()->getAttributeValue(TT("operand"), v);
	
	*argc = v.getSize();
	if (!(*argv)) // otherwise use memory passed in
		*argv = (t_atom *)sysmem_newptr(sizeof(t_atom) * v.getSize());
	
	for (int i=0; i<v.getSize(); i++) {
		if(v.getType(i) == kTypeFloat32 || v.getType(i) == kTypeFloat64){
			TTFloat64	value;
			v.get(i, value);
			atom_setfloat(*argv+i, value);
		}
		else if(v.getType(i) == kTypeSymbol){
			TTSymbol	value;
			v.get(i, value);
			atom_setsym(*argv+i, gensym((char*)value.c_str()));
		}
		else{	// assume int
			TTInt32		value;
			v.get(i, value);
			atom_setlong(*argv+i, value);
		}
	}	
	return MAX_ERR_NONE;
}
开发者ID:imclab,项目名称:JamomaAudioGraph,代码行数:29,代码来源:jcom.op.cpp

示例3: ramp_setFunction

void ramp_setFunction(t_ramp *x, void *attr, long argc, t_atom *argv)
{
	long		n;
	TTValue		names;
	TTSymbol*	aName;
	TTString	nameString;
	
	// set the function
	x->attr_function = atom_getsym(argv);
	x->rampUnit->setAttributeValue(TT("function"), TT(x->attr_function->s_name));
	
	// cache the function's attribute names
	x->parameterNames->clear();
	x->rampUnit->getFunctionParameterNames(names);
	n = names.getSize();
	for (int i=0; i<n; i++) {
		names.get(i, &aName);
		nameString = aName->getString();
		
		if (aName == TT("bypass") || aName == TT("mute") || aName == TT("maxNumChannels") || aName == TT("sampleRate"))
			continue;										// don't publish these parameters
		
		if (nameString[0] > 64 && nameString[0] < 91) {		// ignore all params not starting with upper-case
			nameString[0] += 32;							// convert first letter to lower-case for Max
			
			TTValuePtr v = new TTValue(aName);
			x->parameterNames->append(TT(nameString.c_str()), *v);
		}
	}	
}
开发者ID:OlivierBaudry,项目名称:JamomaModular,代码行数:30,代码来源:jcom.ramp.cpp

示例4: MaxAudioGraphWrappedClass_attrGet

/* The attribute getter */
t_max_err MaxAudioGraphWrappedClass_attrGet(WrappedInstancePtr self, ObjectPtr attr, AtomCount* argc, AtomPtr* argv)
{
	SymbolPtr	attrName = (SymbolPtr)object_method(attr, _sym_getname);
	TTValue		v;
	AtomCount	i;
	
	TTSymbol	ttAttrName(attrName->s_name);

	self->audioGraphObject->getUnitGenerator()->getAttributeValue(ttAttrName, v);

	*argc = v.getSize();
	if (!(*argv)) // otherwise use memory passed in
		*argv = (t_atom *)sysmem_newptr(sizeof(t_atom) * v.getSize());

	for (i=0; i<v.getSize(); i++) {
		if(v.getType(i) == kTypeFloat32 || v.getType(i) == kTypeFloat64){
			TTFloat64	value;
			v.get(i, value);
			atom_setfloat(*argv+i, value);
		}
		else if(v.getType(i) == kTypeSymbol){
			TTSymbol	value;
			v.get(i, value);
			atom_setsym(*argv+i, gensym((char*)value.c_str()));
		}
		else{	// assume int
			TTInt32		value;
			v.get(i, value);
			atom_setlong(*argv+i, value);
		}
	}	
	return MAX_ERR_NONE;
}
开发者ID:imclab,项目名称:JamomaAudioGraph,代码行数:34,代码来源:MaxAudioGraph.cpp

示例5: setMode

TTErr TTSvf::setMode(const TTValue& newValue)
{
	TTSymbol newMode = newValue;
	
	if (newMode == TT("lowpass")) {
		setProcessMethod(processLowpass);
		setCalculateMethod(calculateLowpass);
	}
	else if (newMode == TT("highpass")) {
		setProcessMethod(processHighpass);
		setCalculateMethod(calculateHighpass);
	}
else if (newMode == TT("bandpass")) {
		setProcessMethod(processBandpass);
		setCalculateMethod(calculateBandpass);
	}
else if (newMode == TT("notch")) {
		setProcessMethod(processNotch);
		setCalculateMethod(calculateNotch);
	}
else if (newMode == TT("peak")) {
		setProcessMethod(processPeak);
		setCalculateMethod(calculatePeak);
	}
	else {
		logError("bad mode specified for TTSvf: %s", newMode.c_str());
		return kTTErrInvalidValue;
	}
	
	mMode = newMode;
	return kTTErrNone;
}
开发者ID:Cplaton,项目名称:JamomaCore,代码行数:32,代码来源:TTSvf.cpp

示例6: convertUpperCasedNameInAddress

TTErr convertUpperCasedNameInAddress(TTSymbol upperCasedName, TTAddress& convertedInAddress)
{
	TTUInt32	upperCasedNameSize = strlen(upperCasedName.c_str());
	TTCString	upperCasedNameCString = new char[upperCasedNameSize+1];
	TTUInt32	nbUpperCase = 0;
	TTUInt32	i;
	TTCString	convertedNameCString = NULL;
	TTUInt32	convertedNameSize = 0;
	
	strncpy(upperCasedNameCString, upperCasedName.c_str(), upperCasedNameSize+1);
	
	// "ExampleName"	to	"example/name"
	// "anyOtherExample" to	"any/other/example"
	if ((upperCasedNameCString[0] > 64 && upperCasedNameCString[0] < 91) || (upperCasedNameCString[0] > 96 && upperCasedNameCString[0] < 123)) {
		
		//  count how many upper-case letter there are in the TTName after the first letter
		for (i=1; i<upperCasedNameSize; i++) {
			if (upperCasedNameCString[i] > 64 && upperCasedNameCString[i] < 91)
				nbUpperCase++;
		}
		
		// prepare the convertedName
		convertedNameSize = upperCasedNameSize + nbUpperCase;
		convertedNameCString = new char[convertedNameSize+1];
		
		// convert first letter to lower-case if needed
		if (upperCasedNameCString[0] > 64 && upperCasedNameCString[0] < 91)
			convertedNameCString[0] = upperCasedNameCString[0] + 32;
		else
			convertedNameCString[0] = upperCasedNameCString[0];
		
		// copy each letter while checking upper-case letter to replace them by a / + lower-case letter
		nbUpperCase = 0;
		for (i=1; i<upperCasedNameSize; i++) {
			if (upperCasedNameCString[i] > 64 && upperCasedNameCString[i] < 91) {
				convertedNameCString[i + nbUpperCase] = '/';
				convertedNameCString[i + nbUpperCase + 1] = upperCasedNameCString[i] + 32;
				nbUpperCase++;
			}
			else
				convertedNameCString[i + nbUpperCase] = upperCasedNameCString[i];
		}
		
		// ends the CString with a NULL letter
		convertedNameCString[convertedNameSize] = 0;
		
		convertedInAddress = TTAddress(convertedNameCString);
		
		delete convertedNameCString;
		convertedNameCString = NULL;
	}
	else
		convertedInAddress = TTAddress(upperCasedName);
	
	delete upperCasedNameCString;
	upperCasedNameCString = NULL;

	return kTTErrNone;
}
开发者ID:Cplaton,项目名称:JamomaCore,代码行数:59,代码来源:TTNodeLib.cpp

示例7: wrappedClass_anything

void wrappedClass_anything(TTPtr self, t_symbol* s, long argc, t_atom* argv)
{
	WrappedInstancePtr	x = (WrappedInstancePtr)self;
	TTSymbol			ttName;
	TTValue				v_in;
	TTValue				v_out;
	
//	err = hashtab_lookup(x->wrappedClassDefinition->pdNamesToTTNames, s, (t_object**)&ttName);
    ttName = x->wrappedClassDefinition->pdNamesToTTNames[s->s_name];
    if (ttName.string().empty()) {
        pd_error((t_object*)x, "no method found for %s", s->s_name);
		return;
	}

	if (argc && argv) {
		v_in.resize(argc);
		for (long i=0; i<argc; i++) {
			if (atom_gettype(argv+i) == A_LONG)
				v_in[i] = (TTInt32)atom_getlong(argv+i);
			else if (atom_gettype(argv+i) == A_FLOAT)
				v_in[i] = atom_getfloat(argv+i);
			else if (atom_gettype(argv+i) == A_SYM)
				v_in[i] = TT(atom_getsym(argv+i)->s_name);
			else
				pd_error((t_object*)x, "bad type for message arg");
		}
	}
	x->wrappedObject->send(ttName, v_in, v_out);
		
	// process the returned value for the dumpout outlet
	{
		long	ac = v_out.size();

		if (ac) {
			t_atom*		av = (t_atom*)malloc(sizeof(t_atom) * ac);
			
			for (long i=0; i<ac; i++) {
				if (v_out[0].type() == kTypeSymbol) {
					TTSymbol ttSym;
					ttSym = v_out[i];
					atom_setsym(av+i, gensym((char*)ttSym.c_str()));
				}
				else if (v_out[0].type() == kTypeFloat32 || v_out[0].type() == kTypeFloat64) {
					TTFloat64 f = 0.0;
					f = v_out[i];
					atom_setfloat(av+i, f);
				}
				else {
					TTInt32 l = 0;
					l = v_out[i];
					atom_setfloat(av+i, l);
				}
			}
            outlet_anything(x->dumpOut, s, ac, av);
			free(av);
		}
	}
}
开发者ID:bassik,项目名称:JamomaPureData,代码行数:58,代码来源:TTClassWrapperPd.cpp

示例8: wrappedClass_anything

void wrappedClass_anything(WrappedInstancePtr self, t_symbol* s, long argc, t_atom* argv)
{
	TTValue		v;
	TTSymbol	ttName;
	t_max_err	err;
	
	err = hashtab_lookup(self->wrappedClassDefinition->maxNamesToTTNames, s, (t_object**)&ttName);
	if (err) {
		object_post(SELF, "no method found for %s", s->s_name);
		return;
	}

	if (argc && argv) {
		TTValue	v;
		
		v.resize(argc);
		for (long i=0; i<argc; i++) {
			if (atom_gettype(argv+i) == A_LONG)
				v[i] = (TTInt32)atom_getlong(argv+i);
			else if (atom_gettype(argv+i) == A_FLOAT)
				v[i] = atom_getfloat(argv+i);
			else if (atom_gettype(argv+i) == A_SYM)
				v[i] = TT(atom_getsym(argv+i)->s_name);
			else
				object_error(SELF, "bad type for message arg");
		}
		self->graphObject->mKernel.send(ttName, v, v); // FIXME: TEMPORARY HACK WHILE WE TRANSITION FROM 1-ARG MESSAGES to 2-ARG MESSAGES
		
		// process the returned value for the dumpout outlet
		{
			long	ac = v.size();

			if (ac) {
				t_atom*		av = (t_atom*)malloc(sizeof(t_atom) * ac);
				
				for (long i=0; i<ac; i++) {
					if (v[i].type() == kTypeSymbol) {
						TTSymbol ttSym = v[i];
						atom_setsym(av+i, gensym((char*)ttSym.c_str()));
					}
					else if (v[i].type() == kTypeFloat32 || v[i].type() == kTypeFloat64) {
						TTFloat64 f = v[i];
						atom_setfloat(av+i, f);
					}
					else {
						TTInt32 l = v[i];
						atom_setfloat(av+i, l);
					}
				}
				object_obex_dumpout(self, s, ac, av);
				free(av);
			}
		}
	}
	else
		self->graphObject->mKernel.send(ttName);
}
开发者ID:EQ4,项目名称:JamomaPureData,代码行数:57,代码来源:PureDataGraph.cpp

示例9: UnpackGraphCallback

// C Callback from any Graph Source objects we are observing
void UnpackGraphCallback(UnpackPtr self, TTValue& arg)
{
	TTDictionaryPtr aDictionary = NULL;
	TTValue			v;
	long			ac;
	t_atom*			ap;
	TTBoolean		firstItemASymbol = NO;
	TTSymbol		firstItem;
	
	//arg.get(0, (TTPtr*)(&aDictionary));
	aDictionary = (TTDictionaryPtr)(TTPtr)arg[0];
	aDictionary->getValue(v);
	ac = v.size();
	if (ac) {
		ap = new t_atom[ac];
		for (int i=0; i<ac; i++) {
			if (v[i].type() == kTypeInt8   ||
				v[i].type() == kTypeUInt8  ||
				v[i].type() == kTypeInt16  ||
				v[i].type() == kTypeUInt16 ||
				v[i].type() == kTypeInt32  ||
				v[i].type() == kTypeUInt32 ||
				v[i].type() == kTypeInt64  ||
				v[i].type() == kTypeUInt64)
			{
				TTInt32 ival;
				
				ival = v[i];
				atom_setlong(ap+i, ival);
			}
			else if (v[i].type() == kTypeFloat32 || v[i].type() == kTypeFloat64)
			{
				atom_setfloat(ap+i, v[i]);
			}
			else if (v[i].type() == kTypeSymbol)
			{
				TTSymbol s;
				
				s = v[i];
				atom_setsym(ap+i, gensym((char*)s.c_str()));
				if (i==0) {
					firstItemASymbol = YES;
					firstItem = s;
				}
			}
		}
		
		if (firstItemASymbol)
			outlet_anything(self->graphOutlets[0], gensym((char*)firstItem.c_str()), ac-1, ap+1);
		else if (ac == 1)
			outlet_float(self->graphOutlets[0], atom_getfloat(ap));
		else
			outlet_anything(self->graphOutlets[0], _sym_list, ac, ap);

		delete ap;
	}
}
开发者ID:avilleret,项目名称:JamomaMax,代码行数:58,代码来源:j.unpack.cpp

示例10: MaxAudioGraphWrappedClass_anything

/* Method for "anything" messages */
void MaxAudioGraphWrappedClass_anything(WrappedInstancePtr self, SymbolPtr s, AtomCount argc, AtomPtr argv)
{	
	TTValue		v_in;
	TTValue		v_out;
	TTSymbol	ttName(s->s_name);
	
	if (argc && argv) {
		v_in.setSize(argc);
		
		// Typechecking - we only want ints, floats and symbols
		for (AtomCount i=0; i<argc; i++) {
			if (atom_gettype(argv+i) == A_LONG)
				v_in.set(i, AtomGetInt(argv+i));
			else if (atom_gettype(argv+i) == A_FLOAT)
				v_in.set(i, atom_getfloat(argv+i));
			else if (atom_gettype(argv+i) == A_SYM)
				v_in.set(i, TT(atom_getsym(argv+i)->s_name));
			else
				object_error(SELF, "bad type for message arg");
		}
	}
	// Now that we know that the message is OK we send it on to the wrapped class
	self->audioGraphObject->getUnitGenerator()->sendMessage(ttName, v_in, v_out);
		
		// process the returned value for the dumpout outlet
		{
			AtomCount	ac = v_out.getSize();

			if (ac) {
				AtomPtr		av = (AtomPtr)malloc(sizeof(Atom) * ac);
				
				for (AtomCount i=0; i<ac; i++) {
					if (v_out.getType() == kTypeSymbol){
						TTSymbol ttSym;
						v_out.get(i, ttSym);
						atom_setsym(av+i, gensym((char*)ttSym.c_str()));
					}
					else if (v_out.getType() == kTypeFloat32 || v_out.getType() == kTypeFloat64) {
						TTFloat64 f = 0.0;
						v_out.get(i, f);
						atom_setfloat(av+i, f);
					}
					else {
						TTInt32 l = 0;
						v_out.get(i, l);
						atom_setfloat(av+i, l);
					}
				}
				object_obex_dumpout(self, s, ac, av);
				free(av);
			}
		}
//	}
//	else
//		self->audioGraphObject->getUnitGenerator()->sendMessage(ttName);
}
开发者ID:imclab,项目名称:JamomaAudioGraph,代码行数:57,代码来源:MaxAudioGraph.cpp

示例11: makeInternals_sender

TTErr makeInternals_sender(TTPtr self, TTAddress address, TTSymbol name, TTObject& returnedSender, TTBoolean appendNameAsAttribute)
{
	WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
    TTValue     v;
	TTAddress   adrs;
    
    // check the internals do not exist yet
    if (!x->internals->lookup(name, v)) {
        returnedSender = v[0];
        JamomaDebug object_post((t_object*)x, "makeInternals_sender : \"%s\" internal already exists", name.c_str());
        return kTTErrNone;
    }
	
	returnedSender = TTObject(kTTSym_Sender);
	
	// edit address
	if (appendNameAsAttribute)
        adrs = address.appendAttribute(name);
    else
        adrs = address.appendAddress(TTAddress(name.c_str()));
	
	// default registration case : store object only (see in unregister method)
	x->internals->append(name, returnedSender);
    
    // set address attribute
	returnedSender.set(kTTSym_address, adrs);
    
    JamomaDebug object_post((t_object*)x, "makes internal \"%s\" sender to bind on : %s", name.c_str(), adrs.c_str());
    
	return kTTErrNone;
}
开发者ID:EQ4,项目名称:JamomaMax,代码行数:31,代码来源:TTModularClassWrapperMax.cpp

示例12: makeInternals_explorer

TTErr makeInternals_explorer(TTPtr self, TTSymbol name, t_symbol *callbackMethod, TTObject& returnedExplorer, TTBoolean deferlow)
{
	WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
	TTValue		v, args, baton;
	TTObject    returnValueCallback;
    
    // check the internals do not exist yet
    if (!x->internals->lookup(name, v)) {
        returnedExplorer = v[0];
        JamomaDebug object_post((t_object*)x, "makeInternals_explorer : \"%s\" internal already exists", name.c_str());
        return kTTErrNone;
    }
	
	// prepare arguments
	returnValueCallback = TTObject("callback");
    
	baton = TTValue(TTPtr(x), TTPtr(callbackMethod), deferlow);
    
	returnValueCallback.set(kTTSym_baton, baton);
	returnValueCallback.set(kTTSym_function, TTPtr(&jamoma_callback_return_value));
	args.append(returnValueCallback);
	
	args.append((TTPtr)jamoma_explorer_default_filter_bank());
	
	returnedExplorer = TTObject(kTTSym_Explorer, args);
	
	// default registration case : store object only (see in unregister method)
	x->internals->append(name, returnedExplorer);
    
    JamomaDebug object_post((t_object*)x, "makes internal \"%s\" explorer", name.c_str());
    
	return kTTErrNone;
}
开发者ID:EQ4,项目名称:JamomaMax,代码行数:33,代码来源:TTModularClassWrapperMax.cpp

示例13: remove

TTErr TTHash::remove(const TTSymbol& key)
{
	lock();
	HASHMAP->erase(TTPtrSizedInt(key.rawpointer()));
	unlock();
	return kTTErrNone;
}
开发者ID:aprigent,项目名称:JamomaCore,代码行数:7,代码来源:TTHash.cpp

示例14: MidiOutGetDevice

MaxErr MidiOutGetDevice(MidiOutPtr self, void* attr, AtomCount* argc, AtomPtr* argv)
{
	TTValue		v;
	TTSymbol	s;
	
	self->graphObject->mKernel->getAttributeValue(TT("device"), v);
	v.get(0, s);
	if (!s)
		return MAX_ERR_GENERIC;
	
	*argc = 1;
	if (!(*argv)) // otherwise use memory passed in
		*argv = (t_atom *)sysmem_newptr(sizeof(t_atom));
	atom_setsym(*argv, gensym((char*)s.c_str()));
	return MAX_ERR_NONE;
}
开发者ID:thorangutang,项目名称:JamomaMax,代码行数:16,代码来源:jcom.midi.out.cpp

示例15: TTExpressionParseFromValue

void TTSCORE_EXPORT TTExpressionParseFromValue(const TTValue& toParse, TTExpression& anExpression)
{
    // if the expression is composed by one symbol
    if (toParse.size() == 1 && toParse[0].type() == kTypeSymbol) {
        
        TTSymbol s = toParse[0];
        anExpression = TTExpression(s.c_str());
    }
    else {
        
        // copy to protect the value
        TTValue v = toParse;
        v.toString();
        anExpression = TTExpression(TTString(v[0]));
    }
}
开发者ID:EQ4,项目名称:JamomaCore,代码行数:16,代码来源:TTExpression.cpp


注:本文中的TTSymbol类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。