本文整理汇总了C++中TTObject::get方法的典型用法代码示例。如果您正苦于以下问题:C++ TTObject::get方法的具体用法?C++ TTObject::get怎么用?C++ TTObject::get使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTObject
的用法示例。
在下文中一共展示了TTObject::get方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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);
}
}
示例2: 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);
}
示例3: TTLogMessage
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;
}
示例4: cue_get
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);
}
}
}
}
示例5: test
TTErr TTSoundfileLoader::test(TTValue& returnedTestInfo)
{
int errorCount = 0;
int testAssertionCount = 0;
// assemble the full path of the target sound file
TTString testSoundPath = TTFoundationBinaryPath;
int pos = testSoundPath.find_last_of('/');
testSoundPath = testSoundPath.substr(0,pos+1);
testSoundPath += TESTFILE;
std::cout << "We will be using the following path for testing: " << testSoundPath << "\n";
try {
TTTestLog("\n");
TTTestLog("Testing TTSoundfileLoader Basics...");
// TEST 0: establish our objects & pointers
TTObject* testTargetMatrix = new TTObject("samplematrix");
TTObject* testNonSampleMatrix = new TTObject("delay");
TTObjectBase* objectBasePtrToSampleMatrix;
TTObjectBase* ptrToNonSampleMatrix;
// TEST 1: set the filepath
TTBoolean result1 = { this->setFilePath(TT(testSoundPath)) == kTTErrNone };
TTTestAssertion("setFilePath operates successfully",
result1,
testAssertionCount,
errorCount);
// TEST 2: set up the samplematrix first
int channelsSend = 1; // compiler complained about TTInt32 being ambiguous here
int lengthSend = 22050; // compiler complained about TTInt32 being ambiguous here
testTargetMatrix->set("numChannels", channelsSend);
testTargetMatrix->set("lengthInSamples", lengthSend);
TTInt32 channelsReturn, lengthReturn;
testTargetMatrix->get("numChannels", channelsReturn);
testTargetMatrix->get("lengthInSamples", lengthReturn);
// now for the actual test
TTBoolean result2a = { channelsSend == channelsReturn };
TTTestAssertion("numChannels attribute set successfully",
result2a,
testAssertionCount,
errorCount);
TTBoolean result2b = { lengthSend == lengthReturn };
TTTestAssertion("lengthInSamples attribute set successfully",
result2b,
testAssertionCount,
errorCount);
//
// TEST 3: set the target via an objectBasePtr
objectBasePtrToSampleMatrix = testTargetMatrix->instance(); // is there a better syntax for this?
TTBoolean result3 = { this->setTargetMatrix(objectBasePtrToSampleMatrix) == kTTErrNone };
TTTestAssertion("setTargetMatrix via ObjectBasePtr operates successfully",
result3,
testAssertionCount,
errorCount);
// TEST 4: set the target to a non-SampleMatrix, should FAIL
ptrToNonSampleMatrix = testNonSampleMatrix->instance();
TTBoolean result4 = { this->setTargetMatrix(ptrToNonSampleMatrix) == kTTErrInvalidValue };
TTTestAssertion("setTargetMatrix returns error when not a SampleMatrix",
result4,
testAssertionCount,
errorCount);
// TEST 5: copy samplevalues until samplematrix is filled
TTBoolean result5 = { this->copyUntilFilled() == kTTErrNone };
TTTestAssertion("copyUntilFilled operates successfully",
result5,
testAssertionCount,
errorCount);
// releasing objects
objectBasePtrToSampleMatrix = NULL;
ptrToNonSampleMatrix = NULL;
delete testTargetMatrix;
delete testNonSampleMatrix;
// TEST 6: use TTSampleMatrix's load message, then compare 5 random sample values for equivalence
// create a new TTSampleMatrix
TTObject newTargetMatrix("samplematrix");
//.........这里部分代码省略.........