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; } }
/////////////// // 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; } }
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; } } }
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); } }
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; }
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; }
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; }
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)))); } }
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); }
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); } }
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); }
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); } }
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)); }
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; }
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); }
///////////////////////////////////////////////////////// // put the current image into the buffer, // and reset the position // (so we don't do a put in the next cycle) ///////////////////////////////////////////////////////// void pix_buffer_write :: render(GemState*state) { if (m_frame<0) { return; } if(!state) { return; } pixBlock*img=NULL; state->get(GemState::_PIX, img); if (state && img && &img->image) { if (img->newimage || m_frame!=m_lastframe) { if(m_bindname==NULL || m_bindname->s_name==NULL) { error("cowardly refusing to write to no pix_buffer"); m_frame=-1; return; } Obj_header*ohead=(Obj_header*)pd_findbyclass(m_bindname, pix_buffer_class); if(ohead==NULL) { error("couldn't find pix_buffer '%s'", m_bindname->s_name); m_frame=-1; return; } pix_buffer *buffer=(pix_buffer *)(ohead)->data; if (buffer) { buffer->putMess(&img->image,m_lastframe=m_frame); m_frame=-1; } } } }
/* on failure *bufsize is not modified */ t_word *cybuf_get(t_cybuf *c, t_symbol * name, int *bufsize, int indsp, int complain){ //in dsp = used in dsp, if (name && name != &s_){ t_garray *ap = (t_garray *)pd_findbyclass(name, garray_class); if (ap){ int bufsz; t_word *vec; if (garray_getfloatwords(ap, &bufsz, &vec)){ //c->c_len = garray_npoints(ap); if (indsp) garray_usedindsp(ap); if (bufsize) *bufsize = bufsz; return (vec); } else pd_error(c->c_owner, /* always complain */ "bad template of array '%s'", name->s_name); } else{ if(complain){ pd_error(c->c_owner, "no such array '%s'", name->s_name); }; }; } return (0); }
t_pd_err carray_buffer_set(t_carray *x, t_eattr *attr, long argc, t_atom* argv) { int i; x->f_array = NULL; if(argc && argv && atom_gettype(argv) == A_SYM) { x->f_name = atom_getsym(argv); if(!(x->f_array = (t_garray *)pd_findbyclass(x->f_name, garray_class))) { x->f_array = NULL; x->f_name = gensym("(null)"); x->f_buffer_size = 0; x->f_buffer = NULL; } else if(!garray_getfloatarray(x->f_array, &x->f_buffer_size, &x->f_buffer)) { x->f_array = NULL; x->f_name = gensym("(null)"); x->f_buffer_size = 0; x->f_buffer = NULL; } else { for(i = 0; i < x->f_buffer_size; i++) post("%f", x->f_buffer[i]); ebox_invalidate_layer((t_ebox*)x, gensym("buffer_layer")); ebox_redraw((t_ebox*)x); } } return 0; }
// analyze the whole damn array static void specCentroid_bang(t_specCentroid *x) { int window, startSamp, lengthSamp; 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_arrayPoints, &x->x_vec)) pd_error(x, "%s: bad template for specCentroid", x->x_arrayname->s_name); else { startSamp = 0; lengthSamp = x->x_arrayPoints; if(lengthSamp > x->powersOfTwo[x->powTwoArrSize-1]) { post("WARNING: specCentroid: window truncated because requested size is larger than the current max_window setting. Use the max_window method to allow larger windows. Sizes of more than 131072 may produce unreliable results."); lengthSamp = x->powersOfTwo[x->powTwoArrSize-1]; window = lengthSamp; } specCentroid_analyze(x, startSamp, lengthSamp); } }
static void bin_ambi_reduced_decode_fft2_calc_pinv(t_bin_ambi_reduced_decode_fft2 *x) { t_garray *a; int npoints; iemarray_t *fadevec; int i, n; double *dv3=x->x_prod3; double *dv2=x->x_prod2; if(x->x_beg_fade_out_hrir == 0) { if (!(a = (t_garray *)pd_findbyclass(x->x_s_fade_out_hrir, garray_class))) error("%s: no such array", x->x_s_fade_out_hrir->s_name); else if (!iemarray_getarray(a, &npoints, &fadevec)) error("%s: bad template for bin_ambi_reduced_decode_fft2", x->x_s_fade_out_hrir->s_name); else if (npoints < x->x_fftsize) error("%s: bad array-size: %d", x->x_s_fade_out_hrir->s_name, npoints); else x->x_beg_fade_out_hrir = fadevec; } bin_ambi_reduced_decode_fft2_transp_back(x); bin_ambi_reduced_decode_fft2_mul1(x); bin_ambi_reduced_decode_fft2_inverse(x); bin_ambi_reduced_decode_fft2_mul2(x); n = x->x_n_real_ls * x->x_n_ambi; for(i=0; i<n; i++) *dv3++ = *dv2++; }
void chopper_set(t_chopper *x, t_symbol *wavename) { int frames; t_garray *a; x->disabled = 0; x->b_frames = 0; x->b_nchans = 1; if (!(a = (t_garray *)pd_findbyclass(wavename, garray_class))) { if (*wavename->s_name) pd_error(x, "chopper~: %s: no such array", wavename->s_name); x->b_samples = 0; x->disabled = 1; } else if (!garray_getfloatarray(a, &frames, &x->b_samples)) { pd_error(x, "%s: bad template for chopper~", wavename->s_name); x->b_samples = 0; x->disabled = 1; } else { x->b_frames = frames; // post("%d frames in buffer",x->b_frames); garray_usedindsp(a); } }
static t_float *n_CLNLMS_tilde_check_array(t_symbol *array_sym_name, t_int length) { int n_points; t_garray *a; t_float *vec; if(!(a = (t_garray *)pd_findbyclass(array_sym_name, garray_class))) { error("%s: no such array for n_CLNLMS~", array_sym_name->s_name); return((t_float *)0); } else if(!garray_getfloatarray(a, &n_points, &vec)) { error("%s: bad template for n_CLNLMS~", array_sym_name->s_name); return((t_float *)0); } else if(n_points < length) { error("%s: bad array-size for n_CLNLMS~: %d", array_sym_name->s_name, n_points); return((t_float *)0); } else { return(vec); } }
///////////////////////////////////////////////////////// // get the image at <m_frame> from the buffer // and insert it into the gemchain ///////////////////////////////////////////////////////// void pix_buffer_read :: render(GemState*state) { if(m_needsupdate) { update_image(); } // if we don't have an image, just return if (!m_haveImage) { return; } /* push the incoming state->image into a temporary memory */ state->get(GemState::_PIX, orgPixBlock); /* pd_findbyclass costs at least 2 if's if m_bindname is also used for other classes too, we get an additional penalty for traversing the list of classes; all in all, msp has done a good job */ if (NULL==pd_findbyclass(m_bindname, pix_buffer_class)) { return; } state->set(GemState::_PIX, &m_pixBlock); }
static void spec2_tabreceive_tilde_dsp(t_spec2_tabreceive_tilde *x, t_signal **sp) { t_garray *a; int vecsize; if(!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) { if(*x->x_arrayname->s_name) error("spec2_tabreceive~: %s: no such array", x->x_arrayname->s_name); } else if(!iemarray_getarray(a, &vecsize, &x->x_vec)) error("%s: bad template for spec2_tabreceive~", x->x_arrayname->s_name); else { int n = sp[0]->s_n; if(n < vecsize) vecsize = n; vecsize /= 2; if(vecsize&15) dsp_add(spec2_tabreceive_tilde_perform, 3, x, sp[0]->s_vec, vecsize); else dsp_add(spec2_tabreceive_tilde_perf16, 3, x, sp[0]->s_vec, vecsize); } }
static void tabwrite_float(t_tabwrite *x, t_float f) { #ifdef ROCKBOX int vecsize; #else int i, vecsize; #endif t_garray *a; t_sample *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_getfloatarray(a, &vecsize, &vec)) pd_error(x, "%s: bad template for tabwrite", x->x_arrayname->s_name); else { int n = x->x_ft1; double timesince = clock_gettimesince(x->x_updtime); if (n < 0) n = 0; else if (n >= vecsize) n = vecsize-1; vec[n] = ftofix(f); if (timesince > 1000) { tabwrite_tick(x); } else { if (x->x_set == 0) { clock_delay(x->x_clock, 1000 - timesince); x->x_set = 1; } } } }
static void *specCentroid_new(t_symbol *s) { t_specCentroid *x = (t_specCentroid *)pd_new(specCentroid_class); int i; t_garray *a; x->x_centroid = outlet_new(&x->x_obj, &s_float); if(s) { x->x_arrayname = s; if(!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class))) ; else if(!garray_getfloatwords(a, &x->x_arrayPoints, &x->x_vec)) pd_error(x, "%s: bad template for specCentroid", x->x_arrayname->s_name); } else error("specCentroid: no array specified."); x->sr = 44100.0; x->window = 1; // should be a bogus size initially to force the proper resizes when a real _analyze request comes through x->windowFuncSize = 1; x->windowFunction = 4; // 4 is hann window x->powerSpectrum = 0; // choose mag (0) or power (1) spec in the specCentroid computation x->maxWindowSize = MAXWINDOWSIZE; // this seems to be the maximum size allowable by mayer_realfft(); x->powersOfTwo = (int *)t_getbytes(sizeof(int)); x->powersOfTwo[0] = 64; // must have at least this large of a window i=1; while(x->powersOfTwo[i-1] < x->maxWindowSize) { x->powersOfTwo = (int *)t_resizebytes(x->powersOfTwo, i*sizeof(int), (i+1)*sizeof(int)); x->powersOfTwo[i] = pow(2, i+6); // +6 because we're starting at 2**6 i++; } x->powTwoArrSize = i; x->signal_R = (t_sample *)t_getbytes(x->window*sizeof(t_sample)); for(i=0; i<x->window; i++) x->signal_R[i] = 0.0; x->blackman = (t_float *)t_getbytes(x->windowFuncSize*sizeof(t_float)); x->cosine = (t_float *)t_getbytes(x->windowFuncSize*sizeof(t_float)); x->hamming = (t_float *)t_getbytes(x->windowFuncSize*sizeof(t_float)); x->hann = (t_float *)t_getbytes(x->windowFuncSize*sizeof(t_float)); // initialize signal windowing functions tIDLib_blackmanWindow(x->blackman, x->windowFuncSize); tIDLib_cosineWindow(x->cosine, x->windowFuncSize); tIDLib_hammingWindow(x->hamming, x->windowFuncSize); tIDLib_hannWindow(x->hann, x->windowFuncSize); return (x); }
/* get a pointer to a named symbol list (a "scommon" object), which is created if necessary. */ t_scommon *slist_get(t_symbol *s) { t_scommon *c = (t_scommon *)pd_findbyclass(s, scommon_class); if (!c) c = (t_scommon *)scommon_new(s); c->c_refcount++; return (c); }
static void hammerembed_gc(t_pd *x, t_symbol *s, int expected) { t_pd *garbage; int count = 0; while (garbage = pd_findbyclass(s, *x)) pd_unbind(garbage, s), count++; if (count != expected) bug("hammerembed_gc (%d garbage bindings)", count); }
void cybuf_redraw(t_cybuf *c) { if(!c->c_single){ if (c->c_numchans <= 1 && c->c_bufname != &s_) { t_garray *ap = (t_garray *)pd_findbyclass(c->c_bufname, garray_class); if (ap) garray_redraw(ap); else if (c->c_vectors[0]) cybuf_bug("cybuf_redraw 1"); } else if (c->c_numchans > 1){ int ch = c->c_numchans; while (ch--){ t_garray *ap = (t_garray *)pd_findbyclass(c->c_channames[ch], garray_class); if (ap) garray_redraw(ap); else if (c->c_vectors[ch]) cybuf_bug("cybuf_redraw 2"); } }; } else{ int chan_idx; char buf[MAXPDSTRING]; t_symbol * curname; //name of the current channel we want int chan_num = c->c_single; //1-indexed channel number chan_num = chan_num < 1 ? 1 : (chan_num > CYBUF_MAXCHANS ? CYBUF_MAXCHANS : chan_num); //convert to 0-indexing, separate steps and diff variable for sanity's sake chan_idx = chan_num - 1; //making the buffer channel name string we'll be looking for if(c->c_bufname != &s_){ if(chan_idx == 0){ //if channel idx is 0, check for just plain bufname as well t_garray *ap = (t_garray *)pd_findbyclass(c->c_bufname, garray_class); if (ap){ garray_redraw(ap); return; }; }; sprintf(buf, "%d-%s", chan_idx, c->c_bufname->s_name); curname = gensym(buf); t_garray *ap = (t_garray *)pd_findbyclass(curname, garray_class); if (ap) garray_redraw(ap); //not really sure what the specific message is for, just copied single channel one - DK else if (c->c_vectors[0]) cybuf_bug("cybuf_redraw 1"); }; }; }
static void tabwrite_tick(t_tabwrite *x) { t_garray *a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class); if (!a) bug("tabwrite_tick"); else garray_redraw(a); x->x_set = 0; x->x_updtime = clock_getsystime(); }