예제 #1
0
파일: fwriteln.c 프로젝트: Tzero2/pd
static void fwriteln_open (t_fwriteln *x, t_symbol *s, t_symbol*type)
{
   char* filename;

   string_copy(s->s_name, &filename);

   sys_bashfilename (filename, filename);

   fwriteln_close (x);

/*   if(0==type || type!=gensym("cr")) {
     pd_error(x, "unknown type '%s'", (type)?type->s_name:"");
     return;
   }*/

   if (type==gensym("cr"))
      strcpy(x->linebreak_chr,"\n");
   else
      strcpy(x->linebreak_chr,";\n");

   if (!(x->x_file=fopen(filename, "w"))) {
      pd_error(x, "failed to open %128s",filename);
      free(filename);
      return;
   }
   string_copy(filename, &x->x_filename);
   free(filename);
   x->x_textbuf = (char *) getbytes (MAXPDSTRING + 1);
}
예제 #2
0
파일: dict.c 프로젝트: pure-data/xeq
/* adapted pd_unbind() from m_pd.c */
void dict_unbind(t_dict *x, t_pd *obj, t_symbol *s)
{
#ifdef DICT_DEBUG
    post("unbind %x from \"%s\" at %x", (int)obj, s->s_name, (int)s);
#endif
    if (s->s_thing == obj) s->s_thing = 0;
    else if (s->s_thing && *s->s_thing == x->d_bindlist_class)
    {
    	    /* bindlists always have at least two elements... if the number
    	    goes down to one, get rid of the bindlist and bind the symbol
    	    straight to the remaining element. */

    	t_dict_bindlist *b = (t_dict_bindlist *)s->s_thing;
    	t_dict_bindelem *e, *e2;
    	if ((e = b->b_list)->e_who == obj)
    	{
    	    b->b_list = e->e_next;
    	    freebytes(e, sizeof(t_dict_bindelem));
    	}
    	else for (e = b->b_list; e2 = e->e_next; e = e2)
    	    if (e2->e_who == obj)
    	{
    	    e->e_next = e2->e_next;
    	    freebytes(e2, sizeof(t_dict_bindelem));
    	    break;
    	}
    	if (!b->b_list->e_next)
    	{
    	    s->s_thing = b->b_list->e_who;
    	    freebytes(b->b_list, sizeof(t_dict_bindelem));
    	    pd_free(&b->b_pd);
    	}
    }
    else pd_error(obj, "%s: couldn't unbind", s->s_name);
}
예제 #3
0
파일: m_class.c 프로젝트: IvanKhodorich/pd
    /* convenience routine giving a stdarg interface to typedmess().  Only
    ten args supported; it seems unlikely anyone will need more since
    longer messages are likely to be programmatically generated anyway. */
void pd_vmess(t_pd *x, t_symbol *sel, char *fmt, ...)
{
    va_list ap;
    t_atom arg[10], *at = arg;
    int nargs = 0;
    char *fp = fmt;

    va_start(ap, fmt);
    while (1)
    {
        if (nargs >= 10)
        {
            pd_error(x, "pd_vmess: only 10 allowed");
            break;
        }
        switch(*fp++)
        {
        case 'f': SETFLOAT(at, va_arg(ap, double)); break;
        case 's': SETSYMBOL(at, va_arg(ap, t_symbol *)); break;
        case 't':
            SETBLOB(at, va_arg(ap, t_blob *));
            /*post("pd_vmess: arg[0].a_w.w_blob = %p", arg[0].a_w.w_blob);*/
            break; /* MP 20061226 blob type */
        case 'i': SETFLOAT(at, va_arg(ap, t_int)); break;       
        case 'p': SETPOINTER(at, va_arg(ap, t_gpointer *)); break;
        default: goto done;
        }
        at++;
        nargs++;
    }
done:
    va_end(ap);
    typedmess(x, sel, nargs, arg);
}
예제 #4
0
파일: colorpanel.c 프로젝트: Angeldude/pd
static void colorpanel_list(t_colorpanel *x, t_symbol *s, int argc, t_atom *argv)
{
    t_symbol *tmp_symbol = s; /* <-- this gets rid of the unused variable warning */
    int i;
    unsigned int tmp_int;
    char color_buffer[3];
    char color_string[MAXPDSTRING];

    strncpy(color_string,"#",MAXPDSTRING);
    if(argc > 3) 
        logpost(x, 2, "[colorpanel] warning more than three elements in list");
    for(i=0; i<3; i++)
    {
        tmp_symbol = atom_getsymbolarg(i, argc, argv);
        if(tmp_symbol == &s_)
        {
            tmp_int = (unsigned int)(atom_getfloatarg(i, argc , argv) * 255);
            snprintf(color_buffer, 3, "%02x", (tmp_int > 255 ? 255 : tmp_int));
            strncat(color_string, color_buffer, 3);
        }
        else 
        {
            pd_error(x,"[colorpanel] symbols are not allowed in the color list");
            return;
        }
    }
    memcpy(x->current_color, color_string, 7);
    colorpanel_bang(x);
}
예제 #5
0
static void packRTCP_version(t_packRTCP *x, t_symbol*s, int argc, t_atom*argv) {
  if(argc) {
    int version = atom_getint(argv);
    if(version != 2) pd_error(x, "currently only version '2' is supported!");
    x->x_rtcp.common.version = 2;
  } else post("%s: %d", s->s_name, x->x_rtcp.common.version);
}
예제 #6
0
static void packRTCP_p(t_packRTCP *x, t_symbol*s, int argc, t_atom*argv) {
  if(argc) {
    int p = atom_getint(argv);
    if(p != 0) pd_error(x, "currently only padding '0' is supported!");
    x->x_rtcp.common.p = 0;
  }  else     post("'%s': %d", s->s_name, x->x_rtcp.common.p);
}
예제 #7
0
파일: m_pd.c 프로젝트: avilleret/pure-data
void pd_unbind(t_pd *x, t_symbol *s)
{
    if (s->s_thing == x) s->s_thing = 0;
    else if (s->s_thing && *s->s_thing == bindlist_class)
    {
            /* bindlists always have at least two elements... if the number
            goes down to one, get rid of the bindlist and bind the symbol
            straight to the remaining element. */

        t_bindlist *b = (t_bindlist *)s->s_thing;
        t_bindelem *e, *e2;
        if ((e = b->b_list)->e_who == x)
        {
            b->b_list = e->e_next;
            freebytes(e, sizeof(t_bindelem));
        }
        else for (e = b->b_list; (e2 = e->e_next); e = e2)
            if (e2->e_who == x)
        {
            e->e_next = e2->e_next;
            freebytes(e2, sizeof(t_bindelem));
            break;
        }
        if (!b->b_list->e_next)
        {
            s->s_thing = b->b_list->e_who;
            freebytes(b->b_list, sizeof(t_bindelem));
            pd_free(&b->b_pd);
        }
    }
    else pd_error(x, "%s: couldn't unbind", s->s_name);
}
예제 #8
0
파일: freadln.c 프로젝트: jptrkz/pd-zexy
static void freadln_open (t_freadln *x, t_symbol *s, t_symbol*type)
{
   char filenamebuf[MAXPDSTRING], *filenamebufptr;
   char*dirname=canvas_getdir(x->x_canvas)->s_name;
   int fd, len;

   freadln_close(x);

/*
   if(type!=gensym("cr")) {
     pd_error(x, "currently only 'cr' type files are implemented!");
     return;
   }
*/
   if (type==gensym("cr"))
      strcpy(x->linebreak_chr,"\n");
   else
      strcpy(x->linebreak_chr,";\n");
      

   /* directory, filename, extension, dirresult, nameresult, unsigned int size, int bin */
   if ((fd=open_via_path(dirname,
	       s->s_name,"", filenamebuf, &filenamebufptr, MAXPDSTRING,0)) < 0 ) {
      pd_error(x, "%s: failed to open %s", s->s_name, filenamebuf);
      return;
   }
   close(fd);
   len=strlen(filenamebuf);
   if (!(x->x_filename=(char*)getbytes(sizeof(char)*(len+strlen(s->s_name)+2)))) {
      pd_error(x, "out of memory");
      freadln_close(x);
      return;
   }
   strcpy(x->x_filename,filenamebuf);
   strcpy(x->x_filename+len,"/");
   strcpy(x->x_filename+len+1,s->s_name);
   if (!(x->x_file=fopen(x->x_filename, "r"))) {
      pd_error(x, "freadln: failed to open %128s",filenamebuf);
      return;
   }
   if (!(x->x_textbuf = (char *) getbytes (MIN_FREADLN_LENGTH * sizeof(char)))) {
      pd_error(x, "out of memory");
      freadln_close(x);
      return;
   }
   x->x_textbuf_length=MIN_FREADLN_LENGTH;
}
예제 #9
0
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);
}
예제 #10
0
static void pd_defaultanything(t_pd *x, t_symbol *s, int argc, t_atom *argv)
{
#ifdef ROCKBOX
    (void) argc;
    (void) argv;
#endif
    pd_error(x, "%s: no method for '%s'", (*x)->c_name->s_name, s->s_name);
}
예제 #11
0
파일: muse.c 프로젝트: myQuil/pd-externals
static void muse_set(t_muse *x, t_symbol *s, int ac, t_atom *av) {
	if (ac==2 && av->a_type == A_FLOAT)
	{	int i = muse_limtr(x, av->a_w.w_float, 1);
		t_atomtype typ = (av+1)->a_type;
		if (typ == A_FLOAT) x->x_scl[i] = (av+1)->a_w.w_float;
		else if (typ == A_SYMBOL) muse_operate(x->x_scl+i, av+1);   }
	else pd_error(x, "muse_set: bad arguments");
}
예제 #12
0
파일: ctw.c 프로젝트: quahada/PuRestJson
static void ctw_output_curl_error(struct _ctw *common, CURLMsg *msg) {
	t_atom status_data[2];

	SETFLOAT(&status_data[0], msg->data.result);
	SETSYMBOL(&status_data[1], gensym(curl_easy_strerror(msg->data.result)));
	pd_error(common, "Error while performing request: %s", curl_easy_strerror(msg->data.result));
	outlet_list(common->status_out, &s_list, 2, &status_data[0]);
}
예제 #13
0
파일: wiimote.c 프로젝트: Angeldude/pd
static void wiimote_cwiid_error(t_wiimote *x, struct cwiid_error_mesg *mesg) {
  switch(mesg->error) {
  case CWIID_ERROR_NONE:
    pd_error(x, "no error");
    break;
  case CWIID_ERROR_DISCONNECT:
    pd_error(x, "disconnect error");
    wiimote_doDisconnect(x);
    break;
  case CWIID_ERROR_COMM:
    pd_error(x, "comm error");
    wiimote_doDisconnect(x);
    break;
  default:
    pd_error(x, "unknown error %d", mesg->error);
  }
}
예제 #14
0
/*--------------------------------------------------------------------
 * seek FLOAT
 */
static void readdir_seek(t_readdir *x, t_floatarg pos)
{
  if (!x->x_dir) {
    pd_error(x, "readdir: seek %g: no directory opened!", pos);
    return;
  }
  seekdir(x->x_dir, (off_t)pos);
}
예제 #15
0
/*--------------------------------------------------------------------
 * next : get next entry
 */
static void readdir_next(t_readdir *x)
{
  t_symbol *sel = sp_unknown;
  struct dirent *result = NULL;
  if ( !x->x_dir || !(result = readdir(x->x_dir)) ) {
    if (errno == EBADF) {
      //-- real error
      pd_error(x, "readdir: cannot read from %s: %s", x->x_dirname->s_name, strerror(errno));
    }
    else {
      //-- end of directory
      outlet_bang(x->x_eod_outlet);
    }
    return;
  }

#if HAVE_STRUCT_DIRENT_D_TYPE
  //-- get type (if this OS supports it, e.g. if we're not on windoof)
  switch (result->d_type)
    {
#if HAVE_DECL_DT_REG
    case DT_REG: sel = sp_file; break;
#endif

#if HAVE_DECL_DT_DIR
    case DT_DIR: sel = sp_dir; break;
#endif

#if HAVE_DECL_DT_FIFO
    case DT_FIFO: sel = sp_fifo; break;
#endif

#if HAVE_DECL_DT_SOCK
    case DT_SOCK: sel = sp_sock; break;
#endif

#if HAVE_DECL_DT_CHR
    case DT_CHR: sel = sp_chrdev; break;
#endif

#if HAVE_DECL_DT_BLK
    case DT_BLK: sel = sp_blkdev; break;
#endif

#if HAVE_DECL_DT_UNKNOWN
    case DT_UNKNOWN:
#endif
    default:
      sel = sp_unknown;
      break;
    }
#else  /* if !HAVE_STRUCT_DIRENT_D_TYPE */
  sel = sp_unknown;
#endif /* HAVE_STRUCT_DIRENT_D_TYPE */

  x->x_eatom.a_w.w_symbol = gensym(result->d_name);
  outlet_anything(x->x_ent_outlet, sel, 1, &x->x_eatom);
}
예제 #16
0
파일: zmq.c 프로젝트: sansculotte/pd-zmq
/**
 * fetch a message
 */
static void _zmq_receive(t_zmq *x) {

   if ( ! _can_receive(x)) {
      return;
   }

   int r, err;
   char buf[MAXPDSTRING];
   t_binbuf *b;
   int msg;

   r=zmq_recv (x->zmq_socket, buf, MAXPDSTRING, ZMQ_DONTWAIT);
   if(r != -1) {
       if (r > MAXPDSTRING) r = MAXPDSTRING; // brutally cut off excessive bytes
       buf[r - 1] = 0; // terminate string
       if(r > 0) {
          b = binbuf_new();
          binbuf_text(b, buf, r);
          // the following code is cp'ed from x_net.c::netreceive_doit
          int natom = binbuf_getnatom(b);
          t_atom *at = binbuf_getvec(b);
          for (msg = 0; msg < natom;)
          {
              int emsg;
              for (emsg = msg; emsg < natom && at[emsg].a_type != A_COMMA
                      && at[emsg].a_type != A_SEMI; emsg++)
                  ;
              if (emsg > msg)
              {
                  int i;
                  for (i = msg; i < emsg; i++)
                      if (at[i].a_type == A_DOLLAR || at[i].a_type == A_DOLLSYM)
                      {
                          pd_error(x, "zmq_receive: got dollar sign in message");
                          goto nodice;
                      }
                  if (at[msg].a_type == A_FLOAT)
                  {
                      if (emsg > msg + 1)
                          outlet_list(x->s_out, 0, emsg-msg, at + msg);
                      else outlet_float(x->s_out, at[msg].a_w.w_float);
                  }
                  else if (at[msg].a_type == A_SYMBOL)
                      outlet_anything(x->s_out, at[msg].a_w.w_symbol,
                              emsg-msg-1, at + msg + 1);
              }
          nodice:
              msg = emsg + 1;
          }

       } else {
          outlet_bang(x->s_out);
       }
       if((err=zmq_errno())!=EAGAIN) {
          _zmq_error(err);
       }
   }
}
예제 #17
0
파일: x_time.c 프로젝트: porres/pure-data
    /* parse a time unit such as "5 msec", "60 perminute", or "1 sample" to
    a form usable by clock_setunit)( and clock_gettimesincewithunits().
    This brute-force search through symbols really ought not to be done on
    the fly for incoming 'tempo' messages, hmm...  This isn't public because
    its interface might want to change - but it's used in x_text.c as well
    as here. */
void parsetimeunits(void *x, t_float amount, t_symbol *unitname,
    t_float *unit, int *samps)
{
    const char *s = unitname->s_name;
    if (amount <= 0)
        amount = 1;
    if (s[0] == 'p' && s[1] == 'e' && s[2] == 'r')  /* starts with 'per' */
    {
        const char *s2 = s+3;
        if (!strcmp(s2, "millisecond") || !strcmp(s2, "msec"))  /* msec */
            *samps = 0, *unit = 1./amount;
        else if (!strncmp(s2, "sec", 3))        /* seconds */
            *samps = 0, *unit = 1000./amount;
        else if (!strncmp(s2, "min", 3))        /* minutes */
            *samps = 0, *unit = 60000./amount;
        else if (!strncmp(s2, "sam", 3))        /* samples */
            *samps = 1, *unit = 1./amount;
        else goto fail;
    }
    else
    {
            /* empty string defaults to msec */
        if (!strcmp(s, "millisecond") || !strcmp(s, "msec"))
            *samps = 0, *unit = amount;
        else if (!strncmp(s, "sec", 3))
            *samps = 0, *unit = 1000.*amount;
        else if (!strncmp(s, "min", 3))
            *samps = 0, *unit = 60000.*amount;
        else if (!strncmp(s, "sam", 3))
            *samps = 1, *unit = amount;
        else
        {
        fail:
                /* empty time unit specification defaults to 1 msec for
                back compatibility, since it's possible someone threw a
                float argument to timer which had previously been ignored. */
            if (*s)
                pd_error(x, "%s: unknown time unit", s);
            else pd_error(x,
                "tempo setting needs time unit ('sec', 'samp', 'permin', etc.");
            *unit = 1;
            *samps = 0;
        }
    }
}
예제 #18
0
/**********************************************************
 * disis_spi_open() :function is called by the "open" command
 * It is responsible for opening the spidev device
 * "devspi" and then setting up the spidev interface.
 * member variables are used to configure spidev.
 * They must be set appropriately before calling
 * this function.
 * *********************************************************/
static void disis_spi_open(t_disis_spi *spi, t_symbol *devspi){
    int statusVal = 0;
    if (strlen(devspi->s_name) == 0) {
      spi->spidev = gensym("/dev/spidev0.0");
    } else {
      spi->spidev = devspi;
    }
    spi->spifd = open(spi->spidev->s_name, O_RDWR);
    if(spi->spifd < 0) {
      statusVal = -1;
      pd_error(spi, "could not open SPI device");
      goto spi_output;
    }
 
    statusVal = ioctl (spi->spifd, SPI_IOC_WR_MODE, &(spi->mode));
    if(statusVal < 0){
      pd_error(spi, "Could not set SPIMode (WR)...ioctl fail");
      disis_spi_close(spi);
      goto spi_output;
    }
 
    statusVal = ioctl (spi->spifd, SPI_IOC_RD_MODE, &(spi->mode));
    if(statusVal < 0) {
      pd_error(spi, "Could not set SPIMode (RD)...ioctl fail");
      disis_spi_close(spi);
      goto spi_output;
    }
 
    statusVal = ioctl (spi->spifd, SPI_IOC_WR_BITS_PER_WORD, &(spi->bitsPerWord));
    if(statusVal < 0) {
      pd_error(spi, "Could not set SPI bitsPerWord (WR)...ioctl fail");
      disis_spi_close(spi);
      goto spi_output;
    }
 
    statusVal = ioctl (spi->spifd, SPI_IOC_RD_BITS_PER_WORD, &(spi->bitsPerWord));
    if(statusVal < 0) {
      pd_error(spi, "Could not set SPI bitsPerWord(RD)...ioctl fail");
      disis_spi_close(spi);
      goto spi_output;
    }  
 
    statusVal = ioctl (spi->spifd, SPI_IOC_WR_MAX_SPEED_HZ, &(spi->speed));    
    if(statusVal < 0) {
      pd_error(spi, "Could not set SPI speed (WR)...ioctl fail");
      disis_spi_close(spi);
      goto spi_output;
    }
 
    statusVal = ioctl (spi->spifd, SPI_IOC_RD_MAX_SPEED_HZ, &(spi->speed));    
    if(statusVal < 0) {
      pd_error(spi, "Could not set SPI speed (RD)...ioctl fail");
      disis_spi_close(spi);
      goto spi_output;
    }
spi_output:
    if (!statusVal) statusVal = 1;
    else statusVal = 0;
    outlet_float(spi->x_out9, statusVal);
}
예제 #19
0
파일: x_vexp_if.c 프로젝트: Angeldude/pd
/*
 * max_ex_tab -- evaluate this table access
 *               eptr is the name of the table and arg is the index we
 *               have to put the result in optr
 *               return 1 on error and 0 otherwise
 *
 * Arguments:
 *  the expr object
 *  table
 *  the argument
 *  the result pointer
 */
int
max_ex_tab(struct expr *expr, fts_symbol_t s, struct ex_ex *arg,
    struct ex_ex *optr)
{
#ifdef PD
        t_garray *garray;
        int size, indx;
        t_word *wvec;

        if (!s || !(garray = (t_garray *)pd_findbyclass(s, garray_class)) ||
            !garray_getfloatwords(garray, &size, &wvec))
        {
                optr->ex_type = ET_FLT;
                optr->ex_flt = 0;
                pd_error(expr, "no such table '%s'", s->s_name);
                return (1);
        }
        optr->ex_type = ET_FLT;

        switch (arg->ex_type) {
        case ET_INT:
                indx = arg->ex_int;
                break;
        case ET_FLT:
                /* strange interpolation code deleted here -msp */
                indx = arg->ex_flt;
                break;

        default:        /* do something with strings */
                pd_error(expr, "expr: bad argument for table '%s'\n", fts_symbol_name(s));
                indx = 0;
        }
        if (indx < 0) indx = 0;
        else if (indx >= size) indx = size - 1;
        optr->ex_flt = wvec[indx].w_float;
#else /* MSP */
        /*
         * table lookup not done for MSP yet
         */
        post("max_ex_tab: not complete for MSP yet!");
        optr->ex_type = ET_FLT;
        optr->ex_flt = 0;
#endif
        return (0);
}
예제 #20
0
static void tabwrite_tilde_set(t_tabwrite_tilde *x, t_symbol *s)
{
    t_garray *a;

    x->x_arrayname = s;
    if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
    {
        if (*s->s_name) pd_error(x, "tabwrite~: %s: no such array",
            x->x_arrayname->s_name);
        x->x_vec = 0;
    }
    else if (!garray_getfloatwords(a, &x->x_nsampsintab, &x->x_vec))
    {
        pd_error(x, "%s: bad template for tabwrite~", x->x_arrayname->s_name);
        x->x_vec = 0;
    }
    else garray_usedindsp(a);
}
예제 #21
0
파일: wiimote.c 프로젝트: Angeldude/pd
static void wiimote_resetReportMode(t_wiimote *x)
{
   if (x->connected)   {
      verbose(1, "changing report mode for Wii%02d to %d", x->wiimoteID, x->reportMode);
      if (cwiid_command(x->wiimote, CWIID_CMD_RPT_MODE, x->reportMode)) {
	pd_error(x, "wiimote: could not set report mode.");
      }
   }
}
예제 #22
0
static void pack_symbol(t_pack *x, t_symbol *s)
{
    if (x->x_vec->a_type == A_SYMBOL)
    {
    	x->x_vec->a_w.w_symbol = s;
    	pack_bang(x);
    }
    else pd_error(x, "pack_symbol: wrong type");
}
예제 #23
0
static void pack_float(t_pack *x, t_float f)
{
    if (x->x_vec->a_type == A_FLOAT)
    {
    	x->x_vec->a_w.w_float = f;
    	pack_bang(x);
    }
    else pd_error(x, "pack_float: wrong type");
}
예제 #24
0
파일: wiimote.c 프로젝트: Angeldude/pd
static void wiimote_status(t_wiimote *x)
{
  if(x->connected) {
    if (cwiid_request_status(x->wiimote)) {
      pd_error(x, "error requesting status message");
    }
  }
  wiimote_out_status(x, x->connected);
}
예제 #25
0
파일: trento.c 프로젝트: amurtet/pd-dis
void trento_loadinfo(t_trento *x)
{
  if(x->loadcomplete!=0) {
      pd_error(x,"you have to load!");
      return;
  }
  post("frames1: %d",x->inc_frames1);
  post("frames2: %d",x->inc_frames2);
}
예제 #26
0
파일: m_class.c 프로젝트: Angeldude/pd
static void pd_floatforsignal(t_pd *x, t_float f)
{
    int offset = (*x)->c_floatsignalin;
    if (offset > 0)
        *(t_float *)(((char *)x) + offset) = f;
    else
        pd_error(x, "%s: float unexpected for signal input",
            (*x)->c_name->s_name);
}
예제 #27
0
static void tabread_float(t_tabread *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 tabread", x->x_arrayname->s_name);
    else
    {
        int n = f;
        if (n < 0) n = 0;
        else if (n >= npoints) n = npoints - 1;
        outlet_float(x->x_obj.ob_outlet, (npoints ? vec[n].w_float : 0));
    }
}
예제 #28
0
파일: mill~.c 프로젝트: ollierik/pd-mill
void mill_tilde_set(t_mill_tilde *x, t_symbol *s)
{
     t_garray *a;

     x->arrayname = s;
     if (!(a = (t_garray *)pd_findbyclass(x->arrayname, garray_class)))
     {
         if (*s->s_name)
             pd_error(x, "tabread~: %s: no such array", x->arrayname->s_name);
         x->x_vec = 0;
     }
     else if (!garray_getfloatwords(a, &x->arraysize, &x->x_vec))
     {
         pd_error(x, "%s: bad template for tabread~", x->arrayname->s_name);
         x->x_vec = 0;
     }
     else garray_usedindsp(a);
}
예제 #29
0
파일: wiimote.c 프로젝트: Angeldude/pd
static void wiimote_setRumble(t_wiimote *x, t_floatarg f)
{
   if (x->connected)
   {
     if (cwiid_command(x->wiimote, CWIID_CMD_RUMBLE, f)) {
       pd_error(x, "wiimote: could not set rumble");
     }
   }
}
예제 #30
0
void WrappedNodeInfoClass_new(TTPtr self, long argc, t_atom* argv)
{
	WrappedModularInstancePtr	x = (WrappedModularInstancePtr)self;
	t_symbol *relativeAddress;
	long      attrstart = attr_args_offset(argc, argv);			// support normal arguments
	
	// check address argument
	relativeAddress = _sym_nothing;
	if (attrstart && argv)
		if (atom_gettype(argv) == A_SYM)
			relativeAddress = atom_getsym(argv);
	
	if (relativeAddress == _sym_nothing) {
		pd_error((t_object*)x, "needs a name as first argument");
		return;
	}
    
    // check for reserved address
    if (relativeAddress == gensym("data/mute")      ||
        relativeAddress == gensym("data/bypass")    ||
        relativeAddress == gensym("data/freeze")    ||
        relativeAddress == gensym("data/preview")   ||
        relativeAddress == gensym("audio/mute")     ||
        relativeAddress == gensym("audio/bypass")   ||
        relativeAddress == gensym("audio/mix")      ||
        relativeAddress == gensym("audio/gain")     ||
        relativeAddress == gensym("model")          ||
        relativeAddress == gensym("preset")         ) {
        
        pd_error((t_object*)x, "%s address is reserved by j.model", relativeAddress->s_name);
		return;
    }
    
    jamoma_node_info_create((t_object*)x, x->wrappedObject);
	
	if (argc && argv)
        attr_args_process(x, argc, argv);
	
	// The following must be deferred because we have to interrogate our box,
	// and our box is not yet valid until we have finished instantiating the object.
	// Trying to use a loadbang method instead is also not fully successful (as of Max 5.0.6)
    node_subscribe(x,relativeAddress, argc, argv);
//	defer_low((t_object*)x, (method)node_subscribe, relativeAddress, argc, argv);
}