本文整理汇总了C++中Pattern::setCell方法的典型用法代码示例。如果您正苦于以下问题:C++ Pattern::setCell方法的具体用法?C++ Pattern::setCell怎么用?C++ Pattern::setCell使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Pattern
的用法示例。
在下文中一共展示了Pattern::setCell方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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_setcell
int track_proxy_setcell(t_track_proxy *x, t_symbol *sel, int argc, t_atom *argv)
{
result_argc = 0;
if(argc != 4 || !IS_A_SYMBOL(argv,0) || !IS_A_FLOAT(argv,1) || !IS_A_FLOAT(argv,2))
{
pd_error(x, "setrow: usage: setcell <pattern> <row#> <col#> <atom>");
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;
t_int c = (t_int) argv[2].a_w.w_float;
if(!pattern)
{
pd_error(x, "setcell: no such pattern: %s", pat->s_name);
return -2;
}
pattern->setCell(r, c, argv[3]);
return 0;
}
示例3: track_proxy_data
void track_proxy_data(t_track_proxy *x, t_symbol *s, int argc, t_atom *argv)
{
if(argc == 1 && IS_A_SYMBOL(argv,0) && argv[0].a_w.w_symbol == gensym("end"))
{
pd_unbind(&x->x_obj.ob_pd, gensym(TRACK_SELECTOR));
return;
}
if(argc < 3 || !IS_A_SYMBOL(argv,0) || !IS_A_FLOAT(argv,1) || !IS_A_FLOAT(argv,2))
{
pd_error(x, "unrecognized format for in-patch data");
return;
}
t_symbol *pat = argv[0].a_w.w_symbol;
t_int rows = (t_int) argv[1].a_w.w_float;
t_int cols = (t_int) argv[2].a_w.w_float;
if(argc != (3 + rows * cols))
{
pd_error(x, "unrecognized format for in-patch data (malformed data?)");
return;
}
Track *t = x->track;
t->addPattern(rows, cols, pat->s_name);
Pattern *p = t->getPattern(pat->s_name);
if(!p)
{
pd_error(x, "fatal error: cannot create patern");
return;
}
int a = 3;
for(int r = 0; r < rows; r++)
{
for(int c = 0; c < cols; c++)
{
p->setCell(r, c, argv[a]);
a++;
}
}
}