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; }
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; }
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; }
void cue_dowrite_again(TTPtr self) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; TTValue o, v; TTObject aTextHandler; TTErr tterr; if (x->wrappedObject.valid()) { tterr = x->internals->lookup(kTTSym_TextHandler, o); if (!tterr) { aTextHandler = o[0]; aTextHandler.set(kTTSym_object, x->wrappedObject); critical_enter(0); tterr = aTextHandler.send(kTTSym_WriteAgain, v); critical_exit(0); if (!tterr) object_obex_dumpout(self, _sym_write, 0, NULL); else object_obex_dumpout(self, _sym_error, 0, NULL); } } }
void cue_doedit(TTPtr self) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; TTObject aTextHandler; TTValue o, args; t_atom a; TTErr tterr; // get the buffer handler tterr = x->internals->lookup(kTTSym_TextHandler, o); if (!tterr) { aTextHandler = o[0]; critical_enter(0); tterr = aTextHandler.send(kTTSym_Read, (TTPtr)EXTRA->text); critical_exit(0); // output a flag atom_setsym(&a, gensym("closed")); object_obex_dumpout(self, gensym("editor"), 1, &a); if (tterr) object_obex_dumpout(self, _sym_error, 0, NULL); } delete EXTRA->text; EXTRA->text = NULL; EXTRA->textEditor = NULL; *EXTRA->toEdit = x->wrappedObject; EXTRA->cueName = kTTSymEmpty; }
void cue_doread(TTPtr self, t_symbol *msg, long argc, t_atom *argv) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; TTValue o, v; TTSymbol fullpath; TTObject aTextHandler; TTErr tterr; if (x->wrappedObject.valid()) { fullpath = jamoma_file_read((t_object*)x, argc, argv, (t_fourcc)'TEXT'); v.append(fullpath); tterr = x->internals->lookup(kTTSym_TextHandler, o); if (!tterr) { aTextHandler = o[0]; aTextHandler.set(kTTSym_object, x->wrappedObject); critical_enter(0); tterr = aTextHandler.send(kTTSym_Read, v); critical_exit(0); if (!tterr) object_obex_dumpout(self, _sym_read, argc, argv); else object_obex_dumpout(self, _sym_error, 0, NULL); } } }
void cue_dowrite(TTPtr self, t_symbol *msg, long argc, t_atom *argv) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; char filename[MAX_FILENAME_CHARS]; TTSymbol fullpath; TTValue o, v; TTObject aTextHandler; TTErr tterr; if (x->wrappedObject.valid()) { // Default TEXT File Name snprintf(filename, MAX_FILENAME_CHARS, "untitled.cues.txt"); fullpath = jamoma_file_write((t_object*)x, argc, argv, filename); v.append(fullpath); tterr = x->internals->lookup(kTTSym_TextHandler, o); if (!tterr) { aTextHandler = o[0]; aTextHandler.set(kTTSym_object, x->wrappedObject); critical_enter(0); tterr = aTextHandler.send(kTTSym_Write, v); critical_exit(0); if (!tterr) object_obex_dumpout(self, _sym_write, argc, argv); else object_obex_dumpout(self, _sym_error, 0, NULL); } } }
TTErr DemoAppDataReturnValueCallback(const TTValue& baton, const TTValue& value) { DemoApp* demoApp = (DemoApp*)TTPtr(baton[0]); TTObject anObject = baton[1]; // Reteive which data has been updated if (anObject.instance() == demoApp->mDataDemoParameter.instance()) { // print the returned value TTLogMessage("/myParameter has been updated to %s \n", value.toString().data()); return kTTErrNone; } if (anObject.instance() == demoApp->mDataDemoMessage.instance()) { // print the returned value TTLogMessage("/myMessage has been updated to %s \n", value.toString().data()); return kTTErrNone; } if (anObject.instance() == demoApp->mDataDemoReturn.instance()) { // print the returned value TTLogMessage("/myReturn has been updated to %s \n", value.toString().data()); return kTTErrNone; } return kTTErrGeneric; }
void DemoApp::Quit() { TTValue out; TTLogMessage("\n*** Release mApplicationDemo datas ***\n"); ///////////////////////////////////////////////////////////////////// // Unregister the parameter if ( mApplicationDemo.send("ObjectUnregister", "/myParameter", out)) TTLogError("Error : can't unregister data at /myParameter address \n"); // Unregister the message if (mApplicationDemo.send("ObjectUnregister", "/myMessage", out)) TTLogError("Error : can't unregister data at /myMessage address \n"); // Unregister the return if (mApplicationDemo.send("ObjectUnregister", "/myReturn", out)) TTLogError("Error : can't unregister data at /myReturn address \n"); TTLogMessage("\n*** Release application ***\n"); ///////////////////////////////////////////////////////////////////// mApplicationManager.send("ApplicationRelease", "demo", out); // delete the polling thread if (mPollingThread) mPollingThread->wait(); delete mPollingThread; }
void model_preset_dowrite_again(TTPtr self) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; TTObject aTextHandler; TTValue o; TTErr tterr; // stop filewatcher if (EXTRA->filewatcher) filewatcher_stop(EXTRA->filewatcher); tterr = x->internals->lookup(kTTSym_TextHandler, o); if (!tterr) { aTextHandler = o[0]; aTextHandler.set(kTTSym_object, *EXTRA->presetManager); critical_enter(0); tterr = aTextHandler.send(kTTSym_WriteAgain); critical_exit(0); if (!tterr) object_obex_dumpout(self, _sym_write, 0, NULL); else object_obex_dumpout(self, _sym_error, 0, NULL); } // start filewatcher if (EXTRA->filewatcher) filewatcher_start(EXTRA->filewatcher); }
void TTInputAudio::process(TTSampleValue* anInputSampleVector, TTSampleValue* anOutputSampleVector, TTUInt16 aVectorSize) { // Store the input from the inlets TTAudioSignalPtr(mSignalIn.instance())->setVector64Copy(0, aVectorSize, anInputSampleVector); // Sum signal from j.send~ objects for (mSignalCache.begin(); mSignalCache.end(); mSignalCache.next()) { TTObject o = mSignalCache.current()[0]; TTAudioSignalPtr sentSignal = TTAudioSignalPtr(o.instance()); if (sentSignal) *TTAudioSignalPtr(mSignalIn.instance()) += *sentSignal; } // if signal is bypassed or muted, send a zero signal to the algorithm if (mBypass || mMute) TTAudioSignal::copy(*TTAudioSignalPtr(mSignalZero.instance()), *TTAudioSignalPtr(mSignalOut.instance())); // else copy in to out else TTAudioSignal::copy(*TTAudioSignalPtr(mSignalIn.instance()), *TTAudioSignalPtr(mSignalOut.instance())); // clear the signal cache mSignalCache.clear(); // Send the input on to the outlets for the algorithm, if desired if (anOutputSampleVector) TTAudioSignalPtr(mSignalOut.instance())->getVectorCopy(0, aVectorSize, anOutputSampleVector); }
void model_preset_doread_again(TTPtr self) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; TTObject aTextHandler; TTValue o; TTErr tterr; tterr = x->internals->lookup(kTTSym_TextHandler, o); if (!tterr) { aTextHandler = o[0]; aTextHandler.set(kTTSym_object, *EXTRA->presetManager); critical_enter(0); tterr = aTextHandler.send(kTTSym_ReadAgain); critical_exit(0); if (!tterr) object_obex_dumpout(self, _sym_read, 0, NULL); else object_obex_dumpout(self, _sym_error, 0, NULL); } }
void data_edit_array(TTPtr self, TTValue& array) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; TTValue keys, object, grab, t; TTSymbol key, type; TTObject aData; // get each value from the data object itself for (EXTRA->objectsSorted->begin(); EXTRA->objectsSorted->end(); EXTRA->objectsSorted->next()) { aData = EXTRA->objectsSorted->current()[0]; // try to get the value or the value default if (aData.get(kTTSym_value, grab)) aData.get(kTTSym_valueDefault, grab); // if there is no value if (grab.size() == 0) { aData.get(kTTSym_type, t); type = t[0]; if (type == kTTSym_string) grab = kTTSym_none; else grab = 0; } array.prepend(grab); } }
void data_array_create(TTPtr self, TTObject& returnedData, TTSymbol service, TTUInt32 index) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; t_symbol *iAdrs; TTValue baton; returnedData = TTObject(kTTSym_Data, service); jamoma_edit_numeric_instance(x->arrayFormatInteger, &iAdrs, index); baton = TTValue(self, index, TTSymbol(iAdrs->s_name)); returnedData.set(kTTSym_baton, baton); returnedData.set(kTTSym_function, TTPtr(&data_array_return_value)); }
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; }
TTErr TTProtocolAttributeCallback(const TTValue& baton, const TTValue& data) { TTObject aProtocol; TTSymbol anApplicationName; TTAddress anAddress; // unpack baton aProtocol = baton[0]; anApplicationName = baton[1]; anAddress = baton[2]; if (TTProtocolPtr(aProtocol.instance())->mRunning) return TTProtocolPtr(aProtocol.instance())->SendListenAnswer(anApplicationName, anAddress, data); else return kTTErrGeneric; }
void DemoApp::SetMessage(std::string s) { TTSymbol message(s); TTValue out; mDataDemoMessage.send("Command", message, out); }
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; }
void DemoApp::SetupScore() { TTValue args, out; TTObject xmlHandler("XmlHandler"); TTLogMessage("\n*** Initialisation of Score environnement ***\n"); ///////////////////////////////////////////////////////////////////// // Init the Score library (passing the folder path where all the dylibs are) TTScoreInit("/usr/local/jamoma"); TTLogMessage("\n*** Reading of an interactive scenario file ***\n"); ///////////////////////////////////////////////////////////////////// // Create an empty Scenario mScenario = TTObject("Scenario"); // Read DemoScenario1.score file to fill mScenario xmlHandler.set("object", mScenario); xmlHandler.send("Read", "../DemoScenario.score", out); TTLogMessage("\n*** Prepare scenario observation ***\n"); ///////////////////////////////////////////////////////////////////// // Create a callback for the "EventStatusChanged" notification sent by each event mEventStatusChangedCallback = TTObject("callback"); mEventStatusChangedCallback.set("baton", TTPtr(this)); mEventStatusChangedCallback.set("function", TTPtr(&DemoAppEventStatusChangedCallback)); mEventStatusChangedCallback.set("notification", TTSymbol("EventStatusChanged")); // Get all events of the scenario and attach a callback to them TTValue timeEvents; mScenario.get("timeEvents", timeEvents); for (TTElementIter it = timeEvents.begin() ; it != timeEvents.end() ; it++) { TTObject event = TTElement(*it); event.registerObserverForNotifications(mEventStatusChangedCallback); } TTLogMessage("\n*** Start scenario execution ***\n"); ///////////////////////////////////////////////////////////////////// // Set the execution speed of the scenario mScenario.set("speed", 2.); // Start the scenario mScenario.send("Start"); // Poll Scenario information mPollingThread = new TTThread(TTThreadCallbackType(DemoAppScenarioPollingThread), this); }
TTErr DemoAppEventStatusChangedCallback(const TTValue& baton, const TTValue& value) { DemoApp* demoApp = (DemoApp*)TTPtr(baton[0]); TTObject event = value[0]; TTSymbol newStatus = value[1]; TTSymbol oldStatus = value[2]; // get the name of the event TTSymbol name; event.get("name", name); // print the event status TTLogMessage("%s status : %s \n", name.c_str(), newStatus.c_str()); return kTTErrNone; }
void cue_get(TTPtr self, t_symbol *msg, long argc, t_atom *argv) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; TTHashPtr allCues; TTValue v; TTSymbol name, attribute; TTObject cue; long ac = 0; t_atom *av = NULL; if (argc == 2) { if (atom_gettype(argv) == A_SYM && atom_gettype(argv+1) == A_SYM) { attribute = TTSymbol((char*)atom_getsym(argv)->s_name); name = TTSymbol((char*)atom_getsym(argv+1)->s_name); // get cue object table x->wrappedObject.get("cues", v); allCues = TTHashPtr((TTPtr)v[0]); if (allCues) { // get cue if (!allCues->lookup(name, v)) { cue = v[0]; if (!cue.get(attribute, v)) { v.prepend(name); jamoma_ttvalue_to_Atom(v, &ac, &av); object_obex_dumpout(self, atom_getsym(argv), ac, av); } else object_error((t_object*)x, "%s attribute doesn't exist", atom_getsym(argv)->s_name); } else object_error((t_object*)x, "%s cue doesn't exist", atom_getsym(argv+1)->s_name); } } } }
TTObjectBasePtr getSelectedObject(WrappedModularInstancePtr x) { if (x->useInternals) { TTValue v; TTObject o; TTErr err; err = x->internals->lookup(x->cursor, v); if (!err) o = v[0]; return o.instance(); } #ifndef ARRAY_EXTERNAL else return x->wrappedObject.instance(); #else else return NULL;
void model_preset_dowrite(TTPtr self, t_symbol *msg, long argc, t_atom *argv) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; char filename[MAX_FILENAME_CHARS]; TTSymbol fullpath; TTValue o, v, none; TTObject aTextHandler; TTErr tterr; // stop filewatcher if (EXTRA->filewatcher) filewatcher_stop(EXTRA->filewatcher); if (EXTRA->presetManager->valid()) { // Default TEXT File Name snprintf(filename, MAX_FILENAME_CHARS, "%s.%s.presets.txt", x->patcherClass.c_str(), x->patcherContext.c_str()); fullpath = jamoma_file_write((t_object*)x, argc, argv, filename); v.append(fullpath); tterr = x->internals->lookup(kTTSym_TextHandler, o); if (!tterr) { aTextHandler = o[0]; aTextHandler.set(kTTSym_object, *EXTRA->presetManager); critical_enter(0); tterr = aTextHandler.send(kTTSym_Write, v, none); critical_exit(0); if (!tterr) object_obex_dumpout(self, _sym_write, argc, argv); else object_obex_dumpout(self, _sym_error, 0, NULL); } } // start filewatcher if (EXTRA->filewatcher) filewatcher_start(EXTRA->filewatcher); }
void cue_set(TTPtr self, t_symbol *msg, long argc, t_atom *argv) { WrappedModularInstancePtr x = (WrappedModularInstancePtr)self; TTHashPtr allCues; TTValue v; TTSymbol name, attribute; TTObject cue; if (argc >= 2) { if (atom_gettype(argv) == A_SYM && atom_gettype(argv+1) == A_SYM) { attribute = TTSymbol((char*)atom_getsym(argv)->s_name); name = TTSymbol((char*)atom_getsym(argv+1)->s_name); // get cue object table x->wrappedObject.get("cues", v); allCues = TTHashPtr((TTPtr)v[0]); if (allCues) { // get cue if (!allCues->lookup(name, v)) { cue = v[0]; // prepare value to set jamoma_ttvalue_from_Atom(v, _sym_nothing, argc-2, argv+2); if (cue.set(attribute, v)) object_error((t_object*)x, "%s attribute doesn't exist", atom_getsym(argv)->s_name); } else object_error((t_object*)x, "%s cue doesn't exist", atom_getsym(argv+1)->s_name); } } } }
TTErr TTProtocolListenAttributeCallback(const TTValue& baton, const TTValue& data) { TTObject aProtocol; TTSymbol anApplicationName; TTAddress anAddress; TTSymbol attribute; TTBoolean enable; // unpack baton aProtocol = baton[0]; anApplicationName = baton[1]; anAddress = baton[2]; // unpack data attribute = data[0]; enable = data[1]; // send a listen request if (TTProtocolPtr(aProtocol.instance())->mRunning) return TTProtocolPtr(aProtocol.instance())->SendListenRequest(anApplicationName, anAddress.appendAttribute(attribute), enable); else return kTTErrGeneric; }
TTErr TTProtocolSendMessageCallback(const TTValue& baton, const TTValue& data) { TTValuePtr value; TTObject aProtocol; TTSymbol anApplicationName; TTAddress anAddress; TTSymbol message; // unpack baton aProtocol = baton[0]; anApplicationName = baton[1]; anAddress = baton[2]; // unpack data message = data[0]; value = TTValuePtr((TTPtr)data[1]); // send a set request if (TTProtocolPtr(aProtocol.instance())->mRunning) return TTProtocolPtr(aProtocol.instance())->SendSetRequest(anApplicationName, anAddress.appendAttribute(message), *value); else return kTTErrGeneric; }
TTErr TTProtocolDirectoryCallback(const TTValue& baton, const TTValue& data) { TTObject aProtocol; TTSymbol anApplicationName; TTAddress anAddress; TTNodePtr aNode; TTUInt8 flag; TTObject anObserver; TTValue v; // unpack baton aProtocol = baton[0]; anApplicationName = baton[1]; // unpack data (anAddress, aNode, flag, anObserver) anAddress = data[0]; aNode = TTNodePtr((TTPtr)data[1]); flag = data[2]; anObserver = data[3]; if (flag == kAddressCreated) { if (aNode->getObject().valid()) v.append(aNode->getObject().name()); else v.append(kTTSym_none); } else if (flag == kAddressDestroyed) { v.append(TTSymbol("delete")); } if (TTProtocolPtr(aProtocol.instance())->mRunning) return TTProtocolPtr(aProtocol.instance())->SendListenAnswer(anApplicationName, anAddress.appendAttribute(TTSymbol("life")), v); else return kTTErrGeneric; }
TTErr MinuitSenderManager::send(TTSymbol applicationName, TTSymbol ip, TTUInt16 port, const TTValue& message) { TTValue last; // if nothing is being sent to an application if (mSending.findEquals(applicationName, last)) { // lock application mSending.append(applicationName); TTObject anOscSender; TTErr err = mSenders.lookup(applicationName, last); if (err) { anOscSender = TTObject("osc.send"); anOscSender.set("address", ip); anOscSender.set("port", port); TTValue cache(anOscSender, ip, port); mSenders.append(applicationName, cache); } else { anOscSender = last[0]; TTSymbol lastIp = last[1]; TTUInt16 lastPort = last[2]; if (lastIp == ip && lastPort == port) ; else { anOscSender.set("address", ip); anOscSender.set("port", port); TTValue cache(anOscSender, ip, port); mSenders.remove(applicationName); mSenders.append(applicationName, cache); } } err = anOscSender.send("send", message); // unlock application mSending.remove(applicationName); return kTTErrNone; } return kTTErrGeneric; }
TTErr TTData::WriteAsText(const TTValue& inputValue, TTValue& outputValue) { TTObject o = inputValue[0]; TTTextHandlerPtr aTextHandler = (TTTextHandlerPtr)o.instance(); if (!aTextHandler) return kTTErrGeneric; TTString *buffer; TTValue toString; TTString line; buffer = aTextHandler->mWriter; // Type *buffer += "\t\t\t<td class =\"instructionType\">"; *buffer += this->mType.c_str(); *buffer += "</td>"; // range/bounds toString = this->mRangeBounds; toString.toString(); line = TTString(toString[0]); if ( (this->mType == kTTSym_integer) || (this->mType == kTTSym_boolean) || (this->mType == kTTSym_decimal) || (this->mType == kTTSym_generic) ) { *buffer +="\t\t\t<td class =\"instructionRangeBounds\">"; *buffer +=line.data(); *buffer += "</td>"; } else *buffer += "\t\t\t<td class = \"instructionRangeBounds\"> N/A </td>"; // clipmode *buffer += "\t\t\t<td class =\"instructionRangeClipmode\">"; *buffer += this->mRangeClipmode.c_str(); *buffer += "</td>"; // ramp/drive *buffer += "\t\t\t<td class =\"instructionRampDrive\">"; *buffer += this->mRampDrive.c_str(); *buffer += "</td>"; #ifndef TT_NO_DSP // ramp/function *buffer += "\t\t\t<td class =\"instructionRampFunction\">"; *buffer += this->mRampFunction.c_str(); *buffer += "</td>"; #endif // dataspace *buffer += "\t\t\t<td class =\"instructionDataspace\">"; *buffer += this->mDataspace.c_str(); *buffer += "</td>"; // dataspace/unit *buffer += "\t\t\t<td class =\"instructionDataspaceUnit\">"; *buffer += this->mDataspaceUnit.c_str(); *buffer += "</td>"; // repetitions/filter toString = this->mRepetitionsFilter; toString.toString(); line = TTString(toString[0]); *buffer += "\t\t\t<td class =\"instructionRepetitionsFilter\">"; *buffer += line.data(); *buffer += "</td>"; // description *buffer += "\t\t\t<td class =\"instructionDescription\">"; *buffer += this->mDescription.c_str(); *buffer += "</td>"; return kTTErrNone; }
TTErr TTProtocol::ApplicationRegister(const TTValue& inputValue, TTValue& outputValue) { TTObject application; TTSymbol parameterName; TTHashPtr applicationParameters; TTValue v, parameterNames, out, none; TTErr err; // update local application name mApplicationManager.get("applicationLocalName", v); mLocalApplicationName = v[0]; if (inputValue.size() == 1) { if (inputValue[0].type() == kTypeSymbol) { mSelectedApplication = inputValue[0]; // Check the application is not already registered err = mApplicationParameters.lookup(mSelectedApplication, v); if (err) { applicationParameters = new TTHash(); // prepare parameters table this->getParameterNames(parameterNames); for (TTUInt32 i = 0; i < parameterNames.size(); i++) { parameterName = parameterNames[i]; applicationParameters->append(parameterName, none); } // add the parameters table into mApplicationParameters v = TTValue((TTPtr)applicationParameters); mApplicationParameters.append(mSelectedApplication, v); // optionnaly format the application type depending on the protocol features // (if the application is already registered into the application manager) err = mApplicationManager.send("ApplicationFind", mSelectedApplication, out); if (!err) { application = out[0]; // for none local application if (mSelectedApplication != mLocalApplicationName) { // setup the application type depending of the discovering feature of the protocol if (mDiscover || mDiscoverAll) application.set("type", kTTSym_mirror); else application.set("type", kTTSym_proxy); } } return kTTErrNone; } } } return kTTErrGeneric; }