本文整理汇总了C++中TTObject::set方法的典型用法代码示例。如果您正苦于以下问题:C++ TTObject::set方法的具体用法?C++ TTObject::set怎么用?C++ TTObject::set使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTObject
的用法示例。
在下文中一共展示了TTObject::set方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: 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;
}
示例3: 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;
}
示例4: xmlHandler
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);
}
示例5: send
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;
}
示例6: data_array_create
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));
}
示例7: model_preset_dowrite_again
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);
}
示例8: 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;
}
示例9: model_preset_doread_again
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);
}
}
示例10: cue_dowrite_again
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);
}
}
}
示例11: cue_dowrite
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);
}
}
}
示例12: cue_doread
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);
}
}
}
示例13: 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;
}
示例14: model_preset_dowrite
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);
}
示例15: cue_set
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);
}
}
}
}