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


C++ TTAddress类代码示例

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


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

示例1: model_preset_amenities

void model_preset_amenities(TTPtr self)
{
	WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
    TTAddress                   modelAdrs;
	TTValue						v, a, args, none;
    TTAddress                   presetAddress;

    // get model:address
    EXTRA->modelInfo->get(kTTSym_address, v);
    modelAdrs = v[0];

    // create the preset manager
	jamoma_presetManager_create((t_object*)x, *EXTRA->presetManager);

    // suscribe it under a preset node
    presetAddress = modelAdrs.appendAddress(TTAddress("preset"));

    args = TTValue(presetAddress, *EXTRA->presetManager, x->patcherPtr);

    if (!MaxApplication.send("ObjectRegister", args, none)) {

        EXTRA->presetManager->set(kTTSym_address, modelAdrs);

        defer_low(x, (method)model_preset_default, 0, 0, 0L);
    }
}
开发者ID:Rocknrenew,项目名称:JamomaMax,代码行数:26,代码来源:j.model_preset.cpp

示例2: nameInstance

TTErr TTAddressItem::append(TTAddress addressToAppend, TTAddressItemPtr *returnedItem)
{
	TTAddressItemPtr	anItem = this;
	TTAddressItemPtr	nextItem;
	TTList				nameInstanceList;
	TTSymbol			nameInstance(kTTSymEmpty);
	
	addressToAppend.listNameInstance(nameInstanceList);
	
	for (nameInstanceList.begin(); nameInstanceList.end(); nameInstanceList.next()) {
		nameInstance = nameInstanceList.current()[0];
		
		nextItem = anItem->getItem(nameInstance);
		
		if (!nextItem) {
			nextItem = new TTAddressItem(nameInstance, anItem);
			((TTListPtr)anItem)->append((TTPtr)nextItem);
		}
		
		anItem = nextItem;
	}
    
    anItem->options->appendUnique(addressToAppend.getAttribute());
	
	*returnedItem = anItem;
	return kTTErrNone;
}
开发者ID:Cplaton,项目名称:JamomaCore,代码行数:27,代码来源:TTAddressItem.cpp

示例3: makeInternals_viewer

TTErr makeInternals_viewer(TTPtr self, TTAddress address, TTSymbol name, t_symbol *callbackMethod, TTObject& returnedViewer, TTBoolean deferlow)
{
	WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
	TTValue			v, baton;
	TTAddress       adrs;
    
    // check the internals do not exist yet
    if (!x->internals->lookup(name, v)) {
        returnedViewer = v[0];
        JamomaDebug object_post((t_object*)x, "makeInternals_viewer : \"%s\" internal already exists", name.c_str());
        return kTTErrNone;
    }
	
	returnedViewer = TTObject(kTTSym_Viewer);
    
    baton = TTValue(TTPtr(x), TTPtr(callbackMethod), deferlow);
    returnedViewer.set(kTTSym_baton, baton);
	returnedViewer.set(kTTSym_function, TTPtr(&jamoma_callback_return_value));
	
	// edit address
	adrs = address.appendAddress(TTAddress(name));
	
	// default registration case : store object only (see in unregister method)
	x->internals->append(name, returnedViewer);
    
    // set address attribute (after registration as the value can be updated in the same time)
	returnedViewer.set(kTTSym_address, adrs);
    
    JamomaDebug object_post((t_object*)x, "makes internal \"%s\" viewer to bind on : %s", name.c_str(), adrs.c_str());
    
	return kTTErrNone;
}
开发者ID:EQ4,项目名称:JamomaMax,代码行数:32,代码来源:TTModularClassWrapperMax.cpp

示例4: 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

示例5: init_subscribe

void init_subscribe(t_init *x)
{
	TTValue     v, args, none;
	TTAddress   contextAddress = kTTAdrsEmpty;
    TTAddress   returnedAddress;
    TTNodePtr   returnedNode = NULL;
    TTNodePtr   returnedContextNode = NULL;
	TTObject    returnAddressCallback, returnValueCallback, empty;
	
	// for relative address
	if (x->address.getType() == kAddressRelative) {

		if (!jamoma_subscriber_create((t_object*)x, empty, x->address, x->subscriberObject, returnedAddress, &returnedNode, &returnedContextNode)) {
            
			// get the context address to make
			// a receiver on the contextAddress:initialized attribute
			x->subscriberObject.get("contextAddress", v);
			contextAddress = v[0];
		}
		
		// bind on the /model:address parameter (view patch) or return (model patch)
		if (contextAddress != kTTAdrsEmpty) {
			
			// Make a TTReceiver object
			returnAddressCallback = TTObject("callback");
			returnAddressCallback.set(kTTSym_baton, TTPtr(x));
			returnAddressCallback.set(kTTSym_function, TTPtr(&jamoma_callback_return_address));
			args.append(returnAddressCallback);
			
			returnValueCallback = TTObject("callback");
			returnValueCallback.set(kTTSym_baton, TTPtr(x));
			returnValueCallback.set(kTTSym_function, TTPtr(&jamoma_callback_return_value));
			args.append(returnValueCallback);
			
			x->initReceiver = TTObject(kTTSym_Receiver, args);
			
			x->initReceiver.set(kTTSym_address, contextAddress.appendAttribute(kTTSym_initialized));
		}
		
		// while the context node is not registered : try to binds again :(
		// (to -- this is not a good way todo. For binding we should make a subscription 
		// to a notification mechanism and each time an TTObjet subscribes to the namespace
		// using jamoma_subscriber_create we notify all the externals which have used 
		// jamoma_subscriber_create with NULL object to bind)
		else {
			
			// release the subscriber
			x->subscriberObject = TTObject();
			
			// The following must be deferred because we have to interrogate our box,
			// and our box is not yet valid until we have finished instantiating the object.
			// Trying to use a loadbang method instead is also not fully successful (as of Max 5.0.6)
			defer_low((t_object*)x, (method)init_subscribe, NULL, 0, 0);
		}
	}
	else
		object_error((t_object*)x, "can't bind because %s is not a relative address", x->address.c_str());
}
开发者ID:avilleret,项目名称:JamomaMax,代码行数:58,代码来源:j.init.cpp

示例6: out_subscribe

void out_subscribe(TTPtr self)
{
    WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
    TTAddress   signalAddress;
    TTAddress	outputAddress;
    TTAddress	inputAddress;
    TTValue		v, args;
    TTNodePtr	returnedNode = NULL;
    TTNodePtr   returnedContextNode = NULL;
    TTAddress	returnedAddress, parentAddress;
    TTString	formatDescription, sInstance;
    t_object    *modelOrView = NULL;

#ifdef J_OUT_TILDE
    signalAddress = TTAddress("audio");
#endif

#ifdef J_OUT_MULTI
    signalAddress = TTAddress("audio");
#endif

#ifndef J_OUT_TILDE
#ifndef J_OUT_MULTI
    signalAddress = TTAddress("data");
#endif
#endif

    // edit "signal/out.instance" address
    outputAddress = signalAddress.appendAddress(TTAddress("out")).appendInstance(EXTRA->instance);

    // if the subscription is successful
    if (!jamoma_subscriber_create((t_eobj*)x, x->wrappedObject, outputAddress, x->subscriberObject, returnedAddress, &returnedNode, &returnedContextNode)) {

        // get patcher
        x->patcherPtr = ((t_eobj*)x)->o_canvas;

        // update instance symbol in case of duplicate instance
        EXTRA->instance = returnedAddress.getInstance();

        // observe /parent/in address in order to link/unlink with an Input object below
        returnedNode->getParent()->getAddress(parentAddress);
        inputAddress = parentAddress.appendAddress(TTAddress("in")).appendInstance(EXTRA->instance);
        x->wrappedObject.set("inputAddress", inputAddress);

        // get model or view object
        jamoma_patcher_get_model_or_view(x->patcherPtr, &modelOrView);

        // notify the model there is something new concerning signal processing
        if (modelOrView)
            object_method_typed(modelOrView, gensym("output_created"), 0, NULL, NULL);
    }
}
开发者ID:EQ4,项目名称:JamomaPureData,代码行数:52,代码来源:j.out.cpp

示例7: makeInternals_data

TTErr makeInternals_data(TTPtr self, TTAddress address, TTSymbol name, t_symbol *callbackMethod, TTPtr context, TTSymbol service, TTObject& returnedData, TTBoolean deferlow)
{
	WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
	TTValue			baton, v, out;
	TTAddress       dataAddress, dataRelativeAddress;
    TTNodePtr       dataNode;
    
	returnedData = TTObject(kTTSym_Data, service);
    
    baton = TTValue(TTPtr(x), TTPtr(callbackMethod), deferlow);
	
    returnedData.set(kTTSym_baton, baton);
	returnedData.set(kTTSym_function, TTPtr(&jamoma_callback_return_value));
	
	// absolute registration
	dataAddress = address.appendAddress(TTAddress(name));
    v = TTValue(dataAddress, returnedData, context);
	out = MaxApplication.send("ObjectRegister", v);
	
    // retreive relative effective address
	dataAddress = out[0];
    dataNode = TTNodePtr((TTPtr)out[1]);
    dataNode->getAddress(dataRelativeAddress, address);
    
	// absolute registration case : set the address in second position (see in unregister method)
	v = TTValue(returnedData, dataAddress);
	x->internals->append(dataRelativeAddress, v);
	
	JamomaDebug object_post((t_object*)x, "makes internal \"%s\" %s at : %s", dataRelativeAddress.c_str(), service.c_str(), dataAddress.c_str());
	
	return kTTErrNone;
}
开发者ID:EQ4,项目名称:JamomaMax,代码行数:32,代码来源:TTModularClassWrapperMax.cpp

示例8: ReceiveDiscoverAnswer

TTErr WebSocketAnswerManager::ReceiveDiscoverAnswer(TTSymbol from, TTAddress address, const TTValue& value, TTErr error)
{
    TTValue             v;
	TTString            key;
    WebSocketAnswerPtr  anAnswer;
    TTErr               err;
    
    key = from.string();
    key += address.string();
    
	err = mDiscoverAnswers->lookup(TTSymbol(key), v);
    
    if (!err) {
        anAnswer = WebSocketAnswerPtr((TTPtr)v[0]);
        
		if (anAnswer->getState() != TIMEOUT_EXCEEDED) {
			anAnswer->setAnswer(value, error);
			return kTTErrNone;
		}
	}
	else
		cout << "WebSocketAnswerManager::ReceiveDiscoverAnswer can't find a request at " << key << endl;
	
	return kTTErrGeneric;
}
开发者ID:EQ4,项目名称:JamomaCore,代码行数:25,代码来源:WebSocketAnswerManager.cpp

示例9: remove

TTErr TTAddressItem::remove(TTAddress addressToRemove)
{
	TTAddressItemPtr anItem, parentItem;
	
	// if the item exist
	if (!this->find(addressToRemove, &anItem)) {
		
        // remove option (even empty option)
        anItem->options->remove(addressToRemove.getAttribute());
        
        // if there no more options
        if (anItem->options->isEmpty()) {
            
            // destroy upper parents if there are empty after removing the item
            do {
               
                parentItem = anItem->getParent();
                ((TTListPtr)parentItem)->remove((TTPtr)anItem);
                destroy(anItem);
                
                anItem = parentItem;
                
            } while (anItem->isEmpty()) ;
        }
			
		return kTTErrNone;
	}
	
	return kTTErrValueNotFound;
}
开发者ID:Cplaton,项目名称:JamomaCore,代码行数:30,代码来源:TTAddressItem.cpp

示例10: ReceiveGetRequest

TTErr TTProtocol::ReceiveGetRequest(TTSymbol from, TTAddress address)
{
	TTErr	err;
	TTValue returnedValue;
    
    if (!mRunning)
        return kTTErrGeneric;
	
	// discover the namespace
    if (address.getAttribute() == NO_ATTRIBUTE)
        address = address.appendAttribute(kTTSym_value);
    
    err = mApplicationManager.send("ApplicationGet", address, returnedValue);
    
    return SendGetAnswer(from, address, returnedValue, err);
}
开发者ID:EQ4,项目名称:JamomaCore,代码行数:16,代码来源:TTProtocol.cpp

示例11: ReceiveSetRequest

TTErr TTProtocol::ReceiveSetRequest(TTSymbol from, TTAddress address, const TTValue& newValue)
{
	TTValue v, none;
	TTErr	err;
	
	// set the an object in the namespace
    if (address.getAttribute() == NO_ATTRIBUTE)
        address = address.appendAttribute(kTTSym_value);
    
    v.append(address);
    v.append((TTPtr)&newValue);
    err = mApplicationManager.send("ApplicationSet", v);
    
    // TODO : test error and send notification if error
    return err;
}
开发者ID:EQ4,项目名称:JamomaCore,代码行数:16,代码来源:TTProtocol.cpp

示例12: makeInternals_receiver

TTErr makeInternals_receiver(TTPtr self, TTAddress address, TTSymbol name, t_symbol *callbackMethod, TTObject& returnedReceiver, TTBoolean deferlow, TTBoolean appendNameAsAttribute)
{
	WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
	TTValue			v, args, baton;
	TTObject        returnValueCallback, empty;
	TTAddress       adrs;
    
    // check the internals do not exist yet
    if (!x->internals->lookup(name, v)) {
        returnedReceiver = v[0];
        JamomaDebug object_post((t_object*)x, "makeInternals_receiver : \"%s\" internal already exists", name.c_str());
        returnedReceiver.send("Get");
        return kTTErrNone;
    }
	
	// prepare arguments
	
	// we don't want the address back
	args.append(empty);
	
	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);
	
	returnedReceiver = TTObject(kTTSym_Receiver, args);
	
	// 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, returnedReceiver);
    
    // set address attribute (after registration as the value can be updated in the same time)
    returnedReceiver.set(kTTSym_address, adrs);
    
    JamomaDebug object_post((t_object*)x, "makes internal \"%s\" receiver to bind on : %s", name.c_str(), adrs.c_str());
    
	return kTTErrNone;
}
开发者ID:EQ4,项目名称:JamomaMax,代码行数:46,代码来源:TTModularClassWrapperMax.cpp

示例13: AddDiscoverAnswer

void WebSocketAnswerManager::AddDiscoverAnswer(TTSymbol from, TTAddress address, int timeOutInMs)
{
	TTString key = from.string();
    key += address.string();
    
    WebSocketAnswerPtr anAnswer = new WebSocketAnswer();
    anAnswer->setTimeOut(timeOutInMs);
    
    mDiscoverAnswers->append(TTSymbol(key), (TTPtr)anAnswer);
}
开发者ID:EQ4,项目名称:JamomaCore,代码行数:10,代码来源:WebSocketAnswerManager.cpp

示例14: ReceiveListenAnswer

TTErr TTProtocol::ReceiveListenAnswer(TTSymbol from, TTAddress address, const TTValue& newValue)
{
	TTValue v, none;
	TTErr	err;
	TTValue dummy;
	
    if (address.getAttribute() == NO_ATTRIBUTE)
        address = address.appendAttribute(kTTSym_value);
    
    v.append(from);
    v.append(address);
    v.append((TTPtr)&newValue);
    
    err = mApplicationManager.send("ApplicationListenAnswer", v);
    
    if (err && mRunning)
        return SendListenAnswer(from, address, dummy, err);
    
    return kTTErrGeneric;
}
开发者ID:EQ4,项目名称:JamomaCore,代码行数:20,代码来源:TTProtocol.cpp

示例15: ReceiveListenRequest

TTErr TTProtocol::ReceiveListenRequest(TTSymbol from, TTAddress address, TTBoolean enable) 
{
	TTValue v, none;
	TTErr	err;
	
	// listen an object or the namespace
    if (address.getAttribute() == NO_ATTRIBUTE)
        address = address.appendAttribute(kTTSym_value);
    
    v.append(mName);	// the name of the protocol is needed for feed back notifications
    v.append(from);
    v.append(address);
    v.append(enable);
    
    err = mApplicationManager.send("ApplicationListen", v);
    
    if (err && mRunning)
        return SendListenAnswer(from, address, none, err);
    
    return kTTErrGeneric;
}
开发者ID:EQ4,项目名称:JamomaCore,代码行数:21,代码来源:TTProtocol.cpp


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