本文整理汇总了C++中TTObject类的典型用法代码示例。如果您正苦于以下问题:C++ TTObject类的具体用法?C++ TTObject怎么用?C++ TTObject使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了TTObject类的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_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;
}
示例3: 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;
}
示例4: 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);
}
}
}
示例5: cue_doedit
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;
}
示例6: 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);
}
}
}
示例7: 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);
}
}
}
示例8: DemoAppDataReturnValueCallback
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;
}
示例9: 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);
}
示例10: TTAudioSignalPtr
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);
}
示例11: 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);
}
}
示例12: data_edit_array
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);
}
}
示例13: 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));
}
示例14: 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;
}
示例15: TTProtocolAttributeCallback
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;
}