本文整理汇总了C++中Pattern::getColumns方法的典型用法代码示例。如果您正苦于以下问题:C++ Pattern::getColumns方法的具体用法?C++ Pattern::getColumns怎么用?C++ Pattern::getColumns使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pattern
的用法示例。
在下文中一共展示了Pattern::getColumns方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: track_proxy_setrow
int track_proxy_setrow(t_track_proxy *x, t_symbol *sel, int argc, t_atom *argv)
{
result_argc = 0;
if(argc < 2 || !IS_A_SYMBOL(argv,0) || !IS_A_FLOAT(argv,1))
{
pd_error(x, "setrow: usage: setrow <pattern> <row#> <atom0> <atom1> ...");
return -1;
}
t_symbol *pat = argv[0].a_w.w_symbol;
Pattern *pattern = x->track->getPattern(pat->s_name);
t_int r = (t_int) argv[1].a_w.w_float;
if(!pattern)
{
pd_error(x, "setrow: no such pattern: %s", pat->s_name);
return -2;
}
unsigned int argc2 = argc - 2;
if(argc2 != pattern->getColumns())
{
pd_error(x, "setrow: input error: must provide exactly %d elements for a row", pattern->getColumns());
return -3;
}
for(unsigned int i = 0; i < argc2; i++)
{
pattern->setCell(r, i, argv[i + 2]);
}
return 0;
}
示例2: track_proxy_getrow
int track_proxy_getrow(t_track_proxy *x, t_symbol *pat, t_floatarg rownum)
{
t_int r = (t_int) rownum;
Pattern *pattern = x->track->getPattern(pat->s_name);
if(!pattern)
{
pd_error(x, "getrow: no such pattern: %s", pat->s_name);
return -2;
}
SETSYMBOL(&result_argv[0], gensym("patternrow"));
SETSYMBOL(&result_argv[1], pat);
SETFLOAT(&result_argv[2], (t_float) r);
result_argc = 3;
for(unsigned int i = 0; i < pattern->getColumns(); i++)
{
if(result_argc >= MAX_RESULT_SIZE)
{
pd_error(x, "getrow: result too long");
return -2;
}
result_argv[result_argc] = pattern->getCell(r, i);
result_argc++;
}
return 0;
}
示例3: track_proxy_save
void track_proxy_save(t_gobj *z, t_binbuf *b)
{
t_track_proxy *x = (t_track_proxy*)z;
Track *t = x->track;
Song *s = t->getSong();
binbuf_addv(b, "ssiisss;", gensym("#X"), gensym("obj"),
(t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
gensym("track"), gensym(s->getName().c_str()),
gensym(t->getName().c_str()));
// save paterns
for(Track::pattern_iterator i = t->pattern_begin(); i != t->pattern_end(); i++)
{
Pattern *pattern = i->second;
binbuf_addv(b, "ss", gensym(TRACK_SELECTOR), gensym("data"));
t_int r = pattern->getRows();
t_int c = pattern->getColumns();
binbuf_addv(b, "sii", gensym(pattern->getName().c_str()), r, c);
t_atom tmp;
for(unsigned int j = 0; j < r; j++)
{
for(unsigned int k = 0; k < c; k++)
{
tmp = pattern->getCell(j, k);
switch(tmp.a_type)
{
case A_SYMBOL:
binbuf_addv(b, "s", tmp.a_w.w_symbol);
break;
case A_FLOAT:
binbuf_addv(b, "f", tmp.a_w.w_float);
break;
default:
binbuf_addv(b, "s", gensym("?"));
break;
}
}
}
binbuf_addv(b, ";");
}
// save metadata
for(Track::meta_iterator i = t->meta_begin(); i != t->meta_end(); i++)
{
binbuf_addv(b, "ssssss;", gensym(TRACK_SELECTOR),
gensym("meta"), gensym("track"), gensym("set"),
gensym(i->first.c_str()), gensym(i->second.c_str()));
}
binbuf_addv(b, "sss;", gensym(TRACK_SELECTOR), gensym("data"), gensym("end"));
}
示例4: track_proxy_getpatternsize
int track_proxy_getpatternsize(t_track_proxy *x, t_symbol *pat)
{
Pattern *pattern = x->track->getPattern(pat->s_name);
if(!pattern)
{
pd_error(x, "getpatternsize: no such pattern: %s", pat->s_name);
return -1;
}
SETSYMBOL(&result_argv[0], gensym("patternsize"));
SETSYMBOL(&result_argv[1], pat);
SETFLOAT(&result_argv[2], pattern->getRows());
SETFLOAT(&result_argv[3], pattern->getColumns());
result_argc = 4;
return 0;
}