本文整理汇总了C++中TTSymbol::string方法的典型用法代码示例。如果您正苦于以下问题:C++ TTSymbol::string方法的具体用法?C++ TTSymbol::string怎么用?C++ TTSymbol::string使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类TTSymbol
的用法示例。
在下文中一共展示了TTSymbol::string方法的5个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: 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;
}
示例2: main
int main(int argc, const char * argv[])
{
std::cout << "BEGIN testing for AnalysisLib...\n"; // CUSTOMIZE
TTLoadJamomaExtension_AnalysisLib(); // CUSTOMIZE
TTValue classNames;
// if the follow group tag is present within the thisTTClassTags definition, the class will be tested
TTValue testClassesWithTheseTags(TT("dspAnalysisLib")); // CUSTOMIZE
TTObject::GetRegisteredClassNamesForTags(classNames, testClassesWithTheseTags);
for (int i=0; i<classNames.size(); i++) {
TTSymbol name = classNames[i];
try {
TTObject obj(name);
std::cout << "TESTING " << name.string() << std::endl;
obj.send("test");
}
catch (...) {
TTLogMessage("UnitTest Failure to instantiate object of class %s! \n", name.c_str());
continue;
}
}
std::cout << "END testing of AnalysisLib!\n"; // CUSTOMIZE
return 0;
}
示例3: wrappedClass_anything
void wrappedClass_anything(TTPtr self, t_symbol* s, long argc, t_atom* argv)
{
WrappedInstancePtr x = (WrappedInstancePtr)self;
TTSymbol ttName;
TTValue v_in;
TTValue v_out;
// err = hashtab_lookup(x->wrappedClassDefinition->pdNamesToTTNames, s, (t_object**)&ttName);
ttName = x->wrappedClassDefinition->pdNamesToTTNames[s->s_name];
if (ttName.string().empty()) {
pd_error((t_object*)x, "no method found for %s", s->s_name);
return;
}
if (argc && argv) {
v_in.resize(argc);
for (long i=0; i<argc; i++) {
if (atom_gettype(argv+i) == A_LONG)
v_in[i] = (TTInt32)atom_getlong(argv+i);
else if (atom_gettype(argv+i) == A_FLOAT)
v_in[i] = atom_getfloat(argv+i);
else if (atom_gettype(argv+i) == A_SYM)
v_in[i] = TT(atom_getsym(argv+i)->s_name);
else
pd_error((t_object*)x, "bad type for message arg");
}
}
x->wrappedObject->send(ttName, v_in, v_out);
// process the returned value for the dumpout outlet
{
long ac = v_out.size();
if (ac) {
t_atom* av = (t_atom*)malloc(sizeof(t_atom) * ac);
for (long i=0; i<ac; i++) {
if (v_out[0].type() == kTypeSymbol) {
TTSymbol ttSym;
ttSym = v_out[i];
atom_setsym(av+i, gensym((char*)ttSym.c_str()));
}
else if (v_out[0].type() == kTypeFloat32 || v_out[0].type() == kTypeFloat64) {
TTFloat64 f = 0.0;
f = v_out[i];
atom_setfloat(av+i, f);
}
else {
TTInt32 l = 0;
l = v_out[i];
atom_setfloat(av+i, l);
}
}
outlet_anything(x->dumpOut, s, ac, av);
free(av);
}
}
}
示例4: 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);
}
示例5: CheckDiscoverAnswer
int WebSocketAnswerManager::CheckDiscoverAnswer(TTSymbol from, TTAddress address, TTValue& value)
{
int state;
TTValue v;
TTString key;
WebSocketAnswerPtr anAnswer;
TTErr err;
key = from.string();
key += address.string();
// Looking for a WebSocketDiscoverAnswer object at the given address
err = mDiscoverAnswers->lookup(TTSymbol(key), v);
if (!err) {
anAnswer = WebSocketAnswerPtr((TTPtr)v[0]);
// wait
anAnswer->wait();
state = anAnswer->getState();
// if an answer is received
if(state != NO_ANSWER)
{
// get the answer
anAnswer->getAnswer(value);
mDiscoverAnswers->remove(TTSymbol(key));
delete anAnswer;
}
return state;
}
else
return REQUEST_NOT_SENT;
}