本文整理汇总了C++中pd_findbyclass函数的典型用法代码示例。如果您正苦于以下问题:C++ pd_findbyclass函数的具体用法?C++ pd_findbyclass怎么用?C++ pd_findbyclass使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pd_findbyclass函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: bin_ambi_reduced_decode_fft2_check_HRTF_arrays
static void bin_ambi_reduced_decode_fft2_check_HRTF_arrays(t_bin_ambi_reduced_decode_fft2 *x, t_floatarg findex)
{
int xindex=(int)findex - 1;
t_garray *a;
int npoints;
int fftsize = x->x_fftsize;
iemarray_t *vec_hrtf_re, *vec_hrtf_im;
t_symbol *hrtf_re, *hrtf_im;
if(xindex < 0)
xindex = 0;
if(xindex >= x->x_n_ambi)
xindex = x->x_n_ambi - 1;
hrtf_re = x->x_s_hrtf_re[xindex];
hrtf_im = x->x_s_hrtf_im[xindex];
if (!(a = (t_garray *)pd_findbyclass(hrtf_re, garray_class)))
error("%s: no such array", hrtf_re->s_name);
else if (!iemarray_getarray(a, &npoints, &vec_hrtf_re))
error("%s: bad template for bin_ambi_reduced_decode_fft2", hrtf_re->s_name);
else if (npoints < fftsize)
error("%s: bad array-size: %d", hrtf_re->s_name, npoints);
else if (!(a = (t_garray *)pd_findbyclass(hrtf_im, garray_class)))
error("%s: no such array", hrtf_im->s_name);
else if (!iemarray_getarray(a, &npoints, &vec_hrtf_im))
error("%s: bad template for bin_ambi_reduced_decode_fft2", hrtf_im->s_name);
else if (npoints < fftsize)
error("%s: bad array-size: %d", hrtf_im->s_name, npoints);
else
{
x->x_beg_hrtf_re[xindex] = vec_hrtf_re;
x->x_beg_hrtf_im[xindex] = vec_hrtf_im;
}
}
示例2: update_graphs
///////////////
// update graphs
//
///////////////
void pix_histo :: update_graphs(void)
{
t_garray *a;
switch (m_mode) {
/* coverity[unterminated_case] */
case 4:
if ((a = (t_garray *)pd_findbyclass(name_A, garray_class))) {
garray_redraw(a);
}
/* coverity[unterminated_case] */
case 3:
if ((a = (t_garray *)pd_findbyclass(name_G, garray_class))) {
garray_redraw(a);
}
if ((a = (t_garray *)pd_findbyclass(name_B, garray_class))) {
garray_redraw(a);
}
case 1:
if ((a = (t_garray *)pd_findbyclass(name_R, garray_class))) {
garray_redraw(a);
}
default:
break;
}
}
示例3: ritmo1_bang
static void ritmo1_bang(t_ritmo1 *x) {
int i, vecsize;
t_garray *arysrc;
t_garray *arydest;
t_float *vecsrc;
t_float *vecdest;
if (!(arysrc = (t_garray *)pd_findbyclass(x->x_arrayname_src, garray_class)))
{
pd_error(x, "%s: no such array", x->x_arrayname_src->s_name);
}
else if (!garray_getfloatarray(arysrc, &vecsize, &vecsrc))
{
pd_error(x, "%s: bad template for tabwrite", x->x_arrayname_src->s_name);
}
else if (!(arydest = (t_garray *)pd_findbyclass(x->x_arrayname_dest, garray_class)))
{
pd_error(x, "%s: no such array", x->x_arrayname_dest->s_name);
}
else if (!garray_getfloatarray(arydest, &vecsize, &vecdest))
{
pd_error(x, "%s: bad template for tabwrite", x->x_arrayname_dest->s_name);
}
else // I got arrays and data
{
// step 1: compute the pattern
// and write it in vecdest
for (i=0; i<16; i++)
{
// vecdest[i] = (x->buf1[i] + x->buf2[i] + x->buf3[i] + vecsrc[i])/4;
vecdest[i] = (x->buf1[i] + vecsrc[i])/2;
}
// redraw the arrays
garray_redraw(arysrc);
garray_redraw(arydest);
// step 2: cycle buffers
// x->buf3 = x->buf2;
// x->buf2 = x->buf1;
// x->buf1 = x->buf3;
// fill the first buffer with src data
for (i=0; i<16; i++)
{
x->buf1[i] = vecsrc[i];
vecsrc[i]=0;
}
}
}
示例4: sliceplay_set
static void sliceplay_set(t_sliceplay *x)
{
t_garray *array;
int arraysize, logloopsize;
if(!(array = (t_garray *)pd_findbyclass(x->arrayname, garray_class)))
{
if (x->arrayname->s_name) pd_error(x, "sliceplay~: %s: no such array",
x->arrayname->s_name);
x->arraypointer = 0;
}
else if (!garray_getfloatwords(array, &arraysize, &x->arraypointer))
{
pd_error(x, "%s: bad template for sliceplay~", x->arrayname->s_name);
x->arraypointer = 0;
}
else
{
logloopsize = ilog2(arraysize-3); // arraysize must be at least loopsize + 1 sample
x->loopsize = 1<<logloopsize; // loopsize is rounded to a power of two
x->loopmask = x->loopsize - 1; // bitwise-and mask for loopsize
garray_usedindsp(array);
}
}
示例5: clear
int clear(t_trento *x)
{
t_garray *a;
t_symbol *b_name;
t_word *b_samples;
int b_frames;
x->b_valid = 0;
b_name = x->b_name;
int i;
if (!(a = (t_garray *)pd_findbyclass(b_name,garray_class))) {
if (b_name->s_name)
pd_error(x,"trento: %s: no such array",b_name->s_name);
return x->b_valid;
}
if (!garray_getfloatwords(a, &b_frames, &b_samples)) {
pd_error(x, "trento: bad array for %s", b_name->s_name);
return x->b_valid;
}
else {
for (i=0;i<b_frames;i++)
b_samples[i].w_float = 0.f;
x->b_valid = 1;
}
return x->b_valid;
}
示例6: init
int init(t_trento *x)
{
t_garray *a;
t_symbol *b_name;
t_word *b_samples;
int b_frames;
x->b_valid = 0;
b_name = x->b_name;
x->loadcomplete = 1;
x->graincomplete = 1;
x->sr = sys_getsr();
if(x->sr <= 0)
x->sr = 44100;
int i;
x->seed = time(NULL);
srand(x->seed);
if (!(a = (t_garray *)pd_findbyclass(b_name,garray_class))) {
if (b_name->s_name)
pd_error(x,"trento: %s: no such array",b_name->s_name);
return x->b_valid;
}
if (!garray_getfloatwords(a, &b_frames, &b_samples)) {
pd_error(x, "trento: bad array for %s", b_name->s_name);
return x->b_valid;
}
else {
for (i=0;i<b_frames;i++)
b_samples[i].w_float = 0.f;
x->b_valid = 1;
}
return x->b_valid;
}
示例7: attach_array
int attach_array(t_trento *x)
{
t_garray *a;
t_symbol *b_name;
t_word *b_samples;
int b_frames;
x->b_valid = 0;
b_name = x->b_name;
if (!(a = (t_garray *)pd_findbyclass(b_name,garray_class))) {
if (b_name->s_name)
pd_error(x,"trento: %s: no such array",b_name->s_name);
return x->b_valid;
}
if (!garray_getfloatwords(a, &b_frames, &b_samples)) {
pd_error(x, "trento: bad array for %s", b_name->s_name);
return x->b_valid;
}
else {
x->b_valid = 1;
x->b_frames = b_frames;
x->b_samples = b_samples;
x->buffy = a;
}
return x->b_valid;
}
示例8: tabread4_float
static void tabread4_float(t_tabread4 *x, t_float f)
{
t_garray *a;
int npoints;
t_word *vec;
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
pd_error(x, "%s: no such array", x->x_arrayname->s_name);
else if (!garray_getfloatwords(a, &npoints, &vec))
pd_error(x, "%s: bad template for tabread4", x->x_arrayname->s_name);
else if (npoints < 4)
outlet_float(x->x_obj.ob_outlet, 0);
else if (f <= 1)
outlet_float(x->x_obj.ob_outlet, vec[1].w_float);
else if (f >= npoints - 2)
outlet_float(x->x_obj.ob_outlet, vec[npoints - 2].w_float);
else
{
int n = f;
float a, b, c, d, cminusb, frac;
t_word *wp;
if (n >= npoints - 2)
n = npoints - 3;
wp = vec + n;
frac = f - n;
a = wp[-1].w_float;
b = wp[0].w_float;
c = wp[1].w_float;
d = wp[2].w_float;
cminusb = c-b;
outlet_float(x->x_obj.ob_outlet, b + frac * (
cminusb - 0.1666667f * (1.-frac) * (
(d - a - 3.0f * cminusb) * frac + (d + 2.0f*a - 3.0f*b))));
}
}
示例9: while
static t_int *tabsend_perform(t_int *w)
{
t_tabsend *x = (t_tabsend *)(w[1]);
t_sample *in = (t_sample *)(w[2]);
int n = w[3];
t_word *dest = x->x_vec;
int i = x->x_graphcount;
if (!x->x_vec) goto bad;
if (n > x->x_npoints)
n = x->x_npoints;
while (n--)
{
t_sample f = *in++;
if (PD_BIGORSMALL(f))
f = 0;
(dest++)->w_float = f;
}
if (!i--)
{
t_garray *a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class);
if (!a)
bug("tabsend_dsp");
else garray_redraw(a);
i = x->x_graphperiod;
}
x->x_graphcount = i;
bad:
return (w+4);
}
示例10: tabosc4_tilde_set
static void tabosc4_tilde_set(t_tabosc4_tilde *x, t_symbol *s)
{
t_garray *a;
int npoints, pointsinarray;
x->x_arrayname = s;
if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
{
if (*s->s_name)
pd_error(x, "tabosc4~: %s: no such array", x->x_arrayname->s_name);
x->x_vec = 0;
}
else if (!garray_getfloatwords(a, &pointsinarray, &x->x_vec))
{
pd_error(x, "%s: bad template for tabosc4~", x->x_arrayname->s_name);
x->x_vec = 0;
}
else if ((npoints = pointsinarray - 3) != (1 << ilog2(pointsinarray - 3)))
{
pd_error(x, "%s: number of points (%d) not a power of 2 plus three",
x->x_arrayname->s_name, pointsinarray);
x->x_vec = 0;
garray_usedindsp(a);
}
else
{
x->x_fnpoints = npoints;
x->x_finvnpoints = 1./npoints;
garray_usedindsp(a);
}
}
示例11: tabwrite_tilde_redraw
static void tabwrite_tilde_redraw(t_tabwrite_tilde *x)
{
t_garray *a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class);
if (!a)
bug("tabwrite_tilde_redraw");
else garray_redraw(a);
}
示例12: tab_cross_corr_tick
static void tab_cross_corr_tick(t_tab_cross_corr *x)
{
x->x_counter++;
if(x->x_counter < x->x_n)
{
iemarray_t *vec_src1, *vec_src2, *vec_dst;
t_float sum;
int j, m;
vec_src1 = x->x_beg_mem_src1 + x->x_counter;
vec_src2 = x->x_beg_mem_src2;
vec_dst = x->x_beg_mem_dst + x->x_counter;
m = x->x_size_src2;
sum = 0.0f;
for(j=0; j<m; j++)
{
sum += iemarray_getfloat(vec_src1, j)*iemarray_getfloat(vec_src2, j);
}
iemarray_setfloat(vec_dst, 0, sum*x->x_factor);
clock_delay(x->x_clock, x->x_delay);
}
else
{
t_garray *a;
clock_unset(x->x_clock);
outlet_bang(x->x_obj.ob_outlet);
a = (t_garray *)pd_findbyclass(x->x_sym_dst, garray_class);
garray_redraw(a);
}
}
示例13: patchvalue_classnew
static t_patchboard *patchboard_find(t_symbol *category)
{
if (!patchboard_class)
patchboard_class =
patchvalue_classnew(gensym("_patchboard"), sizeof(t_patchboard));
return ((t_patchboard *)pd_findbyclass(category, patchboard_class));
}
示例14: FIR_tilde_set
void FIR_tilde_set(t_FIR_tilde *x, t_symbol *table_name, t_floatarg forder)
{
t_garray *ga;
int table_size;
int order = (int)forder;
x->x_table_name = table_name;
if(!(ga = (t_garray *)pd_findbyclass(x->x_table_name, garray_class)))
{
if(*table_name->s_name)
error("FIR~: %s: no such table~", x->x_table_name->s_name);
x->x_coef_beg = 0;
}
else if(!garray_getfloatarray(ga, &table_size, &x->x_coef_beg))
{
error("%s: bad template for FIR~", x->x_table_name->s_name);
x->x_coef_beg = 0;
}
else if(table_size < order)
{
error("FIR~: tablesize %d < order %d !!!!", table_size, order);
x->x_coef_beg = 0;
}
else
garray_usedindsp(ga);
x->x_rw_index = 0;
if(order > x->x_fir_order)/* resize */
x->x_history_beg = (t_float *)resizebytes(x->x_history_beg, 2*x->x_fir_order*sizeof(t_float), 2*order*sizeof(float));
x->x_fir_order = order;
}
示例15: bark_print
static void bark_print(t_bark *x)
{
t_garray *a;
if(!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
pd_error(x, "%s: no such array", x->x_arrayname->s_name);
else if(!garray_getfloatwords(a, &x->x_array_points, &x->x_vec))
pd_error(x, "%s: bad template for bark", x->x_arrayname->s_name);
else
post("total frames: %i", (int)floor((x->x_array_points - x->window)/x->hop));
post("window size: %i", (int)x->window);
post("hop: %i", x->hop);
post("Bark spacing: %0.2f", x->barkSpacing);
post("no. of filters: %i", x->numFilters);
post("bin range: %i through %i (inclusive)", x->loBin, x->hiBin);
post("low thresh: %0.2f, high thresh: %0.2f", x->loThresh, x->hiThresh);
post("minvel: %f", x->minvel);
post("mask periods: %i, mask decay: %0.2f", x->maskPeriods, x->maskDecay);
post("debounce time: %0.2f", x->debounceTime);
post("normalization: %i", x->normalize);
post("filter averaging: %i", x->filterAvg);
post("power spectrum: %i", x->powerSpectrum);
post("loudness weights: %i", x->useWeights);
post("spew mode: %i", x->spew);
post("debug mode: %i", x->debug);
}