Пример #1
0
/* Assert a standard stackless traversal producing the same sequence,
   as the auxiliary list. */
static int qtree_checktraversal(t_qtree *tree)
{
    t_qnode *treewalk = tree->t_root;
    t_qnode *listwalk = tree->t_first;
    int count = 0;
    while (treewalk)
    {
        t_qnode *prev = treewalk->n_left;
        if (prev)
        {
            while (prev->n_right && prev->n_right != treewalk)
                prev = prev->n_right;
            if (prev->n_right)
            {
                prev->n_right = 0;
                count++;
                if (treewalk == listwalk)
                    listwalk = listwalk->n_next;
                else
                {
                    loudbug_bug("qtree_checktraversal 1");
                    qnode_post(tree, treewalk, 0, "treewalk");
                    if (listwalk)
                        qnode_post(tree, listwalk, 0, "listwalk");
                    else
                        loudbug_post("empty listwalk pointer");
                    listwalk = treewalk;
                }
                treewalk = treewalk->n_right;
            }
            else
            {
                prev->n_right = treewalk;
                treewalk = treewalk->n_left;
            }
        }
        else
        {
            count++;
            if (treewalk == listwalk)
                listwalk = listwalk->n_next;
            else
            {
                loudbug_bug("qtree_checktraversal 2");
                qnode_post(tree, treewalk, 0, "treewalk");
                if (listwalk)
                    qnode_post(tree, listwalk, 0, "listwalk");
                else
                    loudbug_post("empty listwalk pointer");
                listwalk = treewalk;
            }
            treewalk = treewalk->n_right;
        }
    }
    return (count);
}
Пример #2
0
static void curve_tick(t_curve *x)
{
    outlet_bang(x->x_bangout);
#ifdef CURVE_DEBUG
    loudbug_post("exit point %d, after %d retarget calls",
		 x->dbg_exitpoint, x->dbg_nretargets);
    loudbug_post("at value %g, after last %d nhops, with bb %g, mm %g",
		 x->x_value, x->dbg_nhops, x->x_bb, x->x_mm);
    x->dbg_nretargets = x->dbg_exitpoint = x->dbg_nhops = 0;
#endif
}
Пример #3
0
static void comment_draw(t_comment *x)
{
    char buf[COMMENT_OUTBUFSIZE], *outbuf, *outp;
    unsigned long cvid = (unsigned long)x->x_canvas;
    int reqsize = x->x_textbufsize + 250;  /* FIXME estimation */
    if (reqsize > COMMENT_OUTBUFSIZE)
    {
#ifdef COMMENT_DEBUG
	loudbug_post("allocating %d outbuf bytes", reqsize);
#endif
	if (!(outbuf = getbytes(reqsize)))
	    return;
    }
    else outbuf = buf;
    outp = outbuf;
    sprintf(outp, "comment_draw %s .x%lx.c %s %s %f %f %s %d %s %s {%.*s} %d\n",
	    x->x_bindsym->s_name, cvid, x->x_texttag, x->x_tag,
	    (float)(text_xpix((t_text *)x, x->x_glist) + COMMENT_LMARGIN),
	    (float)(text_ypix((t_text *)x, x->x_glist) + COMMENT_TMARGIN),
	    x->x_fontfamily->s_name, x->x_fontsize,
	    (glist_isselected(x->x_glist, &x->x_glist->gl_gobj) ?
	     "blue" : x->x_color),
	    (x->x_encoding ? x->x_encoding->s_name : "\"\""),
	    x->x_textbufsize, x->x_textbuf, x->x_pixwidth);
    x->x_bbpending = 1;
    sys_gui(outbuf);
    if (outbuf != buf) freebytes(outbuf, reqsize);
}
Пример #4
0
static void comment_grabbedkey(void *z, t_floatarg f)
{
    /* LATER think about replacing #key binding/comment_float() with grabbing */
#ifdef COMMENT_DEBUG
    loudbug_post("comment_grabbedkey %g", f);
#endif
}
Пример #5
0
static int imaction_N1_vtable(t_port *x, char *arg)
{
    int range = port_getint(x, 8),
	left = port_getint(x, 3),
	top = port_getint(x, 4),
	right = port_getint(x, 5),
	bottom = port_getint(x, 6),
	flags = port_getint(x, 7);
    import_emstart(x, portps_vtable, port_getsymbol(x, 9), port_getint(x, 2));
#ifdef PORT_DEBUG
    loudbug_post(
	"vtable \"%s\": size %d, range %d, coords %d %d %d %d, flags %d",
	x->x_emname->s_name, x->x_emsize,
	range, left, top, right, bottom, flags);
#endif
    import_emaddv(x, portps_vtable, "si;", gensym("size"), x->x_emsize);
    import_emaddv(x, portps_vtable, "siiii;", gensym("flags"),
		  /* CHECKED */
		  (flags & 16) != 0, (flags & 4) != 0,
		  (flags & 8) != 0, (flags & 2) != 0);
    import_emaddv(x, portps_vtable, "si;", gensym("tabrange"), range);
    import_emaddv(x, portps_vtable, "siiiii;", gensym("_coords"),
		  left, top, right, bottom, flags & 1);
    return (PORT_NEXT);
}
Пример #6
0
static t_binbuf *plustot_qlist_usurp(t_plustot_qlist *x)
{
    static t_symbol *types[2];
    static int ntypes = 0;
    t_object *booty;
    if (ntypes == 0)
    {
	types[0] = gensym("qlist");
	types[1] = gensym("textfile");
	ntypes = 2;
    }
    if (booty = fragile_outlet_destination(
	((t_object *)x)->ob_outlet, ntypes, types,
	(t_pd *)x, "(connect left outlet to a qlist or textfile)"))
    {
	t_binbuf *bb = ((t_qlist *)booty)->x_binbuf;
#ifdef PLUSTOT_QLIST_DEBUG
	loudbug_post("booty '%s' at %x:",
		     class_getname(*(t_pd *)booty), (int)booty);
	loudbug_postbinbuf(bb);
#endif
	return (bb);
    }
    else return (0);
}
Пример #7
0
static void curve_list(t_curve *x, t_symbol *s, int ac, t_atom *av)
{
    int natoms, nsegs, odd;
    t_atom *ap;
    t_curveseg *segp;
    for (natoms = 0, ap = av; natoms < ac; natoms++, ap++)
    {
	if (ap->a_type != A_FLOAT)
	{
	    loud_messarg((t_pd *)x, &s_list);  /* CHECKED */
	    return;  /* CHECKED */
	}
    }
    if (!natoms)
	return;  /* CHECKED */
    odd = natoms % 3;
    nsegs = natoms / 3;
    if (odd) nsegs++;
    if (nsegs > x->x_size)
    {
	int ns = nsegs;
	x->x_segs = grow_nodata(&ns, &x->x_size, x->x_segs,
				CURVE_INISIZE, x->x_segini,
				sizeof(*x->x_segs));
	if (ns < nsegs)
	{
	    natoms = ns * 3;
	    nsegs = ns;
	    odd = 0;
	}
    }
    x->x_nsegs = nsegs;
#ifdef CURVE_DEBUG
    loudbug_post("%d segments:", x->x_nsegs);
#endif
    segp = x->x_segs;
    if (odd) nsegs--;
    while (nsegs--)
    {
	segp->s_target = av++->a_w.w_float;
	segp->s_delta = av++->a_w.w_float;
	curve_cc(x, segp, av++->a_w.w_float);
	segp++;
    }
    if (odd)
    {
	segp->s_target = av->a_w.w_float;
	if (odd > 1)
	    segp->s_delta = av[1].a_w.w_float;
	else
	    segp->s_delta = 0;
	curve_cc(x, segp, 0.);
    }
    x->x_deltaset = 0;
    x->x_target = x->x_segs->s_target;
    x->x_curseg = x->x_segs;
    x->x_retarget = 1;
}
Пример #8
0
void qtree_debug(t_qtree *tree, int level, t_qnode_vshowhook hook)
{
    t_qnode *np;
    int count;
    loudbug_post("------------------------");
    count = qtree_checktraversal(tree);
    if (level)
    {
        for (np = tree->t_first; np; np = np->n_next)
            qnode_post(tree, np, hook, 0);
        if (level > 1)
        {
            loudbug_post("************");
            for (np = tree->t_last; np; np = np->n_prev)
                loudbug_startpost("%g ", np->n_key);
            loudbug_endpost();
        }
    }
    if (tree->t_root)
    {
        t_qnode *first = tree->t_root, *last = tree->t_root;
        while (first->n_left && first->n_left != tree->t_root)
            first = first->n_left;
        while (last->n_right && last->n_right != tree->t_root)
            last = last->n_right;
        loudbug_post("count %d, height %d, root %g",
                     count, qnode_height(tree->t_root), tree->t_root->n_key);
        loudbug_post("first %g, root->left* %g, last %g, root->right* %g",
                     (tree->t_first ? tree->t_first->n_key : 0), first->n_key,
                     (tree->t_last ? tree->t_last->n_key : 0), last->n_key);
    }
    else loudbug_post("empty");
    loudbug_post("...verified (black-height is %d)", qtree_verify(tree));
    loudbug_post("------------------------");
}
Пример #9
0
static void mtr_debug(t_mtr *x)
{
    int ntracks = x->x_ntracks;
    t_mtrack **tpp = x->x_tracks;
    while (ntracks--)
    {
	loudbug_post("------- Track %d -------", (*tpp)->tr_id);
	loudbug_postbinbuf((*tpp++)->tr_binbuf);
    }
}
Пример #10
0
/* Search for a property, replace its value if found, otherwise add.
   If 'filter' contains an exact copy, do nothing.  Assuming 'keysym'
   is valid.  Returning nafter - nbefore. */
static int props_update(t_props *pp, int mode, t_props *filter,
			t_symbol *keysym, int ac, t_atom *av, int doit)
{
    int nadd, ndiff, ibeg, iend = 0;
    t_atom *ap;
    for (nadd = 0, ap = av; nadd < ac; nadd++, ap++)
	if (ap->a_type == A_SYMBOL &&
	    props_iskey(pp, mode, ap->a_w.w_symbol->s_name) != PROPS_NONE)
	    break;
    if (!nadd)
    {
	pp->p_badupdate = 1;
	return (0);
    }
    pp->p_badupdate = 0;
    nadd++;

    if (filter)
    {
	int acf;
	t_atom *apf = props_getone(filter, keysym, &acf);
	if (acf == nadd)
	{
	    int i;
#ifdef PROPS_DEBUG
	    loudbug_startpost("checking %s", keysym->s_name);
	    loudbug_postatom(nadd - 1, av);
#endif
	    for (i = 1, ap = av, apf++; i < nadd; i++, ap++, apf++)
		if (ap->a_type != apf->a_type ||
		    ap->a_w.w_symbol != apf->a_w.w_symbol)
		    break;
	    if (i == nadd)
#ifndef PROPS_DEBUG
		return (0);
#else
	    {
		loudbug_post(" ... filtered");
		return (0);
	    }
	    else loudbug_post(" ... updated");
#endif
	}
Пример #11
0
static void curve_cc(t_curve *x, t_curveseg *segp, float f)
{
    int nhops = segp->s_delta * x->x_ksr + 0.5;  /* LATER rethink */
    segp->s_ccinput = f;
    segp->s_nhops = (nhops > 0 ? nhops : 0);
    clccurve_coefs(segp->s_nhops, (double)f, &segp->s_bb, &segp->s_mm);
#ifdef CURVE_DEBUG
    loudbug_post("%g %g %g %g",
		 segp->s_target, segp->s_delta, segp->s_bb, segp->s_mm);
#endif
}
Пример #12
0
static void widgettype_map(t_widgettype *wt, char *cls, char *req)
{
    wt->wt_tkclass = (cls ? gensym(cls) : 0);
    if (wt->wt_requirements)
	freebytes(wt->wt_requirements, strlen(wt->wt_requirements) + 1);
    if (req && *req)
    {
	char *opt = 0;
	wt->wt_requirements = getbytes(strlen(req) + 1);
	strcpy(wt->wt_requirements, req);
	while (req)
	{
	    char *w1 = scriptlet_nextword(req);
	    opt = (*req == '-' ? req : (w1 && *w1 == '-' ? w1 : 0));
	    if (opt)
	    {
		if (strcmp(opt + 1, "exact"))
		{
		    loud_error
			(0, "unknown option \"%s\" in widget type header", opt);
		    opt = 0;
		}
		if (*req == '-')
		{
		    req = w1;
		    continue;
		}
		else w1 = scriptlet_nextword(w1);
	    }
	    if (*req >= '0' && *req <= '9')
	    {
		loud_error
		    (0, "invalid base widget name \"%s\" in widget type header",
		     req);
		req = w1;
	    }
	    else
	    {
		t_widgettype *base;
		char *ver = (w1 && *w1 >= '0' && *w1 <= '9' ? w1 : 0);
		char *w2 = (ver ? scriptlet_nextword(ver) : w1);
#if 1
		loudbug_post("require %s (version %s %s)",
			     req, (opt ? opt : ">="), (ver ? ver : "any"));
#endif
		base = widgettype_get(gensym(req), ver, opt, wt->wt_glist);
		if (!base->wt_tkclass)
		    loud_error(0, "missing base widget file \"%s.wid\"", req);
		req = w2;
	    }
	}
    }
    else wt->wt_requirements = 0;
}
Пример #13
0
/* only for debugging (never call, unless certain that nobody references wt) */
static void widgettype_free(t_masterwidget *mw, t_widgettype *wt)
{
    loudbug_startpost("widgettype free... ");
    if (wt->wt_requirements)
	freebytes(wt->wt_requirements, strlen(wt->wt_requirements) + 1);
    dict_unbind(mw->mw_typemap, (t_pd *)wt, wt->wt_typekey);
    props_freeall(wt->wt_options);
    scriptlet_free(wt->wt_auxscript);
    widgethandlers_free(wt->wt_scripts);
    pd_free((t_pd *)wt);
    loudbug_post("done");
}
Пример #14
0
static char *props_mixupinitial(t_props *pp, char c)
{
    t_props *pp1 = pp->p_firstmixup;
    while (pp1)
    {
	if (pp1 != pp && pp1->p_thisescape == c)
	    return (pp1->p_thisinitial);
	pp1 = pp1->p_next;
    }
    loudbug_bug("props_mixupinitial");
    loudbug_post("(%c \"%s\")", c, pp->p_mixupescapes);
    return (0);
}
Пример #15
0
static void qnode_post(t_qtree *tree, t_qnode *np,
                       t_qnode_vshowhook hook, char *message)
{
    loudbug_startpost("%g ", np->n_key);
    if (tree->t_valuetype == QTREETYPE_FLOAT)
        loudbug_startpost("%g ", QNODE_GETFLOAT(np));
    else if (tree->t_valuetype == QTREETYPE_SYMBOL)
        loudbug_startpost("%s ", QNODE_GETSYMBOL(np)->s_name);
    else if (tree->t_valuetype == QTREETYPE_ATOM)
    {
        t_atom *ap = QNODE_GETATOMPTR(np);
        if (ap->a_type == A_FLOAT)
            loudbug_startpost("%g ", ap->a_w.w_float);
        else if (ap->a_type == A_SYMBOL)
            loudbug_startpost("%s ", ap->a_w.w_symbol->s_name);
    }
    else if (hook)
    {
        char buf[MAXPDSTRING];
        (*hook)(np, buf, MAXPDSTRING);
        loudbug_startpost("%s ", buf);
    }
    else loudbug_startpost("0x%08x ", (int)QNODE_GETSYMBOL(np));
    loudbug_startpost("%s ", (np->n_black ? "black" : "red"));

    if (qnode_checkmulti(np, np->n_parent) ||
            qnode_checkmulti(np, np->n_left) ||
            qnode_checkmulti(np, np->n_right) ||
            qnode_checkmulti(np->n_parent, np->n_left) ||
            qnode_checkmulti(np->n_parent, np->n_right) ||
            qnode_checkmulti(np->n_left, np->n_right))
        loudbug_startpost("multi ");

    if (np->n_parent)
        loudbug_startpost("(%g -> ", np->n_parent->n_key);
    else
        loudbug_startpost("(nul -> ");
    if (np->n_left)
        loudbug_startpost("%g, ", np->n_left->n_key);
    else
        loudbug_startpost("nul, ");
    if (np->n_right)
        loudbug_startpost("%g)", np->n_right->n_key);
    else
        loudbug_startpost("nul)");
    if (message)
        loudbug_post(": %s", message);
    else
        loudbug_endpost();
}
Пример #16
0
static void comment__bboxhook(t_comment *x, t_symbol *bindsym,
			      t_floatarg x1, t_floatarg y1,
			      t_floatarg x2, t_floatarg y2)
{
#ifdef COMMENT_DEBUG
    loudbug_post("bbox %g %g %g %g", x1, y1, x2, y2);
#endif
    x->x_x1 = x1;
    x->x_y1 = y1;
    x->x_x2 = x2;
    x->x_y2 = y2;
    x->x_bbset = 1;
    x->x_bbpending = 0;
}
Пример #17
0
static void comment_update(t_comment *x)
{
    char buf[COMMENT_OUTBUFSIZE], *outbuf, *outp;
    unsigned long cvid = (unsigned long)x->x_canvas;
    int reqsize = x->x_textbufsize + 250;  /* FIXME estimation */
    if (reqsize > COMMENT_OUTBUFSIZE)
    {
#ifdef COMMENT_DEBUG
	loudbug_post("allocating %d outbuf bytes", reqsize);
#endif
	if (!(outbuf = getbytes(reqsize)))
	    return;
    }
    else outbuf = buf;
    outp = outbuf;
    sprintf(outp, "comment_update .x%lx.c %s %s {%.*s} %d\n", cvid,
	    x->x_texttag, (x->x_encoding ? x->x_encoding->s_name : "\"\""),
	    x->x_textbufsize, x->x_textbuf, x->x_pixwidth);
    outp += strlen(outp);
    if (x->x_active)
    {
	if (x->x_selend > x->x_selstart)
	{
	    sprintf(outp, ".x%lx.c select from %s %d\n",
		    cvid, x->x_texttag, x->x_selstart);
	    outp += strlen(outp);
	    sprintf(outp, ".x%lx.c select to %s %d\n",
		    cvid, x->x_texttag, x->x_selend);
	    outp += strlen(outp);
	    sprintf(outp, ".x%lx.c focus {}\n", cvid);
	}
	else
	{
	    sprintf(outp, ".x%lx.c select clear\n", cvid);
	    outp += strlen(outp);
	    sprintf(outp, ".x%lx.c icursor %s %d\n",
		    cvid, x->x_texttag, x->x_selstart);
	    outp += strlen(outp);
	    sprintf(outp, ".x%lx.c focus %s\n", cvid, x->x_texttag);
	}
	outp += strlen(outp);
    }
    sprintf(outp, "comment_bbox %s .x%lx.c %s\n",
	    x->x_bindsym->s_name, cvid, x->x_texttag);
    x->x_bbpending = 1;
    sys_gui(outbuf);
    if (outbuf != buf) freebytes(outbuf, reqsize);
}
Пример #18
0
void dummies_setup(void)
{
    t_dummy_slot *sl;
    int i, mapsize;
    char **mapping = import_getmapping(&mapsize);
    int ndoomed = 0;
    dummy_nclasses = sizeof(dummy_slots)/sizeof(*dummy_slots);
    /* never freed: */
    dummy_classes = getbytes(dummy_nclasses * sizeof(*dummy_classes));
    for (i = 0, sl = dummy_slots; i < dummy_nclasses; i++, sl++)
    {
	int fd;
	char dirbuf[MAXPDSTRING], *nameptr;
	char *name = port_usemapping(sl->s_name, mapsize, mapping);
	if (name)
	    ndoomed++;
	else if (ndoomed && i < dummy_nclasses - 1)
	{
	    loudbug_bug("dummies_setup");
	    loudbug_post
		("(\"%s\": clashing or doomed dummy not registered for import)",
		 sl->s_name);
	}
	if ((fd = open_via_path("", sl->s_name, ".pd",
				dirbuf, &nameptr, MAXPDSTRING, 0)) >= 0)
	{
	    close(fd);
	    dummy_nreps++;
	}
	else
	{
	    dummy_classes[i] =
		class_new((name ? gensym(name) : gensym(sl->s_name)),
			  sl->s_method ? sl->s_method : (t_newmethod)dummy_new,
			  0, sizeof(t_object),
			  (sl->s_nins ? 0 : CLASS_NOINLET), A_GIMME, 0);
	}
    }
    dummy_nclasses--;  /* use "_dummy" as a sentinel */

    ccdummies_class = class_new(gensym("_cc.dummies"), 0, 0,
				sizeof(t_pd), CLASS_PD | CLASS_NOINLET, 0);
    class_addbang(ccdummies_class, ccdummies_bang);
    pd_bind(pd_new(ccdummies_class), gensym("_cc.dummies"));  /* never freed */
}
Пример #19
0
static void comment_validate(t_comment *x, t_glist *glist)
{
    if (!x->x_ready)
    {
	t_text *t = (t_text *)x;
	binbuf_free(t->te_binbuf);
	t->te_binbuf = x->x_binbuf;
	if (x->x_textbuf) freebytes(x->x_textbuf, x->x_textbufsize);
	binbuf_gettext(x->x_binbuf, &x->x_textbuf, &x->x_textbufsize);
	x->x_ready = 1;
#ifdef COMMENT_DEBUG
	loudbug_post("validation done");
#endif
    }
    if (glist)
    {
	if (glist != x->x_glist)
	{
	    loudbug_bug("comment_getcanvas");
	    x->x_glist = glist;
	}
	x->x_canvas = glist_getcanvas(glist);
    }
}
Пример #20
0
static void riddle_dsp(t_riddle *rd, t_signal **sp)
{
    int failed = 0, unarmed = 1, doreblock = 0;
    int oldgraphsr = rd->rd_graphsr;
    int oldgraphblock = rd->rd_graphblock;
    int inslotno, ninslots = rd->rd_nsiginlets + rd->rd_nremoteslots;
    int outslotno;
    t_rdsource *inslot;
    t_rdsink *outslot;

#ifdef RIDDLE_DEBUG
    riddlebug_post(rd, "\nriddle_dsp", 0);
    for (inslotno = 0, inslot = rd->rd_inslots;
            inslotno < ninslots; inslotno++, inslot++)
        loudbug_post("%d sources: %d reblocks of %d -> %d",
                     inslotno, inslot->so_sourcecount,
                     inslot->so_block, inslot->so_newblock);
#endif

    rd->rd_graphsr = (int)sp[0]->s_sr;
    rd->rd_graphblock = sp[0]->s_n;

    /* this belongs to step 2., but should precede all "muteandreset" gotos */
    if (rd->rd_wasdisabled = rd->rd_disabled)
    {
        rd->rd_disabled = 0;
        if (rd->rd_blockfn)
            doreblock = 1;
        else
        {
            loudbug_bug("riddle_dsp 1");
            goto muteandreset;
        }
    }

    /* step 1: verify all source slots */

    for (inslotno = 0, inslot = rd->rd_inslots;
            inslotno < ninslots; inslotno++, inslot++)
    {
        if (inslot->so_newblock > rd->rd_graphblock)
        {
            if (inslotno < rd->rd_nsiginlets)
            {
                loud_error((t_pd *)rd,
                           "inslot %d: source block too large (%d > %d)",
                           inslotno, inslot->so_newblock, rd->rd_graphblock);
                failed = 1;
            }
        }
        else if (inslot->so_sourcecount <= 0)
        {
            if (inslotno < rd->rd_nsiginlets)
            {
                /* bash unconfirmed declarations to graphblock */
                inslot->so_newpattern = 0;
                inslot->so_newblock = rd->rd_graphblock;
            }
            else if (inslot->so_remote)
            {
                if (rdremote_getwriter(inslot->so_remote))
                {
                    loud_warning((t_pd *)rd, 0, "misplaced buffer reader...");
                    riddle_updatedsp();
                    failed = 1;  /* LATER rethink */
                }
                else
                {
                    loud_warning((t_pd *)rd, 0, "orphaned buffer reader");

                    /* remote slots preserve unconfirmed declarations */
                    inslot->so_newpattern = inslot->so_pattern;
                    if (inslot->so_block > 0)
                        inslot->so_newblock = inslot->so_block;
                    else
                        inslot->so_newblock = rd->rd_graphblock;
                }
            }
            else loudbug_bug("riddle_dsp 2");
        }
        else if (inslot->so_newblock <= 0)  /* should not happen */
        {
            loudbug_bug("riddle_dsp 3");
            failed = 1;
        }
    }
    if (failed)
        goto muteandreset;

    /* step 2: determine outslot sizes/layouts -- blockfn fires on the very
       first call to riddle_dsp(), and then after any change of block or sr,
       and each time the object is disabled... LATER reconsider the pros
       and cons of performing the reblocking during every dsp call */

    /* 2a: was there any change of inslot size/layout or graph block/sr? */
    if (!doreblock && rd->rd_blockfn)
    {
        if (rd->rd_graphsr != oldgraphsr ||
                rd->rd_graphblock != oldgraphblock)
            doreblock = 1;
        else for (inslotno = 0, inslot = rd->rd_inslots;
                      inslotno < ninslots; inslotno++, inslot++)
            {
                if (inslot->so_newpattern != inslot->so_pattern ||
                        inslot->so_newblock != inslot->so_block)
                {
                    doreblock = 1;
                    break;
                }
            }
    }

    /* 2b: update the inslots, reset the outslots */
    if (doreblock || !rd->rd_blockfn)
    {
        for (inslotno = 0, inslot = rd->rd_inslots;
                inslotno < ninslots; inslotno++, inslot++)
        {
            inslot->so_pattern = inslot->so_newpattern;
            inslot->so_block = inslot->so_newblock;
        }
        for (outslotno = 0, outslot = rd->rd_outslots;
                outslotno < rd->rd_nsigoutlets; outslotno++, outslot++)
        {
            outslot->si_pattern = 0;
            outslot->si_block = 0;
            outslot->si_isready = 0;
        }
    }

    /* 2c: call the instance-specific method which redeclares the outslots */
    if (doreblock)
    {
#ifdef RIDDLE_DEBUG
        riddlebug_post(rd, "REBLOCK", 0);
#endif
        rd->rd_blockfn(rd);
        if (rd->rd_disabled)
            goto muteandreset;
    }

    /* 2d: assign defaults to undeclared outslots */
    for (outslotno = 0, outslot = rd->rd_outslots;
            outslotno < rd->rd_nsigoutlets; outslotno++, outslot++)
    {
        if (outslot->si_block < 0)
        {
            loudbug_bug("riddle_dsp 4");
            failed = 1;
        }
        else if (outslot->si_block == 0)
            outslot->si_block = rd->rd_graphblock;
    }
    /* LATER think about not redeclared remote writers */
    if (failed)
        goto muteandreset;

    /* step 3: transfer outslot declarations down to destination objects */

#ifdef RIDDLE_DEBUG
    riddlebug_post(rd, "PUSH", 0);
#endif
    if (riddle_validatesinks(rd))
    {
        for (outslotno = 0, outslot = rd->rd_outslots;
                outslotno < rd->rd_nsigoutlets; outslotno++, outslot++)
            if (outslot->si_isready &&
                    rdsink_push(outslot, (t_object *)rd, outslot->si_outno) == 0)
                failed = 1;
    }
    else failed = 1;
    /* remote declarations are propagated directly from within
       rdremote_setoutblock/layout(), cf. rdremote_pushblock/layout() */
    if (failed)
        goto muteandreset;


    /* step 4: call the wrappee */

    if (rd->rd_dspfn)
    {
        rd->rd_dspfn(rd, sp);
        unarmed = 0;
    }
    else loudbug_bug("riddle_dsp 5");

    /* step 5: mute if disabled, then reset the inslots */

muteandreset:
    if (unarmed)
    {
        rd->rd_disabled = 1;
        riddle_mute(rd, sp);
    }
    for (inslotno = 0, inslot = rd->rd_inslots;
            inslotno < ninslots; inslotno++, inslot++)
    {
        inslot->so_newpattern = 0;
        inslot->so_newblock = 0;
        inslot->so_sourcecount = 0;
    }
}
Пример #21
0
static void matrix_celldebug(t_matrix *x, int indx, int ondx,
			     int onoff, float gain)
{
    loudbug_post("%d %d %g", indx, ondx, gain);
}