Exemplo n.º 1
0
void pyo_tilde_create(t_pyo_tilde *x, t_symbol *s, int argc, t_atom *argv) {
    int err;
    char *varname, *object;
    char fchar[32];
    t_symbol *c = atom_getsymbol(argv);
    varname = c->s_name;
    argc--; argv++;
    c = atom_getsymbol(argv);
    object = c->s_name;
    argc--; argv++;
    sprintf(x->msg, "%s=%s(", varname, object);
    while (argc-- > 0) {
        if (argv->a_type == A_SYMBOL) {
            strcat(x->msg, atom_getsymbol(argv)->s_name);
        }
        else if (argv->a_type == A_FLOAT) {
            sprintf(fchar, "%f", atom_getfloat(argv));
            strcat(x->msg, fchar);
        }
        if (argc > 0)
            strcat(x->msg, ",");
        argv++;
    }
    strcat(x->msg, ")");
    err = pyo_exec_statement(x->interp, x->msg, x->debug);
    if (err)
        post("pyo~: %s", x->msg);
}
Exemplo n.º 2
0
int setSDES(rtcp_sdes_item_t*item, int argc, t_atom*argv) {
  t_symbol*s;
  rtcp_type_t typ=0;
  free(item->data);
  item->data=NULL;
  item->length=0;
  item->type  =0;
  if(argc<1)return 1; // deleted entry

  s=atom_getsymbol(argv);
  if(0) {}
  else if(SELECTOR_RTCP_SDES_END   == s) typ=RTCP_SDES_END;
  else if(SELECTOR_RTCP_SDES_CNAME == s) typ=RTCP_SDES_CNAME;
  else if(SELECTOR_RTCP_SDES_NAME  == s) typ=RTCP_SDES_NAME;
  else if(SELECTOR_RTCP_SDES_EMAIL == s) typ=RTCP_SDES_EMAIL;
  else if(SELECTOR_RTCP_SDES_PHONE == s) typ=RTCP_SDES_PHONE;
  else if(SELECTOR_RTCP_SDES_LOC   == s) typ=RTCP_SDES_LOC;
  else if(SELECTOR_RTCP_SDES_TOOL  == s) typ=RTCP_SDES_TOOL;
  else if(SELECTOR_RTCP_SDES_NOTE  == s) typ=RTCP_SDES_NOTE;
  else if(SELECTOR_RTCP_SDES_PRIV  == s) typ=RTCP_SDES_PRIV;
  if(0==typ)return 0;

  item->type = typ;
  if(argc>1) {
    s=atom_getsymbol(argv+1);
    item->data=strndup(s->s_name, 255);
    item->length=strlen(item->data);
  }
  return 1;
}
Exemplo n.º 3
0
static void *newMTXCumsum (t_symbol *s, int argc, t_atom *argv)
{
  MTXCumsum *mtx_cumsum_obj = (MTXCumsum *) pd_new (mtx_cumsum_class);
  mTXSetCumsumMode (mtx_cumsum_obj, gensym(":"));
  mTXSetCumsumDirection (mtx_cumsum_obj, 1.0f);
  if (argc>=1) {
    if (argv[0].a_type == A_SYMBOL) {
      mTXSetCumsumMode (mtx_cumsum_obj, atom_getsymbol (argv));
      if (argc>=2) {
        if (argv[1].a_type != A_SYMBOL) {
          mTXSetCumsumDirection (mtx_cumsum_obj, atom_getfloat (argv+1));
        } else {
          pd_error(mtx_cumsum_obj, "[mtx_cumsum]: 2nd arg ignored. supposed to be float");
        }
      }
    } else {
      mTXSetCumsumDirection (mtx_cumsum_obj, atom_getfloat (argv));
      if (argc>=2) {
        if (argv[1].a_type == A_SYMBOL) {
          mTXSetCumsumMode (mtx_cumsum_obj, atom_getsymbol (argv+1));
        } else {
          pd_error(mtx_cumsum_obj, "[mtx_cumsum]: 2nd arg ignored. supposed to be symbolic, e.g. \"row\", \"col\", \":\"");
        }
      }
    }
  }

  mtx_cumsum_obj->list_outlet = outlet_new (&mtx_cumsum_obj->x_obj,
                                gensym("matrix"));
  return ((void *) mtx_cumsum_obj);
}
Exemplo n.º 4
0
void pyo_tilde_set_value(t_pyo_tilde *x, char *att, int argc, t_atom *argv) {
    int err, bracket = 0;
    char fchar[32];
    t_symbol *c = atom_getsymbol(argv);
    argc--; argv++;
    sprintf(x->msg, "%s%s=", c->s_name, att);
    if (argc > 1) {
        strcat(x->msg, "[");
        bracket = 1;    
    }
    while (argc-- > 0) {
        if (argv->a_type == A_SYMBOL) {
            strcat(x->msg, atom_getsymbol(argv)->s_name);
        }
        else if (argv->a_type == A_FLOAT) {
            sprintf(fchar, "%.6f", atom_getfloat(argv));
            strcat(x->msg, fchar);
        }
        if (argc > 0)
            strcat(x->msg, ",");
        argv++;
    }
    if (bracket)
        strcat(x->msg, "]");
    err = pyo_exec_statement(x->interp, x->msg, x->debug);
    if (err)
        post("pyo~: %s", x->msg);
}
Exemplo n.º 5
0
static void sarray_set(t_sarray *x, t_symbol *sfoo,int argc, t_atom *argv)
{
    int i,j=0;
    t_symbol *snull=&s_,*s;

    /*if((argc<2)||(argv[0].a_type!=A_FLOAT))
    {
    	error("Bad arguments for message 'set' to object 'sarray'");
    	return ;
    }*/
    if(argv[0].a_type==A_SYMBOL)
    {
        snull=atom_getsymbol(&argv[0]);
        j=1;
    }

    if(argv[j].a_type!=A_FLOAT)
    {
        error("Bad arguments for message 'set' to object 'sarray'");
        return ;
    }

    i=atom_getfloat(&argv[j++]);

    while((j<argc)&&(argv[j].a_type==A_SYMBOL))
    {
        s=atom_getsymbol(&argv[j++]);
        if(s==snull) s=&s_;
        scommon_set(x->x_c,i++,s);
    }
}
Exemplo n.º 6
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, ";");
}
Exemplo n.º 7
0
void eobj_write(t_eobj* x, t_symbol* s, int argc, t_atom *argv)
{
    char buf[MAXPDSTRING];
    char* pch;
    t_atom av[1];
    t_eclass* c = eobj_getclass(x);

    // The file name is defined
    if(argc && argv && atom_gettype(argv) == A_SYMBOL)
    {
        pch = strpbrk(atom_getsymbol(argv)->s_name, "/\"");
        // The folder seems defined
        if(pch != NULL)
        {
            atom_setsym(av, atom_getsymbol(argv));
            if(c->c_widget.w_write)
                c->c_widget.w_write(x, s, 1, av);
            return;
        }
        // The folder isn't defined so write it in the canvas folder
        else
        {
            sprintf(buf, "%s/%s", canvas_getdir(x->o_canvas)->s_name, atom_getsymbol(argv)->s_name);
            atom_setsym(av, gensym(buf));
            if(c->c_widget.w_write)
                c->c_widget.w_write(x, s, 1, av);
            return;
        }
    }
    // The file name is not defined so we popup a window
    else
    {
        sys_vgui("eobj_saveas %s nothing nothing\n", x->o_id->s_name);
    }
}
Exemplo n.º 8
0
void handle_osc_configure(ph *x, t_atom *argv, int i)
{
    const char *key;
    const char *value;
    char *message;

    key   = atom_getsymbol(&argv[0])->s_name;
    value = atom_getsymbol(&argv[1])->s_name;

    ph_debug_post("%s()", __FUNCTION__);

    if (!x->descriptor->configure) {
        return;
    } 

    if (!strncmp(key, DSSI_RESERVED_CONFIGURE_PREFIX,
                strlen(DSSI_RESERVED_CONFIGURE_PREFIX))) {
        pd_error(x,"UI for plugin '' attempted to use reserved "
                "configure key \"%s\", ignoring", key);
        return;
    }

    message = x->descriptor->configure(x->instance_handles[i], key, value);

    if (message) {
        pd_error(x, "on configure '%s', plugin '' returned error '%s'",
                key, message);
        free(message);
    }

    ph_query_programs(x, i);

}
Exemplo n.º 9
0
static void iem_append_kernel_out(t_iem_append_kernel *x)
{
  int off=0;
  
  if(x->x_type1 == A_GIMME)
  {
    if(x->x_type2 == A_COMMA)
      off = 1;
    else
      off = 0;
    iem_append_kernel_merge(x, off);
    outlet_list(x->x_obj.ob_outlet, &s_list, x->x_ac1+x->x_ac2+off, x->x_at12);
  }
  else if(x->x_type1 == A_COMMA)
  {
    if(x->x_type2 == A_COMMA)
      off = 1;
    else
      off = 0;
    iem_append_kernel_merge(x, off);
    outlet_anything(x->x_obj.ob_outlet, x->x_sym1, x->x_ac1+x->x_ac2+off, x->x_at12);
  }
  else if(x->x_type1 == A_NULL)/*depends on 2.part*/
  {
    iem_append_kernel_merge(x, 0);
    if(x->x_type2 == A_GIMME)
      outlet_list(x->x_obj.ob_outlet, &s_list, x->x_ac2, x->x_at12);
    else if(x->x_type2 == A_COMMA)
      outlet_anything(x->x_obj.ob_outlet, x->x_sym2, x->x_ac2, x->x_at12);
    else if(x->x_type2 == A_FLOAT)
      outlet_float(x->x_obj.ob_outlet, atom_getfloat(x->x_at12));
    else if(x->x_type2 == A_SYMBOL)
      outlet_symbol(x->x_obj.ob_outlet, atom_getsymbol(x->x_at12));
    else if(x->x_type2 == A_NULL)
      outlet_bang(x->x_obj.ob_outlet);
    else if(x->x_type2 == A_POINTER)
      outlet_pointer(x->x_obj.ob_outlet, (t_gpointer *)x->x_at12->a_w.w_gpointer);
  }
  else
  {
    if(x->x_type2 == A_COMMA)
      off = 1;
    else
      off = 0;
    iem_append_kernel_merge(x, off);
    if(x->x_type2 == A_NULL)
    {
      if(x->x_type1 == A_FLOAT)
        outlet_float(x->x_obj.ob_outlet, atom_getfloat(x->x_at12));
      else if(x->x_type1 == A_SYMBOL)
        outlet_symbol(x->x_obj.ob_outlet, atom_getsymbol(x->x_at12));
      else if(x->x_type1 == A_POINTER)
        outlet_pointer(x->x_obj.ob_outlet, (t_gpointer *)x->x_at12->a_w.w_gpointer);
    }
    else
      outlet_list(x->x_obj.ob_outlet, &s_list, x->x_ac1+x->x_ac2+off, x->x_at12);
  }
}
Exemplo n.º 10
0
static void blackboard_image(t_blackboard *x, t_symbol *s, int argc, t_atom *argv)
{
	int fd;
    char path[MAXPDSTRING];
	char name[MAXPDSTRING];
	char *nameptr;
    
    if(x->f_ninstructions >= _blackboard::maxcmd)
    {
        pd_error(x, "%s too many drawing commands.", eobj_getclassname(x)->s_name);
        return;
    }

    if(argc > 2 && argv)
    {
        if(atom_gettype(argv) == A_FLOAT && atom_gettype(argv+1) == A_FLOAT && atom_gettype(argv+2) == A_SYMBOL)
        {
            sprintf(path, "%s",atom_getsymbol(argv+2)->s_name);
            if(access(path, O_RDONLY) != -1)
            {
                sprintf(x->f_instructions[x->f_ninstructions], "create image %d %d -anchor nw -image [image create photo -file %s]", (int)atom_getfloat(argv), (int)atom_getfloat(argv+1), path);
                
                x->f_ninstructions++;
                ebox_redraw((t_ebox *)x);
                return;
            }
            sprintf(path, "%s/%s", canvas_getdir(x->j_box.b_obj.o_canvas)->s_name, atom_getsymbol(argv+2)->s_name);
            if(access(path, O_RDONLY) != -1)
            {
                sprintf(x->f_instructions[x->f_ninstructions], "create image %d %d -anchor nw -image [image create photo -file %s]", (int)atom_getfloat(argv), (int)atom_getfloat(argv+1), path);
                
                x->f_ninstructions++;
                ebox_redraw((t_ebox *)x);
                return;
            }
			sprintf(name, "%s", atom_getsymbol(argv+2)->s_name);
			if(!strncmp(name+strlen(name)-4, ".gif", 4))
			{
				strncpy(name+strlen(name)-4, "\0", 4);
			}

			fd = open_via_path(canvas_getdir(x->j_box.b_obj.o_canvas)->s_name, name,  ".gif", path, &nameptr, MAXPDSTRING, 0);
            if(fd >= 0)
			{
                sprintf(x->f_instructions[x->f_ninstructions], "create image %d %d -anchor nw -image [image create photo -file %s/%s.gif]", (int)atom_getfloat(argv), (int)atom_getfloat(argv+1), path, name);
                
                x->f_ninstructions++;
                ebox_redraw((t_ebox *)x);
				return;
			}
        }
    }
    
}
Exemplo n.º 11
0
static void rawprint_any(t_rawprint *x, t_symbol*s, int argc, t_atom*argv)
{
  char buf[MAXPDSTRING];
  if(x->label) {
    startpost("%s: ", x->label->s_name);
  }
  startpost("\"%s\"", s->s_name);
  while(argc--) {
    switch(argv->a_type) {
    case A_FLOAT:
      snprintf(buf, MAXPDSTRING-1, "%f", atom_getfloat(argv));
      break;
    case A_SYMBOL:
      snprintf(buf, MAXPDSTRING-1, "'%s'", atom_getsymbol(argv)->s_name);
      break;
    case A_POINTER:
      snprintf(buf, MAXPDSTRING-1, "pointer[%p]", argv->a_w.w_gpointer);
      break;
    case A_SEMI:
      snprintf(buf, MAXPDSTRING-1, "SEMI");
      break;
    case A_COMMA:
      snprintf(buf, MAXPDSTRING-1, "COMMA");
      break;
    case A_DEFFLOAT:
      snprintf(buf, MAXPDSTRING-1, "DEFFLOAT[%f]", atom_getfloat(argv));
      break;
    case A_DEFSYM:
      snprintf(buf, MAXPDSTRING-1, "DEFSYM['%s']", atom_getsymbol(argv)->s_name);
      break;
    case A_DOLLAR:
      snprintf(buf, MAXPDSTRING-1, "DOLLAR['%s']", atom_getsymbol(argv)->s_name);
      break;
    case A_DOLLSYM:
      snprintf(buf, MAXPDSTRING-1, "DOLLSYM['%s']", atom_getsymbol(argv)->s_name);
      break;
    case A_GIMME:
      snprintf(buf, MAXPDSTRING-1, "GIMME");
      break;
    case A_CANT: // we _really_ cannot do CANT
      snprintf(buf, MAXPDSTRING-1, "CANT");
      break;
    default:
      snprintf(buf, MAXPDSTRING-1, "unknown[%d]", argv->a_type);
    }
    buf[MAXPDSTRING-1]=0;
    
    startpost(" %s", buf);
    argv++;
  }
  endpost();

}
Exemplo n.º 12
0
void pix_filmOS :: openMessCallback(void *data, t_symbol*, int argc, t_atom*argv)
{
	int format=0;
	switch(argc){
	case 2:
		format=getPixFormat(atom_getsymbol(argv+1)->s_name);
	case 1:
	    GetMyClass(data)->openMess(atom_getsymbol(argv), format);
		break;
	default:
	  GetMyClass(data)->error("open <filename> [<format>]");
	}
}
Exemplo n.º 13
0
static void str_compare_any(t_str_compare * x, t_symbol *s, int argc, t_atom *argv)
{
    t_symbol * s1;
    
    if(argc > 0)
        s1 = atom_getsymbol(&argv[0]);
    else
        return;

    if(argc > 1)
        x->s2 = atom_getsymbol(&argv[0]);
   
    str_compare_symbol(x, s1);
}
Exemplo n.º 14
0
/////////////////////////////////////////////////////////
//
// gemhead
//
/////////////////////////////////////////////////////////
// Constructor
//
/////////////////////////////////////////////////////////
gemhead :: gemhead(int argc, t_atom*argv) :
  gemreceive(gensym("__gem_render")),
  m_cache(new GemCache(this)), m_renderOn(1)
{
  if(m_fltin) {
    inlet_free(m_fltin);
  }
  m_fltin=NULL;

  m_basename=m_name->s_name;
  float priority=50.;
#if 1
  switch(argc) {
  case 2:
    if(argv[0].a_type == A_FLOAT && argv[1].a_type == A_SYMBOL) {
      priority=atom_getfloat(argv+0);
      m_basename+=atom_getsymbol(argv+1)->s_name;
    } else if(argv[1].a_type == A_FLOAT && argv[0].a_type == A_SYMBOL) {
      priority=atom_getfloat(argv+1);
      m_basename+=atom_getsymbol(argv+0)->s_name;
    } else if(argv[1].a_type == A_FLOAT && argv[0].a_type == A_FLOAT) {
      priority=atom_getfloat(argv+0);
      m_basename+=::float2str(atom_getfloat  (argv+1));
    }
    break;
  case 1:
    if(argv[0].a_type == A_FLOAT) {
      priority=atom_getfloat(argv+0);
    } else if(argv[0].a_type == A_SYMBOL) {
      m_basename+=atom_getsymbol(argv+0)->s_name;
    }
    break;
  case 0:
    priority=50.f;
    break;
  default:
    throw(GemException("invalid arguments: 'gemhead [<priority> [<basereceivename>]]'"));
  }
#else
  if(argc==0) {
    priority=50.;
  } else if(argv[0].a_type == A_FLOAT) {
    priority=atom_getfloat(argv);
  } else {
    throw(GemException("invalid arguments: 'gemhead [<priority>]'"));
  }
#endif
  m_priority=priority+1;
  setMess(priority);
}
Exemplo n.º 15
0
void pix_freeframe :: parmMess(std::string key, t_atom *value){
  if(!m_plugin) {
    error("no instance of plugin available");
    return;
  }
  if(key.empty()) {
    error("unknown key '%s'", key.c_str());
    return;
  }
  gem::Properties props;
  gem::any v;
  if(value) {
    switch(value->a_type) {
    case(A_FLOAT):
      v=atom_getfloat(value);
      break;
    case (A_SYMBOL):
      v=atom_getsymbol(value)->s_name;
      break;
    default:
      return;
    }
  }
  props.set(key, v);
  m_plugin->setParameters(props);
  setModified();
}
Exemplo n.º 16
0
static void trigger2_list(t_trigger2 *x, t_symbol *s, int argc, t_atom *argv){
    t_trigger2out *u;
    int i;
    for(i = x->x_n, u = x->x_vec + i; u--, i--;){
        if (u->u_type == TR_FLOAT)
            outlet_float(u->u_outlet, (argc ? atom_getfloat(argv) : 0));
        else if (u->u_type == TR_BANG)
            outlet_bang(u->u_outlet);
        else if (u->u_type == TR_SYMBOL)
            outlet_symbol(u->u_outlet,
                          (argc ? atom_getsymbol(argv) : (s != NULL ? s : &s_symbol)));
        else if (u->u_type == TR_ANYTHING)
            outlet_anything(u->u_outlet, s, argc, argv);
        else if (u->u_type == TR_POINTER){
            if (!argc || argv->a_type != TR_POINTER)
                pd_error(x, "unpack: bad pointer");
            else outlet_pointer(u->u_outlet, argv->a_w.w_gpointer);
        }
        else if (u->u_type == TR_STATIC_FLOAT)
            outlet_float(u->u_outlet, u->u_float);
        else if (u->u_type == TR_STATIC_SYMBOL)
            outlet_symbol(u->u_outlet, u->u_sym);
        else outlet_list(u->u_outlet, &s_list, argc, argv);
    }
}
Exemplo n.º 17
0
static void *urn_new(t_symbol *s, int argc, t_atom *argv)
{
  t_urn *x = (t_urn *)pd_new(urn_class);
  t_float f=0.;
  ZEXY_USEVAR(s);

  inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym(""));
  x->x_floatout=outlet_new(&x->x_obj, gensym("float"));
  x->x_bangout =outlet_new(&x->x_obj, gensym("bang"));

  x->x_seed = makeseed();
  x->x_noauto = 0;

  while(argc--){
    if (argv->a_type==A_SYMBOL) {
      if (atom_getsymbol(argv)==gensym("no_auto")) {
	x->x_noauto=1;
      }
    } else f = atom_getfloat(argv);
    argv++;
  }

  if (f<1.0)f=1.0;
  makestate(x, f);
  x->x_range = f;
  urn_clear(x);

  return (x);
}
Exemplo n.º 18
0
static void *matchbox_new(t_symbol *s, int argc, t_atom*argv)
{
  t_matchbox *x = (t_matchbox *)pd_new(matchbox_class);

  inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("symbol"), gensym("add"));

  x->x_outResult    =outlet_new(&x->x_obj, gensym("list"));
  x->x_outNumResults=outlet_new(&x->x_obj, gensym("float"));


  x->x_lists=(t_listlist*)getbytes(sizeof(t_listlist));
  x->x_lists->next=0;
  x->x_lists->argc=0;
  x->x_lists->argv=0;
  x->x_numlists=0;

  x->x_mode = MATCHBOX_EXACT;

  if(argc && argv->a_type==A_SYMBOL) {
    matchbox_mode(x, atom_getsymbol(argv));
  }


  return (x);
}
Exemplo n.º 19
0
Arquivo: deque.c Projeto: Angeldude/pd
/*--------------------------------------------------------------------
 * outlet_cur
 *  + outlets current element to outlet-1, if non-NULL
 *  + otherwise, bangs to outlet-2
 */
static void pd_deque_outlet_cur(t_pd_deque *x)
{
  if (x->x_cur) {
    --x->x_size;
    if (x->x_cur->argc == 1) {
      switch (x->x_cur->argv->a_type) {
      case A_FLOAT:
	outlet_float(x->elt_out, x->x_cur->argv->a_w.w_float);
	return;
      case A_SYMBOL:
	outlet_symbol(x->elt_out, x->x_cur->argv->a_w.w_symbol);
	return;
      case A_POINTER:
	outlet_pointer(x->elt_out, x->x_cur->argv->a_w.w_gpointer);
	return;
      default:
	error("Error: deque: unrecognized atom type '%d' defaults to 'bang'.",
	      x->x_cur->argv->a_type);
	outlet_bang(x->elt_out);
      }
    } else {
      outlet_anything(x->elt_out,
		      atom_getsymbol(x->x_cur->argv),
		      x->x_cur->argc-1,
		      x->x_cur->argv+1
		      );
    }
  } else {
    outlet_bang(x->eoq_out);
  }
}
Exemplo n.º 20
0
  static void addProperties(gem::Properties&props, int argc, t_atom*argv)
  {
    if(!argc)return;
    
    if(argv->a_type != A_SYMBOL) {
      ::error("no key given...");
      return;
    }
    std::string key=std::string(atom_getsymbol(argv)->s_name);
    std::vector<gem::any> values;
    argc--; argv++;
    while(argc-->0) {
      values.push_back(atom2any(argv++));
    }
    switch(values.size()) {
    default:
      props.set(key, values);
      break;
    case 1:
      props.set(key, values[0]);
      break;
    case 0: 
      {
	gem::any dummy;
	props.set(key, dummy);
      }
      break;
    }
  }
Exemplo n.º 21
0
void split_list(t_split *x,t_symbol* s,t_int argc,t_atom* argv)
{
     int i = argc;
     t_symbol* cur;
     t_atom a_out[256];
     int    c_out = 0;
     t_atom* a = a_out;

     while (i--) {
       switch( argv->a_type) {
       case A_FLOAT:
	 //	 post("flo: %f",atom_getfloat(argv));
	 SETFLOAT(a,atom_getfloat(argv));
	 a++;
	 c_out++;
	 break;
       case A_SYMBOL:
	 //	 post("sym: %s",atom_getsymbol(argv)->s_name);
	 SETSYMBOL(a,atom_getsymbol(argv));
	 a++;
	 c_out++;
	 break;
       default:
	 post("split.c: unknown type");
       }
       argv++;
     }
     
     outlet_anything(x->x_obj.ob_outlet,x->x_splitter,c_out,(t_atom*)&a_out);
     //post("done");
}
Exemplo n.º 22
0
/////////////////////////////////////////////////////////
//
// GEMglProgramStringARB
//
/////////////////////////////////////////////////////////
// Constructor
//
GEMglProgramStringARB :: GEMglProgramStringARB	(int argc, t_atom*argv) :
		target(static_cast<GLenum>(0)), 
		format(static_cast<GLenum>(0)), 
		len(static_cast<GLsizei>(0)),
                string(NULL)
{
        switch (argc) {
        default:
        case 4:
          string = reinterpret_cast<GLvoid*>(atom_getsymbol(argv+3)->s_name);
        case 3:
          len=atom_getint(argv+2);
        case 2:
          format=atom_getint(argv+1);
        case 1:
          target=atom_getint(argv+0);
        case 0:
          break;
        }

	m_inlet[0] = inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("target"));
	m_inlet[1] = inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("format"));
	m_inlet[2] = inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_float, gensym("len"));
	m_inlet[3] = inlet_new(this->x_obj, &this->x_obj->ob_pd, &s_symbol, gensym("string"));
}
Exemplo n.º 23
0
/*--------------------------------------------------------------------
 * newmethod, freemethod
 */
static void *holmes_new(t_symbol *sel, int argc, t_atom *argv)
{
  t_holmes *x;
  x = (t_holmes *)pd_new(holmes_class);

  /* initialize Holmes structures to defaults */
  holmes_init_global(&(x->hg));
  holmes_init_state(&(x->hs));
  holmes_init_utterance(&(x->hg),&(x->hs));

  /* intialize pd-passable frame-list */
  init_klatt_frame_alist(x->aframe);

  /* arguments (any known parameters) */
  if (argc) {
    pd_holmes_set_kw("holmes_new()",
		     &(x->hg), &(x->hs),
		     atom_getsymbol(argv), argc-1, argv+1);
  }

  /* -- outlets -- */
  x->kfr_out = outlet_new(&x->x_obj, &s_list);
  x->eoq_out = outlet_new(&x->x_obj, &s_bang);

  return (void *)x;
}
Exemplo n.º 24
0
static void *iem_send_new(t_symbol *s, int ac, t_atom *av)
{
  t_iem_send *x = (t_iem_send *)pd_new(iem_send_class);
	t_iem_send_proxy *p = (t_iem_send_proxy *)pd_new(iem_send_proxy_class);

  x->x_proxy_inlet = p;
  p->p_owner = x;
  
  if(ac > 0)
  {
    if(IS_A_SYMBOL(av,0))
    {
      x->x_send_label_sym = atom_getsymbol(av);
    }
    else if(IS_A_FLOAT(av,0))
    {
      char str[32];
      
      sprintf(str, "%g", atom_getfloat(av));
      x->x_send_label_sym = gensym(str);
    }
    else
      x->x_send_label_sym = 0;
  }
  else
    x->x_send_label_sym = 0;
	inlet_new((t_object *)x, (t_pd *)p, 0, 0);
  return (x);
}
Exemplo n.º 25
0
static void *iem_send_kernel_new(void)
{
  t_iem_send_kernel *x = (t_iem_send_kernel *)pd_new(iem_send_kernel_class);
  t_glist *glist = (t_glist *)canvas_getcurrent();
  t_canvas *canvas=glist_getcanvas(glist);
  int ac=0;
  t_atom *av;
  
  canvas_setcurrent(canvas);
  canvas_getargs(&ac, &av);
  canvas_unsetcurrent(canvas);
  
  if(ac > 0)
  {
    if(IS_A_SYMBOL(av,0))
    {
      x->x_sym = atom_getsymbol(av);
    }
    else if(IS_A_FLOAT(av,0))
    {
      char str[100];
      
      sprintf(str, "%g", atom_getfloat(av));
      x->x_sym = gensym(str);
    }
    else
      x->x_sym = 0;
  }
  else
    x->x_sym = 0;
  return (x);
}
Exemplo n.º 26
0
static void new_inlet_list(t_inlet *x, t_symbol *s, int argc, t_atom *argv)
{
    if (x->i_symfrom == &s_list || x->i_symfrom == &s_float || x->i_symfrom == &s_symbol || x->i_symfrom == &s_pointer)
        typedmess(x->i_dest, x->i_un.iu_symto, argc, argv);
    else if (*x->i_dest == eproxy_class)
    {
        t_eproxy* proxy = (t_eproxy *)x->i_dest;
        t_eobj *z = (t_eobj *)proxy->p_owner;
        z->o_current_proxy = proxy->p_index;
        pd_typedmess((t_pd *)x->i_dest, s, argc, argv);
        z->o_current_proxy = 0;
    }
    else if (!x->i_symfrom)
    {
        typedmess(x->i_dest, s, argc, argv);
        //pd_list(x->i_dest, s, argc, argv);
    }
    else if (!argc)
        new_inlet_bang(x);
    else if (argc==1 && argv->a_type == A_FLOAT)
        new_inlet_float(x, atom_getfloat(argv));
    else if (argc==1 && argv->a_type == A_SYMBOL)
        new_inlet_symbol(x, atom_getsymbol(argv));
    else inlet_wrong(x, &s_list);

}
Exemplo n.º 27
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, ";");
}
Exemplo n.º 28
0
void *listUnfold_new(t_symbol *s, int argc, t_atom *argv)
{
  t_listUnfold *x = (t_listUnfold *)pd_new(listUnfold_class);
  
  x->iterating = 0;
 
  x->mode = 0;
 
  if (argc && IS_A_SYMBOL(argv,0) ) {
	  t_symbol* type = atom_getsymbol(argv);
	  if (strcmp(type->s_name,"wait")==0 || strcmp(type->s_name,"manually")==0) {
		  x->mode = 1;
	}	
  }
 
  // Initialize memory
  x->memSize = 10;
  x->ac = 0;
  x->av = getbytes(x->memSize * sizeof(*(x->av)));

  x->outlet1 = outlet_new(&x->x_obj, &s_list);
  x->outlet2 = outlet_new(&x->x_obj, &s_float);


  return (void *)x;
}
Exemplo n.º 29
0
static void trigger_list(t_trigger *x, t_symbol *s, int argc, t_atom *argv)
{
#ifdef ROCKBOX
    (void) s;
#endif
    t_triggerout *u;
    int i;
    t_atom at;
    if (!argc)
    {
    	argc = 1;
    	SETFLOAT(&at, 0);
    	argv = &at;
    }
    for (i = x->x_n, u = x->x_vec + i; u--, i--;)
    {
    	if (u->u_type == TR_FLOAT)
    	    outlet_float(u->u_outlet, atom_getfloat(argv));
    	else if (u->u_type == TR_BANG)
	    outlet_bang(u->u_outlet);
    	else if (u->u_type == TR_SYMBOL)
    	    outlet_symbol(u->u_outlet, atom_getsymbol(argv));
    	else if (u->u_type == TR_POINTER)
    	{
    	    if (argv->a_type != TR_POINTER)
    	    	pd_error(x, "unpack: bad pointer");
    	    else outlet_pointer(u->u_outlet, argv->a_w.w_gpointer);
    	}
    	else outlet_list(u->u_outlet, &s_list, argc, argv);
    }
}
Exemplo n.º 30
0
void *freeverb_new(t_symbol *s, int argc, t_atom *argv)
{
	t_freeverb *x =  NULL;

	x = (t_freeverb *)eobj_new(freeverb_class);
	
    eobj_dspsetup((t_ebox *)x, 1, 1);
    
    if(argc && argv && atom_gettype(argv) == A_FLOAT)
    {
        if(!atom_getfloat(argv))
            x->f_freeverb = new Freeverb(0);
        else
            x->f_freeverb = new Freeverb(1);
    }
    else if(argc && argv && atom_gettype(argv) == A_SYMBOL)
    {
        if(atom_getsymbol(argv) == gensym("right"))
            x->f_freeverb = new Freeverb(1);
        else
            x->f_freeverb = new Freeverb(0);
    }
    else
        x->f_freeverb = new Freeverb(0);    
    
    x->f_freeverb->setdamp(initialdamp);
    x->f_freeverb->setroomsize(initialroom);
    
	return (x);
}