Exemplo n.º 1
0
static void *iem_event_new(t_symbol *s, int argc, t_atom *argv)
{
  t_iem_event *x = (t_iem_event *)pd_new(iem_event_class);
  t_int w=32, h=32;
  
  x->x_gui.x_snd = gensym("empty");
  x->x_gui.x_rcv = gensym("empty");
  x->x_gui.x_lab = gensym("empty");
  x->x_gui.x_fsf.x_font_style = 0;
  if((argc >= 6)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)
    &&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3)
    &&(IS_A_SYMBOL(argv,4)||IS_A_FLOAT(argv,4))
    &&(IS_A_SYMBOL(argv,5)||IS_A_FLOAT(argv,5)))
  {
    w = (int)atom_getintarg(0, argc, argv);
    h = (int)atom_getintarg(1, argc, argv);
    iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(2, argc, argv));
    iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(3, argc, argv));
    iemgui_new_getnames(&x->x_gui, 4, argv);
  }
  else if((argc >= 2)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1))
  {
    w = (int)atom_getintarg(0, argc, argv);
    h = (int)atom_getintarg(1, argc, argv);
  }
  x->x_gui.x_draw = (t_iemfunptr)iem_event_draw;
  x->x_gui.x_fsf.x_snd_able = 1;
  x->x_gui.x_fsf.x_rcv_able = 1;
  x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
  if(!strcmp(x->x_gui.x_snd->s_name, "empty"))
    x->x_gui.x_fsf.x_snd_able = 0;
  if(!strcmp(x->x_gui.x_rcv->s_name, "empty"))
    x->x_gui.x_fsf.x_rcv_able = 0;
  if(x->x_gui.x_fsf.x_rcv_able)
    pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
  if(w < 4)
    w = 4;
  x->x_gui.x_w = w;
  if(h < 4)
    h = 4;
  x->x_gui.x_h = h;
  iemgui_verify_snd_ne_rcv(&x->x_gui);
  outlet_new(&x->x_gui.x_obj, &s_list);
  x->x_mouse_shft_alt = gensym("mouse_shft_alt");
  x->x_dragg_x_y = gensym("dragg_x_y");
  x->x_key = gensym("key");
  x->x_move_x_y = gensym("move_x_y");
  x->x_x = 0;
  x->x_y = 0;
  x->x_doit = 0;
  return (x);
}
Exemplo n.º 2
0
static void *iem_image_new(t_symbol *s, int argc, t_atom *argv)
{
    t_iem_image *x = (t_iem_image *)pd_new(iem_image_class);
    t_symbol *gifsym=(t_symbol *)0;
    x->x_gui.x_snd = gensym("empty");
    x->x_gui.x_rcv = gensym("empty");
    x->x_gui.x_lab = gensym("empty");
    x->x_gui.x_fsf.x_font_style = 0;
    if(argc >= 1)
    {
        if(IS_A_SYMBOL(argv,0))
            gifsym = atom_getsymbolarg(0, argc, argv);
        else if(IS_A_FLOAT(argv,0))
            gifsym = (t_symbol *)0;
    }
    else if(argc >= 5)
    {
        if(IS_A_SYMBOL(argv,0))
            gifsym = atom_getsymbolarg(0, argc, argv);
        else if(IS_A_FLOAT(argv,0))
            gifsym = (t_symbol *)0;
        iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(1, argc, argv));
        iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(2, argc, argv));
        iemgui_new_getnames(&x->x_gui, 3, argv);
    }

    x->x_gui.x_draw = (t_iemfunptr)iem_image_draw;
    x->x_gui.x_fsf.x_snd_able = 1;
    x->x_gui.x_fsf.x_rcv_able = 1;
    x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
    if(!strcmp(x->x_gui.x_snd->s_name, "empty"))
        x->x_gui.x_fsf.x_snd_able = 0;
    if(!strcmp(x->x_gui.x_rcv->s_name, "empty"))
        x->x_gui.x_fsf.x_rcv_able = 0;
    if(x->x_gui.x_fsf.x_rcv_able)
        pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
    x->x_gui.x_w = 100;
    x->x_gui.x_h = 60;
    x->x_gifsym = gifsym;
    x->x_have_image=0;
    x->x_gui.x_fsf.x_selected = 0;
    iemgui_verify_snd_ne_rcv(&x->x_gui);
    outlet_new(&x->x_gui.x_obj, &s_list);
    return(x);
}
Exemplo n.º 3
0
static void *iem_vu_new(t_symbol *s, int argc, t_atom *argv)
{
  t_iem_vu *x = (t_iem_vu *)pd_new(iem_vu_class);
  int bflcol[]={-66577, -1, -1};
  int w=IEM_GUI_DEFAULTSIZE;
  int ldx=-1, ldy=-8, f=0, fs=8, scale=1;
  int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
  char str[144];
  
  iem_inttosymargs(&x->x_gui.x_isa, 0);
  iem_inttofstyle(&x->x_gui.x_fsf, 0);
  
  if((argc >= 11)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)
    &&(IS_A_SYMBOL(argv,2)||IS_A_FLOAT(argv,2))
    &&(IS_A_SYMBOL(argv,3)||IS_A_FLOAT(argv,3))
    &&IS_A_FLOAT(argv,4)&&IS_A_FLOAT(argv,5)
    &&IS_A_FLOAT(argv,6)&&IS_A_FLOAT(argv,7)
    &&IS_A_FLOAT(argv,8)&&IS_A_FLOAT(argv,9)&&IS_A_FLOAT(argv,10))
  {
    w = (int)atom_getintarg(0, argc, argv);
    iemgui_new_getnames(&x->x_gui, 1, argv);
    ldx = (int)atom_getintarg(4, argc, argv);
    ldy = (int)atom_getintarg(5, argc, argv);
    iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(6, argc, argv));
    fs = (int)atom_getintarg(7, argc, argv);
    bflcol[0] = (int)atom_getintarg(8, argc, argv);
    bflcol[2] = (int)atom_getintarg(9, argc, argv);
    scale = (int)atom_getintarg(10, argc, argv);
  }
  else iemgui_new_getnames(&x->x_gui, 1, 0);
  if((argc == 12)&&IS_A_FLOAT(argv,11))
    iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(11, argc, argv));
  x->x_gui.x_draw = (t_iemfunptr)iem_vu_draw;
  
  x->x_gui.x_fsf.x_snd_able = 0;
  x->x_gui.x_fsf.x_rcv_able = 1;
  x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
  if (!strcmp(x->x_gui.x_rcv->s_name, "empty"))
    x->x_gui.x_fsf.x_rcv_able = 0;
  if (x->x_gui.x_fsf.x_font_style == 1)
    strcpy(x->x_gui.x_font, "helvetica");
  else if(x->x_gui.x_fsf.x_font_style == 2)
    strcpy(x->x_gui.x_font, "times");
  else { x->x_gui.x_fsf.x_font_style = 0;
  strcpy(x->x_gui.x_font, "courier"); }
  if(x->x_gui.x_fsf.x_rcv_able)
    pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
  x->x_gui.x_ldx = ldx;
  x->x_gui.x_ldy = ldy;
  
  if(fs < 4)
    fs = 4;
  x->x_gui.x_fontsize = fs;
  //  x->x_gui.x_w = iem_vu_clip_width(w)-1;
  x->x_gui.x_w = iem_vu_clip_width(w+1);
  x->x_old_width = x->x_gui.x_w;
  x->x_gui.x_h = 120;
  
  iemgui_all_colfromload(&x->x_gui, bflcol);
  if(scale != 0)
    scale = 1;
  x->x_scale = scale;
  x->x_peak = 0;
  x->x_rms = 0;
  x->x_fp = -101.0;
  x->x_fr = -101.0;
  iemgui_verify_snd_ne_rcv(&x->x_gui);
  inlet_new(&x->x_gui.x_obj, &x->x_gui.x_obj.ob_pd, &s_float, gensym("ft1"));
  x->x_out_rms = outlet_new(&x->x_gui.x_obj, &s_float);
  x->x_out_peak = outlet_new(&x->x_gui.x_obj, &s_float);
  x->x_scale_w = 14;
  x->x_scale_h = 129;
  strcpy(x->x_scale_gif, my_iemgui_black_vscale_gif);
  x->x_gui.x_fsf.x_selected = 0;
  return (x);
}