Пример #1
0
void glist_cleanup(t_glist *x)
{
    freebytes(x->gl_xlabel, x->gl_nxlabels * sizeof(*(x->gl_xlabel)));
    freebytes(x->gl_ylabel, x->gl_nylabels * sizeof(*(x->gl_ylabel)));
    gstub_cutoff(x->gl_stub);
}
Пример #2
0
static void substitute_free(t_substitute *x)
{
    if (x->x_proxy) pd_free(x->x_proxy);
    if (x->x_message != x->x_messini)
	freebytes(x->x_message, x->x_size * sizeof(*x->x_message));
}
Пример #3
0
static void delay_free(t_delay *x)
{
    if (x->x_buf) freebytes(x->x_buf, x->x_maxsize * sizeof(*x->x_buf));
}
Пример #4
0
static void netserver_socketreceiver_free(t_netserver_socketreceiver *x)
{
   free(x->sr_inbuf);
   freebytes(x, sizeof(*x));
}
Пример #5
0
static void fwriteln_write (t_fwriteln *x, t_symbol *s, int argc, t_atom *argv)
{
   int length=0;
   char *text=x->x_textbuf;
   if (x->x_file) {
      if ((s!=gensym("list"))||(argv->a_type==A_SYMBOL)) {
         snprintf(text,MAXPDSTRING,"%s ", s->s_name);
         text[MAXPDSTRING-1]=0;
         length=strlen(text);
         if (fwrite(text, length*sizeof(char),1,x->x_file) < 1) {
            pd_error(x, "failed to write %128s",x->x_filename);
            freebytes (text, MAXPDSTRING * sizeof(char));
            fwriteln_close(x);
            return;
         }
      }
      while (argc--)
      {
         switch (argv->a_type) {
            case A_FLOAT:
              snprintf(text,MAXPDSTRING,x->format_string_afloats,
                       atom_getfloat(argv));
              text[MAXPDSTRING-1]=0;
              length=strlen(text);
              if (fwrite(text, length*sizeof(char),1,x->x_file) < 1) {
                pd_error(x, "failed to write %128s",x->x_filename);
                freebytes (text, MAXPDSTRING * sizeof(char));
                fwriteln_close(x);
                return;
              }
              break;
         case A_SYMBOL:
           snprintf(text,MAXPDSTRING,"%s ", atom_getsymbol(argv)->s_name);
           text[MAXPDSTRING-1]=0;
           length=strlen(text);
           if (fwrite(text, length*sizeof(char),1,x->x_file) < 1) {
             pd_error(x, "failed to write %128s",x->x_filename);
             freebytes (text, MAXPDSTRING * sizeof(char));
             fwriteln_close(x);
             return;
           }
           break;
         case A_COMMA:
           snprintf(text,MAXPDSTRING,", ");
           length=strlen(text);
           if (fwrite(text, length*sizeof(char),1,x->x_file) < 1) {
             pd_error(x, "failed to write %128s",x->x_filename);
             freebytes (text, MAXPDSTRING * sizeof(char));
             fwriteln_close(x);
             return;
           }
           break;
         case A_SEMI:
           snprintf(text,MAXPDSTRING,"; ");
           length=strlen(text);
           if (fwrite(text, length*sizeof(char),1,x->x_file) < 1) {
             pd_error(x, "failed to write %128s",x->x_filename);
             freebytes (text, MAXPDSTRING * sizeof(char));
             fwriteln_close(x);
             return;
           }
           break;
         default:
           break;
         }
         argv++;
      }

      snprintf(text,MAXPDSTRING,"%s", x->linebreak_chr);
      length=strlen(text);
      if (fwrite(text, length*sizeof(char),1,x->x_file) < 1) {
         pd_error(x, "failed to write %128s",x->x_filename);
         freebytes (text, MAXPDSTRING * sizeof(char));
         fwriteln_close(x);
         return;
      }
   }
   else {
      pd_error(x, "no file opened for writing");
   }
}
Пример #6
0
static void scope_bufsize(t_scope *x, t_symbol *s, int ac, t_atom *av)
{
    t_float bufsize = (s ? x->x_bufsize : SCOPE_DEFBUFSIZE);
    int result = loud_floatarg(*(t_pd *)x, (s ? 0 : 4), ac, av, &bufsize,
			       SCOPE_MINBUFSIZE, SCOPE_WARNBUFSIZE,
			       /* LATER rethink warning rules */
			       (s ? LOUD_CLIP : LOUD_CLIP | LOUD_WARN), 0,
			       "display elements");
    if (result == LOUD_ARGOVER)
    {
	bufsize = (s ? x->x_bufsize : SCOPE_DEFBUFSIZE);
	result = loud_floatarg(*(t_pd *)x, (s ? 0 : 4), ac, av, &bufsize,
			       0, SCOPE_MAXBUFSIZE, 0, LOUD_CLIP | LOUD_WARN,
			       "display elements");
	if (!s && result == LOUD_ARGOK)
	    fittermax_warning(*(t_pd *)x,
			      "more than %g display elements requested",
			      SCOPE_WARNBUFSIZE);
    }
    if (!s)
    {
	x->x_allocsize = SCOPE_DEFBUFSIZE;
	x->x_bufsize = 0;
	x->x_xbuffer = x->x_xbufini;
	x->x_ybuffer = x->x_ybufini;
    }
    if (!s || result == LOUD_ARGOK)
    {
	int newsize = (int)bufsize;
	if (newsize > x->x_allocsize)
	{
	    int nrequested = newsize;
	    int allocsize = x->x_allocsize;
	    int oldsize = x->x_bufsize;
	    x->x_xbuffer = grow_withdata(&nrequested, &oldsize,
					 &allocsize, x->x_xbuffer,
					 SCOPE_DEFBUFSIZE, x->x_xbufini,
					 sizeof(*x->x_xbuffer));
	    if (nrequested == newsize)
	    {
		allocsize = x->x_allocsize;
		oldsize = x->x_bufsize;
		x->x_ybuffer = grow_withdata(&nrequested, &oldsize,
					     &allocsize, x->x_ybuffer,
					     SCOPE_DEFBUFSIZE, x->x_ybufini,
					     sizeof(*x->x_ybuffer));
	    }
	    if (nrequested == newsize)
	    {
		x->x_allocsize = allocsize;
		x->x_bufsize = newsize;
	    }
	    else
	    {
		if (x->x_xbuffer != x->x_xbufini)
		    freebytes(x->x_xbuffer,
			      x->x_allocsize * sizeof(*x->x_xbuffer));
		if (x->x_ybuffer != x->x_ybufini)
		    freebytes(x->x_ybuffer,
			      x->x_allocsize * sizeof(*x->x_ybuffer));
		x->x_allocsize = SCOPE_DEFBUFSIZE;
		x->x_bufsize = SCOPE_DEFBUFSIZE;
		x->x_xbuffer = x->x_xbufini;
		x->x_ybuffer = x->x_ybufini;
	    }
	}
	else x->x_bufsize = newsize;
	scope_clear(x, 0);
    }
}
static void soundfile_info_free(t_soundfile_info *x)
{
  freebytes(x->x_begmem, x->x_size * sizeof(long));
}
Пример #8
0
static void bin_ambi_reduced_decode_fft_free(t_bin_ambi_reduced_decode_fft *x)
{
	freebytes(x->x_hrir_filename, (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(t_symbol *));
	freebytes(x->x_s_hrir, (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(t_symbol *));
	freebytes(x->x_s_hrtf_re, x->x_n_ambi * sizeof(t_symbol *));
	freebytes(x->x_s_hrtf_im, x->x_n_ambi * sizeof(t_symbol *));
	freebytes(x->x_inv_work1, x->x_n_ambi * x->x_n_ambi * sizeof(double));
	freebytes(x->x_inv_work2, 2 * x->x_n_ambi * x->x_n_ambi * sizeof(double));
	freebytes(x->x_inv_buf2, 2 * x->x_n_ambi * sizeof(double));
	freebytes(x->x_transp, (x->x_n_ind_ls+2*x->x_n_mrg_mir_ls+x->x_n_ph_ls) * x->x_n_ambi * sizeof(double));
	freebytes(x->x_ls_encode, (x->x_n_ind_ls+2*x->x_n_mrg_mir_ls+x->x_n_ph_ls) * x->x_n_ambi * sizeof(double));
	freebytes(x->x_prod2, (x->x_n_ind_ls+2*x->x_n_mrg_mir_ls+x->x_n_ph_ls) * x->x_n_ambi * sizeof(double));
	freebytes(x->x_prod3, (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * x->x_n_ambi * sizeof(double));
	freebytes(x->x_ambi_channel_weight, x->x_n_ambi * sizeof(double));

	freebytes(x->x_delta, (x->x_n_ind_ls+2*x->x_n_mrg_mir_ls+x->x_n_ph_ls) * sizeof(int));
	freebytes(x->x_phi, (x->x_n_ind_ls+2*x->x_n_mrg_mir_ls+x->x_n_ph_ls) * sizeof(int));
	freebytes(x->x_phi_sym, (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(int));
	freebytes(x->x_sym_flag, (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(int));

	freebytes(x->x_spec, x->x_fftsize * sizeof(BIN_AMBI_COMPLEX));
	freebytes(x->x_sin_cos, x->x_fftsize * sizeof(BIN_AMBI_COMPLEX));

	freebytes(x->x_beg_hrir, x->x_fftsize * (x->x_n_ind_ls+x->x_n_mrg_mir_ls) * sizeof(t_float));
	freebytes(x->x_beg_hrtf_re, x->x_n_ambi * sizeof(iemarray_t *));
	freebytes(x->x_beg_hrtf_im, x->x_n_ambi * sizeof(iemarray_t *));
}
Пример #9
0
void pd_unbind(t_pd *x, t_symbol *s)
{
	//fprintf(stderr,"pd_unbind %s\n", s->s_name);
    if (s->s_thing == x) {
		//fprintf(stderr,"pd_unbind option A %lx\n", (t_int)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. */

			/* in pd-l2ork, we however also check whether changes to the bindlist
			occur via graph (through code execution, e.g. dynamic change of receives)
			and if so, we do not deallocate memory until the entire bindlist_<datatype>
			function is complete with its execution, after which we call
			bindlist_cleanup(). we control the execution via static int variable
			change_bindlist_via_graph */

		//fprintf(stderr,"pd_unbind option B %lx\n", (t_int)x);

        t_bindlist *b = (t_bindlist *)s->s_thing;
        t_bindelem *e, *e2;
        if ((e = b->b_list)->e_who == x)
        {
			if (change_bindlist_via_graph) {
				change_bindlist_via_graph++;
				e->e_delayed_free = 1;
			} else {
            	b->b_list = e->e_next;
            	freebytes(e, sizeof(t_bindelem));
			}
			//fprintf(stderr,"success B1a\n");
        }
        else for (e = b->b_list; e2 = e->e_next; e = e2)
            if (e2->e_who == x)
        {
			if (change_bindlist_via_graph) {
				change_bindlist_via_graph++;
				e2->e_delayed_free = 1;
			} else {
		        e->e_next = e2->e_next;
		        freebytes(e2, sizeof(t_bindelem));
			}
			//fprintf(stderr,"success B1b\n");
            break;
        }

		int count_valid = 0;
		t_bindelem *e1 = NULL;
        for (e = b->b_list; e; e = e->e_next)
        {
			if (e->e_who != NULL && !e->e_delayed_free) {
				count_valid++;
				e1 = e;
			}

		}
		if (count_valid == 1) {
            s->s_thing = e1->e_who;
			if (!change_bindlist_via_graph) {
            	freebytes(b->b_list, sizeof(t_bindelem));
            	pd_free(&b->b_pd);
			}
			//fprintf(stderr,"success B2\n");
        }
    }
    else pd_error(x, "%s: couldn't unbind", s->s_name);
}
Пример #10
0
static void symbol2list_process(t_symbol2list *x)
{
  char *cc;
  char *deli;
  int   dell;
  char *cp, *d;
  int i=1;

  if (x->s==NULL) {
    x->argc=0;
    return;
  }
  cc=x->s->s_name;
  cp=cc;

  if (x->delimiter==NULL || x->delimiter==gensym("")) {
    i=strlen(cc);
    if(x->argnum<i) {
      freebytes(x->argv, x->argnum*sizeof(t_atom));
      x->argnum=i+10;
      x->argv=getbytes(x->argnum*sizeof(t_atom));
    }
    x->argc=i;
    while(i--) {
      string2atom(x->argv+i, cc+i, 1);
    }
    return;
  }

  deli=x->delimiter->s_name;
  dell=strlen(deli);


  /* get the number of tokens */
  while((d=strstr(cp, deli))) {
    if (d!=NULL && d!=cp) {
      i++;
    }
    cp=d+dell;
  }

  /* resize the list-buffer if necessary */
  if(x->argnum<i) {
    freebytes(x->argv, x->argnum*sizeof(t_atom));
    x->argnum=i+10;
    x->argv=getbytes(x->argnum*sizeof(t_atom));
  }
  x->argc=i;
  /* parse the tokens into the list-buffer */
  i=0;

  /* find the first token */
  cp=cc;
  while(cp==(d=strstr(cp,deli))) {
    cp+=dell;
  }
  while((d=strstr(cp, deli))) {
    if(d!=cp) {
      string2atom(x->argv+i, cp, d-cp);
      i++;
    }
    cp=d+dell;
  }

  if(cp) {
    string2atom(x->argv+i, cp, strlen(cp));
  }
}
Пример #11
0
static void list_unfold_free(t_list_unfold *x)
{
    freebytes(x->av, x->memSize * sizeof(*(x->av)));
}
Пример #12
0
static void deny_free(t_deny *x)
{
	freebytes(x->x_elem, x->x_numelem*sizeof(t_atom));
}
Пример #13
0
void ritmo1_free(t_ritmo1 *x)
{
	freebytes(x->buf1, sizeof(x->buf1));
//	freebytes(x->buf2, sizeof(x->buf2));	
//	freebytes(x->buf3, sizeof(x->buf3));
}
Пример #14
0
void glist_free(t_glist *x)
{
    glist_cleanup(x);
    freebytes(x, sizeof(*x));
}
Пример #15
0
static void tg_free(t_tg *tg) {
  freebytes(tg->outputvals, sizeof(t_atom)*tg->rows);
  freebytes(tg->toggled, sizeof(char)*tg->rows*tg->cols);
}
Пример #16
0
static void curve_free(t_curve *x)
{
    if (x->x_segs != x->x_segini)
	freebytes(x->x_segs, x->x_size * sizeof(*x->x_segs));
    if (x->x_clock) clock_free(x->x_clock);
}
Пример #17
0
static void demux_free(t_demux *x)
{
  freebytes(x->out, x->n_out * sizeof(t_sample *));
}
Пример #18
0
void bthresher_free( t_bthresher *x ){
#if MSP
  dsp_free( (t_pxobject *) x);
#endif


  freebytes(x->Wanal,0); 
  freebytes(x->Wsyn,0);
  freebytes(x->Hwin,0);
  freebytes(x->buffer,0);
  freebytes(x->channel,0);
  freebytes(x->input,0);
  freebytes(x->output,0);
  freebytes(x->trigland,0); 
  freebytes(x->bitshuffle,0); 
  /* full phase vocoder */
  freebytes(x->c_lastphase_in,0); 
  freebytes(x->c_lastphase_out,0); 
  /* external-specific memory */
  freebytes(x->composite_frame,0);
  freebytes(x->frames_left,0);
  freebytes(x->move_threshold,0);
  freebytes(x->damping_factor,0);
  freebytes(x->list_data,0);
}
Пример #19
0
Файл: lifo.c Проект: jondf/pd
static void lifo_free(t_lifo *x)
{
    freebytes(x->getal, x->size * sizeof(t_float));
}
Пример #20
0
static void mypdlist_free(t_mypdlist *x)
{
  freebytes(x->x_list, x->x_n * sizeof(t_atom)); 
}
Пример #21
0
static void delay_free(t_delay *x)
{
    if (x->x_buf != x->x_bufini) freebytes(x->x_buf, x->x_maxsofar * sizeof(*x->x_buf));
}
Пример #22
0
static void vvminus_lst(t_vvminus *x, t_symbol *s, int argc, t_atom *argv)
{
  t_float *fp;
  t_atom  *ap;
  int n;

  if (argc){
    if (x->n1 != argc) {
      freebytes(x->buf1, x->n1 * sizeof(t_float));
      x->n1 = argc;
      x->buf1=(t_float *)getbytes(sizeof(t_float)*x->n1);
    };
    fp = x->buf1;
    while(argc--)*fp++=atom_getfloat(argv++);
  }

  if (x->n1*x->n2==1){
    outlet_float(x->x_obj.ob_outlet, *x->buf1-*x->buf2);
    return;
  }
  if (x->n1==1){
    t_atom *a;
    int i = x->n2;
    t_float f = *x->buf1;
    fp = x->buf2;
    n = x->n2;
    ap = (t_atom *)getbytes(sizeof(t_atom)*n);
    a = ap;
    while(i--){
      SETFLOAT(a, f-*fp++);
      a++;
    }
  } else if (x->n2==1){
    t_float f = *x->buf2;
    t_atom *a;
    int i = x->n1;
    n = x->n1;
    ap = (t_atom *)getbytes(sizeof(t_atom)*n);
    a = ap;
    fp = x->buf1;
    while(i--){
      SETFLOAT(a, *fp++-f);
      a++;
    }
  } else {
    t_atom *a;
    int i;
    t_float *fp2=x->buf2;
    fp = x->buf1;
    n = x->n1;
    if (x->n1!=x->n2){
      post("scalar multiplication: truncating vectors to the same length");
      if (x->n2<x->n1)n=x->n2;
    }
    ap = (t_atom *)getbytes(sizeof(t_atom)*n);
    a = ap;
    i=n;
    while(i--){
      SETFLOAT(a, *fp++-*fp2++);
      a++;
    }
  }
  outlet_list(x->x_obj.ob_outlet, gensym("list"), n, ap);
  freebytes(ap, sizeof(t_atom)*n);
}
Пример #23
0
static void block_delay_tilde_free(t_block_delay_tilde *x)
{
	if(x->x_begmem)
		freebytes(x->x_begmem, x->x_blocksize * sizeof(t_float));
}
Пример #24
0
static void vvminus_free(t_vvminus *x)
{
  freebytes(x->buf1, sizeof(t_float)*x->n1);
  freebytes(x->buf2, sizeof(t_float)*x->n2);
}
Пример #25
0
static void substitute_anything(t_substitute *x,
				t_symbol *s, int ac, t_atom *av)
{
    int matchndx = substitute_check(x, s, ac, av);
    if (matchndx < -1)
        //if replace type is null or no match found
	substitute_dooutput(x, s, ac, av, 1);
    else
    {
        int replaceonce = x->x_replaceonce;
        int replaced = 0; //if we've replaced something, useful for replaceonce

	int reentered = x->x_entered;
	int prealloc = !reentered;
	int ntotal = ac;
	t_atom *buf;
	t_substitute_proxy *proxy = (t_substitute_proxy *)x->x_proxy;
	x->x_entered = 1;
        //while method is working, point to aux versions so if they change, won't effect
        //currently undergoing replacement scheme
	proxy->p_match = &x->x_auxmatch;
	proxy->p_repl = &x->x_auxrepl;
	if (s == &s_) s = 0;
	if (matchndx == -1)
	{
            //if match type is a symbol AND is the selector 
	    if (x->x_repl.a_type == A_FLOAT)
	    {
                //since we're replacing the selector and it can't be a float,
                //need to add it to the list
		ntotal++;
                //if there's a rest to it, the selector needs to be a list selector
		if (ac) s = &s_list;
                //else there's no "rest of it", can be a float selector
		else s = &s_float;

                replaced = 1;
	    }
	    else if (x->x_repl.a_type == A_SYMBOL)
	    {
                //just replace the selector if the replace type is the symbol
                //set matchndx to 0 to avoid the if in the message contructor clause below
		s = x->x_repl.a_w.w_symbol;
		matchndx = 0;

                replaced = 1;
	    }
	}
	else if (matchndx == 0
		 && (!s || s == &s_list || s == &s_float)
		 && av->a_type == A_FLOAT
		 && x->x_repl.a_type == A_SYMBOL)
	{
            //match index is at the beginning of a list (or singleton)
            //incoming list[0] is a float, being replaced by a symbol
            //just make the selector the replacement
	    s = x->x_repl.a_w.w_symbol;
	    ac--;
	    av++;
	    ntotal = ac;
	}
	if (prealloc && ac > x->x_size)
	{
            //if bigger that maximum size, don't bother allocating to x_message
	    if (ntotal > SUBSTITUTE_MAXSIZE)
		prealloc = 0;
	    else
		x->x_message = grow_nodata(&ntotal, &x->x_size, x->x_message,
					   SUBSTITUTE_INISIZE, x->x_messini,
					   sizeof(*x->x_message));
	}

        //if allocated, just point stack pointer to struct's x_message
        //else just point stack pointer to new allocated memory
	if (prealloc) buf = x->x_message;
	else
	    /* LATER consider using the stack if ntotal <= MAXSTACK */
	    buf = getbytes(ntotal * sizeof(*buf));
	if (buf)
	{
	    int ncopy = ntotal;
	    t_atom *bp = buf;
	    if (matchndx == -1)
	    {
                //only hit if x_repl is a float because of the earlier clause
		SETFLOAT(bp++, x->x_repl.a_w.w_float);
		ncopy--;
	    }
            //copy over incoming list to allocated buf (or x message), do the substitution
	    if (ncopy)
		memcpy(bp, av, ncopy * sizeof(*buf));
	    substitute_doit(x, s, ntotal, buf, matchndx, replaceonce, replaced);
            
            //free newly allocated memory if using it
	    if (buf != x->x_message)
		freebytes(buf, ntotal * sizeof(*buf));
	}
	if (!reentered)
	{
	    x->x_entered = 0;
	    if (x->x_auxmatch.a_type != A_NULL)
	    {
		x->x_match = x->x_auxmatch;
		x->x_auxmatch.a_type = A_NULL;
	    }
	    if (x->x_auxrepl.a_type != A_NULL)
	    {
		x->x_repl = x->x_auxrepl;
		x->x_auxrepl.a_type = A_NULL;
	    }
	    proxy->p_match = &x->x_match;
	    proxy->p_repl = &x->x_repl;
	}
    }
}
Пример #26
0
static void dollarg_free(t_dollarg *x)
{
  if(x->x_ac)
    freebytes(x->x_at, x->x_ac * sizeof(t_atom));
}
Пример #27
0
static void spec2_block_delay_tilde_free(t_spec2_block_delay_tilde *x)
{
    if(x->x_begmem)
        freebytes(x->x_begmem, (x->x_blocksize+1) * sizeof(t_float));
}
Пример #28
0
static void env_tilde_ff(t_sigenv *x)           /* cleanup on free */
{
    clock_free(x->x_clock);
    freebytes(x->x_buf, (x->x_npoints + x->x_allocforvs) * sizeof(*x->x_buf));
}
Пример #29
0
static void sigdelwrite_free(t_sigdelwrite *x)
{
    pd_unbind(&x->x_obj.ob_pd, x->x_sym);
    freebytes(x->x_cspace.c_vec,
              (x->x_cspace.c_n + XTRASAMPS) * sizeof(t_sample));
}
Пример #30
0
void connect_notify(t_connect *x, t_symbol *s, t_symbol *msg, void *sender, void *data)
{	
	int i, j, k, tabcheck;
	if (msg == gensym("attr_modified") && sender == x->f_patcherview) 
	{
		t_symbol *attrname;
		attrname = (t_symbol *)object_method(data, gensym("getname"));
			
		if (attrname == gensym("selectedboxes")) {
			t_atom *av = NULL;
			long current_nb_selected = 0;
			
			object_attr_getvalueof(sender, attrname, &current_nb_selected, &av);
			if (current_nb_selected && av) 
			{				
				// on supprime tous les objets du tableau qui ne sont plus dans la selection
				if(x->f_nbSelected < 0)
					x->f_nbSelected = 0;
				if(current_nb_selected < x->f_nbSelected)
				{
					for(i = 0 ; i < current_nb_selected ; i++)
					{
						tabcheck = 0;
						for(j = 0; j < x->f_nbSelected; j++)
						{
							if (atom_gettype(av+i) == A_OBJ && x->f_object[j] == (t_object*)atom_getobj(av+i)) 
							{	
								tabcheck = 1;
								break;
							}
						}
						
						if (!tabcheck)
							x->f_object[j] = NULL;
					}
				
					// puis on retrie le tableau
					for(i = 0; i < x->f_nbSelected; i++)
					{
						if (x->f_object[i] == NULL)
						{
							for(k = i; k < x->f_nbSelected; k++)
								x->f_object[k] = x->f_object[k+1];
							
							x->f_nbSelected--;
							break;
						}
					}
				}
				else if(current_nb_selected > x->f_nbSelected)
				{
					for(i = 0 ; i < current_nb_selected ; i++)
					{
						tabcheck = 0;
						for(j = 0; j < x->f_nbSelected; j++)
						{
							if (atom_gettype(av+i) == A_OBJ && x->f_object[j] == (t_object*)atom_getobj(av+i)) 
							{	
								tabcheck = 1;
							}
						}
						
						if (!tabcheck)
							x->f_object[x->f_nbSelected] = (t_object*)atom_getobj(av+i);
					}
					x->f_nbSelected++;
				}
			}
			freebytes(av, sizeof(t_atom) * current_nb_selected);
		}			
	}


	if (msg == gensym("startdrag"))
	{
		if (jkeyboard_getcurrentmodifiers() != 18) // shift key
		{
			for(i = 0; i < CONNECT_MAX_TAB; i++)
				x->f_object[i] = NULL;
			
			x->f_nbSelected = 0;
		}
	}
}