Beispiel #1
0
static void exciter_save(t_gobj *z, t_binbuf *b)
{
    t_exciter *x = (t_exciter *)z;
    int ei,gi;

    binbuf_addv(b, "ssiisiiifii", gensym("#X"),gensym("obj"),
                (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
                atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
                x->x_width, x->x_height,
                x->x_nbevents, x->x_timegrain,
                x->x_loop, x->x_save
               );
    if ( x->x_save )
    {
        for ( ei=0; ei<x->x_nbevents; ei++ )
        {
            for ( gi=0; gi<(x->x_width/EXCITER_PIXEL_GRAIN); gi++ )
            {
                if( *(x->x_sbangs+ei*(x->x_width/EXCITER_PIXEL_GRAIN)+gi) == 1 )
                {
                    // post( "exciter : saving ( %d, %d )", ei, gi );
                    binbuf_addv(b, "ii", ei, gi );
                }
            }
        }
    }
    binbuf_addv(b, ";");
}
Beispiel #2
0
static void iem_image_save(t_gobj *z, t_binbuf *b)
{
    t_iem_image *x = (t_iem_image *)z;
    int *ip1, *ip2;
    t_symbol *srl[3];

    srl[0] = x->x_gui.x_snd;
    srl[1] = x->x_gui.x_rcv;
    srl[2] = gensym("empty");
    iemgui_all_unique2dollarzero(&x->x_gui, srl);
    iemgui_all_sym2dollararg(&x->x_gui, srl);
    ip1 = (int *)(&x->x_gui.x_isa);
    ip2 = (int *)(&x->x_gui.x_fsf);
    if(x->x_gifsym)
        binbuf_addv(b, "ssiissiiss", gensym("#X"),gensym("obj"),
                    (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
                    atom_getsymbol(binbuf_getvec(x->x_gui.x_obj.te_binbuf)),
                    x->x_gifsym, (*ip1)&IEM_INIT_ARGS_ALL,
                    (*ip2)&IEM_FSTYLE_FLAGS_ALL, srl[0], srl[1]);
    else
        binbuf_addv(b, "ssiisiiiss", gensym("#X"),gensym("obj"),
                    (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
                    atom_getsymbol(binbuf_getvec(x->x_gui.x_obj.te_binbuf)),
                    0, (*ip1)&IEM_INIT_ARGS_ALL,
                    (*ip2)&IEM_FSTYLE_FLAGS_ALL, srl[0], srl[1]);
    binbuf_addv(b, ";");
}
Beispiel #3
0
void hoa_space_preset(t_hoa_space *x, t_binbuf *b)
{
    binbuf_addv(b, "s", gensym("list"));
    for(int i = 0; i < x->f_number_of_microphones; i++)
    {
        binbuf_addv(b, "f", (float)x->f_microphonesValues[i]);
    }
}
Beispiel #4
0
static void tglgrid_save(t_gobj *z, t_binbuf *b) {
  t_tg *tg = (t_tg*)z;
  binbuf_addv(b,"ssiisiisiiss",gensym("#X"),gensym("obj"),
              (t_int)tg->x_obj.te_xpix, (t_int)tg->x_obj.te_ypix,
              tg->name,tg->cols,tg->rows,gensym(tg->toggled),
              tg->cell_size,tg->spacing,
              gensym(tg->tglfill),gensym(tg->untglfill));
  binbuf_addv(b,";");
}
Beispiel #5
0
static void image_save(t_gobj *z, t_binbuf *b)
{
    t_image *x = (t_image *)z;
    binbuf_addv(b, "ssiissi", gensym("#X"), gensym("obj"),
                x->x_obj.te_xpix, x->x_obj.te_ypix,   
                atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
                x->x_fname, x->x_gop_spill);
    binbuf_addv(b, ";");
}
void breakpoints_preset(t_breakpoints *x, t_binbuf *b)
{
    int i;

    binbuf_addv(b, "s", gensym("function"));
    for(i = 0; i < x->f_number_of_points; i++)
    {
        binbuf_addv(b, "ff", (float)x->f_point_abscissa[i], (float)x->f_point_ordinate[i]);
    }
}
Beispiel #7
0
static void scratcher_save(t_gobj *z, t_binbuf *b)
{
    t_scratcher *x = (t_scratcher *)z;

    binbuf_addv(b, "ssiisiiiiff", gensym("#X"),gensym("obj"),
                (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
                atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
                x->x_size, x->x_width, x->x_height,
                x->x_sensibility, x->x_maxspeed, x->x_inertia );
    binbuf_addv(b, ";");
}
Beispiel #8
0
static void sliderh_save(t_gobj *z, t_binbuf *b)
{

    t_fatom *x = (t_fatom *)z;

    binbuf_addv(b, "ssiisiii", gensym("#X"), gensym("obj"),
                x->x_obj.te_xpix, x->x_obj.te_ypix ,  
                atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
                x->x_max,x->x_min,x->x_width);
    binbuf_addv(b, ";");
}
void breakpoints_save(t_breakpoints *x, t_binbuf *d)
{
    int i;
    if(x->f_number_of_points)
    {
        binbuf_addv(d, "s", gensym("@points"));
        for(i = 0; i < x->f_number_of_points; i++)
        {
            binbuf_addv(d, "ff", x->f_point_abscissa[i], x->f_point_ordinate[i]);
        }
    }
}
Beispiel #10
0
void hammerembed_save(t_gobj *master, t_binbuf *bb)
{
    t_hammerfile *f = hammerfile_getproxy((t_pd *)master);
    t_text *t = (t_text *)master;
    binbuf_addv(bb, "ssii", &s__X, gensym("obj"),
    	    	(int)t->te_xpix, (int)t->te_ypix);
    binbuf_addbinbuf(bb, t->te_binbuf);
    binbuf_addsemi(bb);
    if (f && f->f_embedfn)
	(*f->f_embedfn)(f->f_master, bb, ps__C);
    binbuf_addv(bb, "ss;", ps__C, gensym("restore"));
}
Beispiel #11
0
static void funbuff_dowrite(t_funbuff *x, t_symbol *fn)
{
    t_binbuf *bb = binbuf_new();
    char buf[MAXPDSTRING];
    t_hammernode *np;
    binbuf_addv(bb, "s", atom_getsymbol(binbuf_getvec(x->x_ob.te_binbuf)));
    for (np = x->x_tree.t_first; np; np = np->n_next)
        binbuf_addv(bb, "if", np->n_key, HAMMERNODE_GETFLOAT(np));
    canvas_makefilename(x->x_canvas, fn->s_name, buf, MAXPDSTRING);
    binbuf_write(bb, buf, "", 0);
    binbuf_free(bb);
}
Beispiel #12
0
static void scrolllist_save(t_gobj *z, t_binbuf *b)
{
 t_scrolllist *x = (t_scrolllist *)z;

   // post( "saving scrolllist : %d", x->x_capacity );
   binbuf_addv(b, "ssiisiiissss", gensym("#X"), gensym("obj"),
		(t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
		atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
        x->x_capacity, x->x_width, x->x_height,
                gensym(x->x_font), gensym(x->x_bgcolor), 
                gensym(x->x_fgcolor), gensym(x->x_secolor) );
   binbuf_addv(b, ";");
}
Beispiel #13
0
static void preset_save(t_presetobj *x, t_binbuf *d)
{
    binbuf_addv(d, (char *)"ss", cream_sym_atpreset, cream_sym_left_bracket);
    for(int i = 0; i < CREAM_MAXITEMS; i++)
    {
        if(binbuf_getnatom(x->f_binbuf[i]))
        {
            binbuf_addv(d, (char *)"sf", cream_sym_atindex, (float)i);
            binbuf_addbinbuf(d, x->f_binbuf[i]);
        }
    }
    binbuf_addv(d, (char *)"s", cream_sym_right_bracket);
}
Beispiel #14
0
static int imaction_P6_patcher(t_port *x, char *arg)
{
    if (x->x_withbogus)
	binbuf_addv(x->x_outbb, "ss;", portps_cleanup, portps_cleanup);
    binbuf_addv(x->x_outbb, "ssffss;",
		gensym("#X"), gensym("restore"),
		port_getx(x, 2), port_gety(x, 3),
		gensym("pd"), port_getsymbol(x, 7));
    if (x->x_stackdepth)  /* LATER consider returning PORT_FATAL otherwise */
	x->x_stackdepth--;
    x->x_nobj = x->x_stack[x->x_stackdepth];
    x->x_nobj++;
    return (PORT_NEXT);
}
Beispiel #15
0
static void grid_save(t_gobj *z, t_binbuf *b)
{
    t_grid *x = (t_grid *)z;

    // post( "saving grid : %s", x->x_name->s_name );
    binbuf_addv(b, "ssiissiffiffiffiiff", gensym("#X"),gensym("obj"),
                (t_int)x->x_obj.te_xpix, (t_int)x->x_obj.te_ypix,
                atom_getsymbol(binbuf_getvec(x->x_obj.te_binbuf)),
                x->x_name, x->x_width, x->x_min,
                x->x_max, x->x_height,
                x->y_min, x->y_max,
                x->x_grid, x->x_xstep,
                x->x_ystep, x->x_xlines, x->x_ylines,
                x->x_current, x->y_current );
    binbuf_addv(b, ";");
}
Beispiel #16
0
static int imaction_N1_vpatcher(t_port *x, char *arg)
{
    if (x->x_stackdepth >= x->x_stacksize)
    {
	int rqsz = x->x_stackdepth + 1;
	int sz = rqsz;
	x->x_stack = grow_withdata(&rqsz, &x->x_stackdepth,
				   &x->x_stacksize, x->x_stack,
				   PORT_INISTACK, x->x_stackini,
				   sizeof(*x->x_stack));
	if (rqsz != sz)
	{
	    post("too many embedded patches");
	    return (PORT_FATAL);
	}
    }
    x->x_stack[x->x_stackdepth++] = x->x_nobj;
    x->x_nobj = 0;
    binbuf_addv(x->x_outbb, "ssfffff;",
		gensym("#N"), gensym("canvas"),
		port_getx(x, 2), port_gety(x, 3),
		(float)port_xstretch(port_getint(x, 4) - port_getint(x, 2)),
		(float)port_ystretch(port_getint(x, 5) - port_getint(x, 3)),
		PORT_DEFFONTSIZE);
    return (PORT_NEXT);
}
Beispiel #17
0
static void prob_embedhook(t_pd *z, t_binbuf *bb, t_symbol *bindsym)
{
    t_prob *x = (t_prob *)z;
    if (x->x_embedmode)
    {
	t_probtrans *pfx, *sfx;
	for (pfx = x->x_translist; pfx; pfx = pfx->tr_nextstate)
	    for (sfx = pfx->tr_nexttrans; sfx; sfx = sfx->tr_nexttrans)
		binbuf_addv(bb, "siii;", bindsym, 
			    pfx->tr_value, sfx->tr_value, sfx->tr_count);
	binbuf_addv(bb, "ssi;", bindsym, gensym("embed"), 1);
	if (x->x_default)
	    binbuf_addv(bb, "ssi;", bindsym, gensym("reset"),
			x->x_default->tr_value);
    }
}
Beispiel #18
0
static void funbuff_embedhook(t_pd *z, t_binbuf *bb, t_symbol *bindsym)
{
    t_funbuff *x = (t_funbuff *)z;
    if (x->x_embedflag)
    {
        t_hammernode *np;
        binbuf_addv(bb, "ssi;", bindsym, gensym("embed"), 1);
        if (np = x->x_tree.t_first)
        {
            binbuf_addv(bb, "ss", bindsym, gensym("set"));
            for (; np; np = np->n_next)
                binbuf_addv(bb, "if", np->n_key, HAMMERNODE_GETFLOAT(np));
            binbuf_addsemi(bb);
        }
    }
}
Beispiel #19
0
static void iem_vu_save(t_gobj *z, t_binbuf *b)
{
  t_iem_vu *x = (t_iem_vu *)z;
  int bflcol[3];
  t_symbol *srl[3];
  
  iemgui_save(&x->x_gui, srl, bflcol);
  binbuf_addv(b, "ssiisiissiiiiiiii", gensym("#X"),gensym("obj"),
    (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
    atom_getsymbol(binbuf_getvec(x->x_gui.x_obj.te_binbuf)),
    /*x->x_gui.x_w+1*/ x->x_gui.x_w, 120,
    srl[1], srl[2],
    x->x_gui.x_ldx, x->x_gui.x_ldy,
    iem_fstyletoint(&x->x_gui.x_fsf), x->x_gui.x_fontsize,
    bflcol[0], bflcol[2], x->x_scale, iem_symargstoint(&x->x_gui.x_isa));
  binbuf_addv(b, ";");
}
Beispiel #20
0
static void odisplay_save(t_gobj *z, t_binbuf *b)
{
    t_odisplay *x = (t_odisplay *)z;
    t_opd_textbox *t = x->textbox;
    
    binbuf_addv(b, "ssiisii", gensym("#X"),gensym("obj"),(t_int)x->ob.te_xpix, (t_int)x->ob.te_ypix, gensym("o.display"), t->width, t->height);
    binbuf_addsemi(b);
}
Beispiel #21
0
static int imaction_P6_prob(t_port *x, char *arg)
{
    binbuf_addv(x->x_outbb, "ssffs;",
		gensym("#X"), gensym("obj"),
		port_getx(x, 2), port_gety(x, 3), portps_prob);
    import_emflush(x, portps_prob, &s_);
    x->x_nobj++;
    return (PORT_NEXT);
}
Beispiel #22
0
static void iem_event_save(t_gobj *z, t_binbuf *b)
{
  t_iem_event *x = (t_iem_event *)z;
  t_symbol *srl[3];
  
  srl[0] = x->x_gui.x_snd;
  srl[1] = x->x_gui.x_rcv;
  srl[2] = gensym("empty");
  iemgui_all_sym2dollararg(&x->x_gui, srl);
  
  binbuf_addv(b, "ssiisiiiiss", gensym("#X"),gensym("obj"),
    (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
    atom_getsymbol(binbuf_getvec(x->x_gui.x_obj.te_binbuf)),
    x->x_gui.x_w, x->x_gui.x_h,
    iem_symargstoint(&x->x_gui.x_isa), iem_fstyletoint(&x->x_gui.x_fsf),
    srl[0], srl[1]);
  binbuf_addv(b, ";");
}
Beispiel #23
0
static void iem_vu_save(t_gobj *z, t_binbuf *b)
{
  t_iem_vu *x = (t_iem_vu *)z;
  int bflcol[3], *ip1, *ip2;
  t_symbol *srl[3];
  
  iemgui_save(&x->x_gui, srl, bflcol);
  ip1 = (int *)(&x->x_gui.x_isa);
  ip2 = (int *)(&x->x_gui.x_fsf);
  binbuf_addv(b, "ssiisiissiiiiiiii", gensym("#X"),gensym("obj"),
    (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
    atom_getsymbol(binbuf_getvec(x->x_gui.x_obj.te_binbuf)),
    /*x->x_gui.x_w+1*/ x->x_gui.x_w, 120,
    srl[1], srl[2],
    x->x_gui.x_ldx, x->x_gui.x_ldy,
    (*ip2)&IEM_FSTYLE_FLAGS_ALL, x->x_gui.x_fontsize,
    bflcol[0], bflcol[2], x->x_scale, (*ip1)&IEM_INIT_ARGS_ALL);
  binbuf_addv(b, ";");
}
Beispiel #24
0
void eobj_dosave(t_eobj* x, t_binbuf *b)
{
    t_binbuf* d;
    t_eclass* c = eobj_getclass(x);
    if(c && b)
    {
        binbuf_addv(b, (char *)"ssii", &s__X, s_obj, (t_int)x->o_obj.te_xpix, (t_int)x->o_obj.te_ypix);
        d = x->o_obj.te_binbuf;
        if(d)
        {
            binbuf_addbinbuf(b, d);
        }
        if(c->c_widget.w_save != NULL)
        {
            c->c_widget.w_save(x, b);
        }
        binbuf_addv(b, (char *)";");
    }
}
Beispiel #25
0
void radio_preset(t_radio *x, t_binbuf *b)
{
    int i;
    
    if(x->f_mode)
    {
        binbuf_addv(b, "s", gensym("list"));
        for(i = 0; i < x->f_nitems; i++)
            binbuf_addv(b, "f", (float)x->f_items[i]);

    }
    else
    {
        for(i = 0; i < x->f_nitems; i++)
        {
            if(x->f_items[i])
                binbuf_addv(b, "sf", gensym("float"), (float)i);
        }
    }
}
Beispiel #26
0
t_pd_err binbuf_append_attribute(t_binbuf *d, t_symbol *key, int argc, t_atom *argv)
{
    if(d && key && argc && argv)
    {
        format_atoms(argc, argv);
        binbuf_addv(d, "s", key);
        binbuf_add(d, argc, argv);
        return 0;
    }
    return -1;
}
Beispiel #27
0
static void hfadl_scale_save(t_gobj *z, t_binbuf *b)
{
  t_hfadl_scale *x = (t_hfadl_scale *)z;
  
  binbuf_addv(b, "ssiisi", gensym("#X"),gensym("obj"),
    (t_int)x->x_gui.x_obj.te_xpix, (t_int)x->x_gui.x_obj.te_ypix,
    atom_getsymbol(binbuf_getvec(x->x_gui.x_obj.te_binbuf)),
    -1 - (((0xfc0000 & x->x_gui.x_lcol) >> 6)|
    ((0xfc00 & x->x_gui.x_lcol) >> 4)|((0xfc & x->x_gui.x_lcol) >> 2)));
  binbuf_addv(b, ";");
}
Beispiel #28
0
static int import_obj(t_port *x, char *name)
{
    int ndx = (x->x_inmess[1].a_w.w_symbol == gensym("user") ? 3 : 2);
    binbuf_addv(x->x_outbb, "ssff",
		gensym("#X"), gensym("obj"),
		port_getx(x, ndx), port_gety(x, ndx + 1));
    import_addclassname(x, name, &x->x_inmess[ndx == 2 ? 6 : 2]);
    binbuf_addsemi(x->x_outbb);
    x->x_nobj++;
    return (PORT_NEXT);
}
Beispiel #29
0
void array_define_save(t_gobj *z, t_binbuf *bb)
{
    t_glist *x = (t_glist *)z;
    t_glist *gl = (x->gl_list ? pd_checkglist(&x->gl_list->g_pd) : 0);
    binbuf_addv(bb, "ssff", &s__X, gensym("obj"),
        (float)x->gl_obj.te_xpix, (float)x->gl_obj.te_ypix);
    binbuf_addbinbuf(bb, x->gl_obj.ob_binbuf);
    binbuf_addsemi(bb);

    garray_savecontentsto((t_garray *)gl->gl_list, bb);
    obj_saveformat(&x->gl_obj, bb);
}
Beispiel #30
0
static void import_emflush(t_port *x, t_symbol *state, t_symbol *name)
{
    int ac = binbuf_getnatom(x->x_embb);
    if (import_emcheckend(x, state, name) && ac)
	binbuf_add(x->x_outbb, ac, binbuf_getvec(x->x_embb));
    x->x_emstate = 0;
    x->x_emname = 0;
    x->x_emsize = 0;
    x->x_emcount = 0;
    if (ac) binbuf_clear(x->x_embb);
    binbuf_addv(x->x_outbb, "ss;", gensym("#C"), gensym("restore"));
}