[PD-cvs] externals/zexy/src z_sigmatrix.c,1.2,1.3

IOhannes m zmölnig zmoelnig at users.sourceforge.net
Tue Oct 12 09:19:26 CEST 2004


Update of /cvsroot/pure-data/externals/zexy/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv18872

Modified Files:
	z_sigmatrix.c 
Log Message:
fixed a bug with sharing signal pointers (thanks tim)


Index: z_sigmatrix.c
===================================================================
RCS file: /cvsroot/pure-data/externals/zexy/src/z_sigmatrix.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** z_sigmatrix.c	18 Jun 2003 13:59:37 -0000	1.2
--- z_sigmatrix.c	12 Oct 2004 07:19:23 -0000	1.3
***************
*** 314,328 ****
    t_float **out;
  
-   int changed;
-   int oldout;
  } t_demux;
  
  static void demux_output(t_demux *x, t_floatarg f)
  {
!   if ((f>=0)&&(f<x->n_out)&&((int)f!=x->output)){
!     x->oldout=x->output;
      x->output=f;
!     x->changed=1;
!   }
  }
  
--- 314,325 ----
    t_float **out;
  
  } t_demux;
  
  static void demux_output(t_demux *x, t_floatarg f)
  {
!   if ((f>=0)&&(f<x->n_out)){
      x->output=f;
!   } else
!     error("demultiplex: %d is channel out of range (0..%d)", (int)f, x->n_out);
  }
  
***************
*** 334,360 ****
    int N = (int)(w[3]);
    int n = N;
-   
-   t_float *out = x->out[x->output];
  
-   if(x->changed){
-     t_float *oldout=x->out[x->oldout];
-     x->changed=0;
  
!     if (out!=in)
!       while(n--){
! 	*out++=*in;
! 	*in++=*oldout++=0;
!       }
!     else
!       while(n--)*oldout++=0;
  
-   } else { /* !changed */
-     if (out!=in)
-       while(n--){
- 	*out++=*in;
- 	*in++=0;
-       }
-   }
  
    return (w+4);
  }
--- 331,347 ----
    int N = (int)(w[3]);
    int n = N;
  
  
!   int channel=x->n_out;
  
  
+   while(channel--){
+     t_float*out=x->out[channel];
+     n=N;
+     if(x->output==channel){
+       while(n--)*out++=*in++;
+     } else
+       while(n--)*out++=0.f;
+   }
    return (w+4);
  }
***************
*** 427,442 ****
    int n_in;
    t_float **in;
- 
-   int changed;
-   int oldin;
  } t_mux;
  
  static void mux_input(t_mux *x, t_floatarg f)
  {
!   if ((f>=0)&&(f<x->n_in)&&((int)f!=x->input)){
!     x->oldin=x->input;
      x->input=f;
!     x->changed=1;
!   }
  }
  
--- 414,426 ----
    int n_in;
    t_float **in;
  } t_mux;
  
  static void mux_input(t_mux *x, t_floatarg f)
  {
!   if ((f>=0)&&(f<x->n_in)){
      x->input=f;
!   } else
!     error("multiplex: %d is channel out of range (0..%d)", (int)f, x->n_in);
! 
  }
  
***************
*** 447,470 ****
    int n = (int)(w[3]);
    
!   t_float *in;
!   
!   in = x->in[x->input];
  
-   if(x->changed){
-     t_float *oldin=x->in[x->oldin];
-     x->changed=0;
-     if (in!=out)
-       while(n--){
- 	*out++=*in;
- 	*in++=*oldin++=0;
-       }
-     else while(n--)*oldin++=0;
-   } else {
-     if (in!=out)
-       while(n--){
- 	*out++=*in;
- 	*in++=0;
-       }
-   }
    return (w+4);
  }
--- 431,438 ----
    int n = (int)(w[3]);
    
!   t_float *in = x->in[x->input];
! 
!   while(n--)*out++=*in++;
  
    return (w+4);
  }





More information about the Pd-cvs mailing list