[PD-cvs] pd/src builtins_dsp.c,1.1.2.5,1.1.2.6

Mathieu Bouchard matju at users.sourceforge.net
Wed Jan 3 23:15:22 CET 2007


Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3807

Modified Files:
      Tag: desiredata
	builtins_dsp.c 
Log Message:
added macros DSPNEW and DSPDSP


Index: builtins_dsp.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/Attic/builtins_dsp.c,v
retrieving revision 1.1.2.5
retrieving revision 1.1.2.6
diff -C2 -d -r1.1.2.5 -r1.1.2.6
*** builtins_dsp.c	3 Jan 2007 21:46:15 -0000	1.1.2.5
--- builtins_dsp.c	3 Jan 2007 22:15:19 -0000	1.1.2.6
***************
*** 14,20 ****
--- 14,49 ----
  #include "m_pd.h"
  #include "m_simd.h"
+ #include "s_stuff.h"
+ #include <math.h>
+ #include <stdio.h>
+ #include <string.h>
+ extern "C" int ugen_getsortno(void);
+ #define DEFDELVS 64             /* LATER get this from canvas at DSP time */
+ #ifdef HAVE_LIBFFTW3F
+ #include <fftw3.h>
+ #endif
+ #define DEFSENDVS 64    /* LATER get send to get this from canvas */
+ #define LOGTEN 2.302585092994
+ #define UNITBIT32 1572864.  /* 3*2^19; bit 32 has place value 1 */
+ #define int32 int
+ #ifdef BIGENDIAN
+ #define HIOFFSET 0    /* word offset to find MSB */
+ #define LOWOFFSET 1    /* word offset to find LSB */
+ #else
+ #define HIOFFSET 1
+ #define LOWOFFSET 0
+ #endif
+ 
+ #undef CLASS_MAINSIGNALIN
+ /* because C++ bitches about null pointers, we'll use 8 instead (really): */
+ #define CLASS_MAINSIGNALIN(c, type, field) class_domainsignalin(c, (char *)(&((type *)8)->field) - (char *)8)
  
  /* ----------------------------- plus ----------------------------- */
  static t_class *plus_class, *scalarplus_class;
+ static t_class *minus_class, *scalarminus_class;
+ static t_class *times_class, *scalartimes_class;
+ static t_class *over_class, *scalarover_class;
+ static t_class *max_class, *scalarmax_class;
+ static t_class *min_class, *scalarmin_class;
  
  struct t_dop : t_object {
***************
*** 24,48 ****
  
  typedef t_dop t_plus, t_scalarplus;
  
! static void *plus_new(t_symbol *s, int argc, t_atom *argv)
! {
!     if (argc > 1) post("+~: extra arguments ignored");
!     if (argc) 
!     {
!         t_scalarplus *x = (t_scalarplus *)pd_new(scalarplus_class);
!         floatinlet_new(x, &x->b);
!         x->b = atom_getfloatarg(0, argc, argv);
!         outlet_new(x, &s_signal);
!         x->a = 0;
!         return (x);
!     }
!     else
!     {
!         t_plus *x = (t_plus *)pd_new(plus_class);
!         inlet_new(x, x, &s_signal, &s_signal);
!         outlet_new(x, &s_signal);
!         x->a = 0;
!         return (x);
!     }
  }
  
--- 53,94 ----
  
  typedef t_dop t_plus, t_scalarplus;
+ typedef t_dop t_min, t_scalarmin;
+ typedef t_dop t_max, t_scalarmax;
+ typedef t_dop t_over, t_scalarover;
+ typedef t_dop t_times, t_scalartimes;
+ typedef t_dop t_minus, t_scalarminus;
  
! #define DSPNEW(NAME) \
! static void *NAME##_new(t_symbol *s, int argc, t_atom *argv) { \
!     if (argc > 1) error("extra arguments ignored"); \
!     t_dop *x = (t_dop *)pd_new(argc ? scalar##NAME##_class : NAME##_class); \
!     if (argc) { \
!         floatinlet_new(x, &x->b); \
!         x->b = atom_getfloatarg(0, argc, argv); \
!     } else inlet_new(x, x, &s_signal, &s_signal); \
!     outlet_new(x, &s_signal); \
!     x->a = 0; \
!     return x;}
! 
! #define DSPDSP(NAME) \
! static void NAME##_dsp(t_minus *x, t_signal **sp) { \
! 	const int n = sp[0]->s_n; \
!     if(n&7) \
!     	dsp_add(NAME##_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); \
! 	else if(SIMD_CHECK3(n,sp[0]->s_vec,sp[1]->s_vec,sp[2]->s_vec)) \
!     	dsp_add(NAME##_perf_simd, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); \
!     else         \
!     	dsp_add(NAME##_perf8, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n); \
! }\
! \
! static void scalar##NAME##_dsp(t_scalarminus *x, t_signal **sp) \
! { \
!  	const int n = sp[0]->s_n;\
!     if(n&7)\
!     	dsp_add(scalar##NAME##_perform, 4, sp[0]->s_vec, &x->b,sp[1]->s_vec, n);\
! 	else if(SIMD_CHECK2(n,sp[0]->s_vec,sp[1]->s_vec))\
!     	dsp_add(scalar##NAME##_perf_simd, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);\
!     else        \
!     	dsp_add(scalar##NAME##_perf8, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);\
  }
  
***************
*** 85,125 ****
      return w+5;}
  
! PERFORM(plus,a+b)
! PERFORM(minus,a-b)
! PERFORM(times,a*b)
! //PERFORM(over,a/b)
! PERFORM(min,a<b?a:b)
! PERFORM(max,a>b?a:b)
! 
! void dsp_add_plus(t_sample *in1, t_sample *in2, t_sample *out, int n)
! {
!     if (n&7)
!         dsp_add(plus_perform, 4, in1, in2, out, n);
!     else if(SIMD_CHECK3(n,in1,in2,out))
!     	dsp_add(plus_perf_simd, 4, in1, in2, out, n);
!     else        
!         dsp_add(plus_perf8, 4, in1, in2, out, n);
! }
! 
! static void plus_dsp(t_plus *x, t_signal **sp)
! {
!     dsp_add_plus(sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[0]->s_n);
! }
  
! static void scalarplus_dsp(t_scalarplus *x, t_signal **sp)
! {
! 	const int n = sp[0]->s_n;
!     if(n&7)
!     	dsp_add(scalarplus_perform, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);
! 	else if(SIMD_CHECK2(n,sp[0]->s_vec,sp[1]->s_vec))
!     	dsp_add(scalarplus_perf_simd, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);
!     else        
!     	dsp_add(scalarplus_perf8, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);
  }
  
- #undef CLASS_MAINSIGNALIN
- /* because C++ bitches about null pointers, we'll use 8 instead (really): */
- #define CLASS_MAINSIGNALIN(c, type, field) class_domainsignalin(c, (char *)(&((type *)8)->field) - (char *)8)
- 
  static void plus_setup(void)
  {
--- 131,147 ----
      return w+5;}
  
! PERFORM(plus ,a+b)    DSPNEW(plus)  DSPDSP(plus)
! PERFORM(minus,a-b)    DSPNEW(minus) DSPDSP(minus)
! PERFORM(times,a*b)    DSPNEW(times) /*DSPDSP(times)*/
! /*PERFORM(over,a/b)*/ DSPNEW(over)  DSPDSP(over)
! PERFORM(min ,a<b?a:b) DSPNEW(min)   DSPDSP(min)
! PERFORM(max ,a>b?a:b) DSPNEW(max)   DSPDSP(max)
  
! void dsp_add_plus(t_sample *in1, t_sample *in2, t_sample *out, int n) {
!     if (n&7)                            dsp_add(plus_perform,   4, in1, in2, out, n);
!     else if(SIMD_CHECK3(n,in1,in2,out)) dsp_add(plus_perf_simd, 4, in1, in2, out, n);
!     else                                dsp_add(plus_perf8,     4, in1, in2, out, n);
  }
  
  static void plus_setup(void)
  {
***************
*** 137,189 ****
  }
  
- /* ----------------------------- minus ----------------------------- */
- static t_class *minus_class, *scalarminus_class;
- 
- typedef t_dop t_minus, t_scalarminus;
- 
- static void *minus_new(t_symbol *s, int argc, t_atom *argv)
- {
-     if (argc > 1) post("-~: extra arguments ignored");
-     if (argc) 
-     {
-         t_scalarminus *x = (t_scalarminus *)pd_new(scalarminus_class);
-         floatinlet_new(x, &x->b);
-         x->b = atom_getfloatarg(0, argc, argv);
-         outlet_new(x, &s_signal);
-         x->a = 0;
-         return (x);
-     }
-     else
-     {
-         t_minus *x = (t_minus *)pd_new(minus_class);
-         inlet_new(x, x, &s_signal, &s_signal);
-         outlet_new(x, &s_signal);
-         x->a = 0;
-         return (x);
-     }
- }
- 
- static void minus_dsp(t_minus *x, t_signal **sp)
- {
- 	const int n = sp[0]->s_n;
-     if(n&7)
-     	dsp_add(minus_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n);
- 	else if(SIMD_CHECK3(n,sp[0]->s_vec,sp[1]->s_vec,sp[2]->s_vec))
-     	dsp_add(minus_perf_simd, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n);
-     else        
-     	dsp_add(minus_perf8, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n);
- }
- 
- static void scalarminus_dsp(t_scalarminus *x, t_signal **sp)
- {
- 	const int n = sp[0]->s_n;
-     if(n&7)
-     	dsp_add(scalarminus_perform, 4, sp[0]->s_vec, &x->b,sp[1]->s_vec, n);
- 	else if(SIMD_CHECK2(n,sp[0]->s_vec,sp[1]->s_vec))
-     	dsp_add(scalarminus_perf_simd, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);
-     else        
-     	dsp_add(scalarminus_perf8, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);
- }
- 
  static void minus_setup(void)
  {
--- 159,162 ----
***************
*** 201,232 ****
  }
  
- /* ----------------------------- times ----------------------------- */
- 
- static t_class *times_class, *scalartimes_class;
- 
- typedef struct t_dop t_times, t_scalartimes;
- 
- static void *times_new(t_symbol *s, int argc, t_atom *argv)
- {
-     if (argc > 1) post("*~: extra arguments ignored");
-     if (argc) 
-     {
-         t_scalartimes *x = (t_scalartimes *)pd_new(scalartimes_class);
-         floatinlet_new(x, &x->b);
-         x->b = atom_getfloatarg(0, argc, argv);
-         outlet_new(x, &s_signal);
-         x->a = 0;
-         return (x);
-     }
-     else
-     {
-         t_times *x = (t_times *)pd_new(times_class);
-         inlet_new(x, x, &s_signal, &s_signal);
-         outlet_new(x, &s_signal);
-         x->a = 0;
-         return (x);
-     }
- }
- 
  /* T.Grill - squaring: optimized * for equal input signals */
  t_int *sqr_perf8(t_int *w)
--- 174,177 ----
***************
*** 296,326 ****
  }
  
- /* ----------------------------- over ----------------------------- */
- static t_class *over_class, *scalarover_class;
- 
- typedef t_dop t_over, t_scalarover;
- 
- static void *over_new(t_symbol *s, int argc, t_atom *argv)
- {
-     if (argc > 1) post("/~: extra arguments ignored");
-     if (argc) 
-     {
-         t_scalarover *x = (t_scalarover *)pd_new(scalarover_class);
-         floatinlet_new(x, &x->b);
-         x->b = atom_getfloatarg(0, argc, argv);
-         outlet_new(x, &s_signal);
-         x->a = 0;
-         return (x);
-     }
-     else
-     {
-         t_over *x = (t_over *)pd_new(over_class);
-         inlet_new(x, x, &s_signal, &s_signal);
-         outlet_new(x, &s_signal);
-         x->a = 0;
-         return (x);
-     }
- }
- 
  t_int *over_perform(t_int *w)
  {
--- 241,244 ----
***************
*** 393,418 ****
  }
  
- static void over_dsp(t_over *x, t_signal **sp)
- {
- 	const int n = sp[0]->s_n;
-     if (n&7)
-     	dsp_add(over_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n);
- 	else if(SIMD_CHECK3(n,sp[0]->s_vec,sp[1]->s_vec,sp[2]->s_vec))
-     	dsp_add(over_perf_simd, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n);
-     else        
-     	dsp_add(over_perf8, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n);
- }
- 
- static void scalarover_dsp(t_scalarover *x, t_signal **sp)
- {
- 	const int n = sp[0]->s_n;
-     if (n&7)
-     	dsp_add(scalarover_perform, 4, sp[0]->s_vec, &x->b,sp[1]->s_vec, n);
- 	else if(SIMD_CHECK2(n,sp[0]->s_vec,sp[1]->s_vec))
-     	dsp_add(scalarover_perf_simd, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);
-     else        
-     	dsp_add(scalarover_perf8, 4, sp[0]->s_vec, &x->b,sp[1]->s_vec, n);
- }
- 
  static void over_setup(void)
  {
--- 311,314 ----
***************
*** 430,483 ****
  }
  
- /* ----------------------------- max ----------------------------- */
- static t_class *max_class, *scalarmax_class;
- 
- typedef t_dop t_max, t_scalarmax;
- 
- static void *max_new(t_symbol *s, int argc, t_atom *argv)
- {
-     if (argc > 1) post("max~: extra arguments ignored");
-     if (argc) 
-     {
-         t_scalarmax *x = (t_scalarmax *)pd_new(scalarmax_class);
-         floatinlet_new(x, &x->b);
-         x->b = atom_getfloatarg(0, argc, argv);
-         outlet_new(x, &s_signal);
-         x->a = 0;
-         return (x);
-     }
-     else
-     {
-         t_max *x = (t_max *)pd_new(max_class);
-         inlet_new(x, x, &s_signal, &s_signal);
-         outlet_new(x, &s_signal);
-         x->a = 0;
-         return (x);
-     }
- }
- 
- 
- static void max_dsp(t_max *x, t_signal **sp)
- {
-     const int n = sp[0]->s_n;
-     if(n&7)
-     	dsp_add(max_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n);
- 	else if(SIMD_CHECK3(n,sp[0]->s_vec,sp[1]->s_vec,sp[2]->s_vec))
-     	dsp_add(max_perf_simd, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n);
-     else        
-     	dsp_add(max_perf8, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n);
- }
- 
- static void scalarmax_dsp(t_scalarmax *x, t_signal **sp)
- {
- 	const int n = sp[0]->s_n;
-     if (n&7)
-     	dsp_add(scalarmax_perform, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);
- 	else if(SIMD_CHECK2(n,sp[0]->s_vec,sp[1]->s_vec))
-     	dsp_add(scalarmax_perf_simd, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);
-     else        
-     	dsp_add(scalarmax_perf8, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);
- }
- 
  static void max_setup(void)
  {
--- 326,329 ----
***************
*** 495,547 ****
  }
  
- /* ----------------------------- min ----------------------------- */
- static t_class *min_class, *scalarmin_class;
- 
- typedef t_dop t_min, t_scalarmin;
- 
- static void *min_new(t_symbol *s, int argc, t_atom *argv)
- {
-     if (argc > 1) post("min~: extra arguments ignored");
-     if (argc) 
-     {
-         t_scalarmin *x = (t_scalarmin *)pd_new(scalarmin_class);
-         floatinlet_new(x, &x->b);
-         x->b = atom_getfloatarg(0, argc, argv);
-         outlet_new(x, &s_signal);
-         x->a = 0;
-         return (x);
-     }
-     else
-     {
-         t_min *x = (t_min *)pd_new(min_class);
-         inlet_new(x, x, &s_signal, &s_signal);
-         outlet_new(x, &s_signal);
-         x->a = 0;
-         return (x);
-     }
- }
- 
- static void min_dsp(t_min *x, t_signal **sp)
- {
-     const int n = sp[0]->s_n;
-     if(n&7)
-     	dsp_add(min_perform, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n);
- 	else if(SIMD_CHECK3(n,sp[0]->s_vec,sp[1]->s_vec,sp[2]->s_vec))
-     	dsp_add(min_perf_simd, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n);
-     else        
-     	dsp_add(min_perf8, 4, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, n);
- }
- 
- static void scalarmin_dsp(t_scalarmin *x, t_signal **sp)
- {
- 	const int n = sp[0]->s_n;
-     if (n&7)
-     	dsp_add(scalarmin_perform, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);
- 	else if(SIMD_CHECK2(n,sp[0]->s_vec,sp[1]->s_vec))
-     	dsp_add(scalarmin_perf_simd, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);
-     else        
-     	dsp_add(scalarmin_perf8, 4, sp[0]->s_vec, &x->b, sp[1]->s_vec, n);
- }
- 
  static void min_setup(void)
  {
--- 341,344 ----
***************
*** 559,573 ****
  }
  
- /* Copyright (c) 1997-1999 Miller Puckette and others.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
- 
- /* sampling */
- 
- /* LATER make tabread4 and tabread~ */
- 
- #include "m_pd.h"
- #include "m_simd.h"
- 
  /* ------------------------- tabwrite~ -------------------------- */
  
--- 356,359 ----
***************
*** 1595,1612 ****
  }
  
- /* Copyright (c) 1997-1999 Miller Puckette.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
- 
- /*  sig~ and line~ control-to-signal converters;
-     snapshot~ signal-to-control converter.
- */
- 
- #include "m_pd.h"
- #include "math.h"
- 
- /* T.Grill - include SIMD functionality */
- #include "m_simd.h"
- 
  /* -------------------------- sig~ ------------------------------ */
  static t_class *sig_tilde_class;
--- 1381,1384 ----
***************
*** 2581,2597 ****
  }
  
- /* Copyright (c) 1997-1999 Miller Puckette.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
- 
- /*  The dac~ and adc~ routines.
- */
- 
- #include "m_pd.h"
- #include "s_stuff.h"
- 
- /* T.Grill - include SIMD functionality */
- #include "m_simd.h"
- 
  /* ----------------------------- dac~ --------------------------- */
  static t_class *dac_class;
--- 2353,2356 ----
***************
*** 2767,2784 ****
  }
  
- /* Copyright (c) 1997-1999 Miller Puckette.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
- 
- /*  send~, delread~, throw~, catch~ */
- 
- #include "m_pd.h"
- 
- #include "m_simd.h"
- 
- extern "C" int ugen_getsortno(void);
- 
- #define DEFDELVS 64             /* LATER get this from canvas at DSP time */
- 
  /* ----------------------------- delwrite~ ----------------------------- */
  static t_class *sigdelwrite_class;
--- 2526,2529 ----
***************
*** 3206,3220 ****
  }
  
- /* Copyright (c) 1997-1999 Miller Puckette and others.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
- 
- #include "m_pd.h"
- 
- #ifdef HAVE_LIBFFTW3F
- #include "fftw3.h"
- #include <string.h>
- #endif
- 
  #ifndef HAVE_LIBFFTW3F
  /* ------------------------ fft~ and ifft~ -------------------------------- */
--- 2951,2954 ----
***************
*** 3785,3797 ****
  }
  
- /* Copyright (c) 1997-1999 Miller Puckette.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
- 
- /*  "filters", both linear and nonlinear. 
- */
- #include "m_pd.h"
- #include <math.h>
- 
  /* ---------------- hip~ - 1-pole 1-zero hipass filter. ----------------- */
  
--- 3519,3522 ----
***************
*** 4872,4887 ****
  }
  
- /* Copyright (c) 1997-1999 Miller Puckette.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
- 
- /*  send~, receive~, throw~, catch~ */
- 
- #include "m_pd.h"
- #include "m_simd.h"
- #include <string.h>
- 
- #define DEFSENDVS 64    /* LATER get send to get this from canvas */
- 
  /* ----------------------------- send~ ----------------------------- */
  static t_class *sigsend_class;
--- 4597,4600 ----
***************
*** 5228,5246 ****
  }
  
- /* Copyright (c) 1997-2001 Miller Puckette and others.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
- 
- /*  mathematical functions and other transfer functions, including tilde
-     versions of stuff from acoustics.c.
- */
- 
- #include "m_pd.h"
- #include <math.h>
- #define LOGTEN 2.302585092994
- 
- /* T.Grill - use SIMD functionality */
- #include "m_simd.h"
- 
  /* ------------------------- clip~ -------------------------- */
  static t_class *clip_class;
--- 4941,4944 ----
***************
*** 5770,5784 ****
  }
  
- /* Copyright (c) 1997-1999 Miller Puckette.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
- 
- /*  miscellaneous: print~; more to come.
- */
- 
- #include "m_pd.h"
- #include <stdio.h>
- #include <string.h>
- 
  /* ------------------------- print~ -------------------------- */
  static t_class *print_class;
--- 5468,5471 ----
***************
*** 5895,5919 ****
  }
  
- /* Copyright (c) 1997-1999 Miller Puckette.
- * For information on usage and redistribution, and for a DISCLAIMER OF ALL
- * WARRANTIES, see the file, "LICENSE.txt," in this distribution.  */
- 
- /* sinusoidal oscillator and table lookup; see also tabosc4~ in d_array.c.
- */
- 
- #include "m_pd.h"
- #include "math.h"
- 
- #define UNITBIT32 1572864.  /* 3*2^19; bit 32 has place value 1 */
- 
- #define int32 int
- #ifdef BIGENDIAN
- #define HIOFFSET 0    /* word offset to find MSB */
- #define LOWOFFSET 1    /* word offset to find LSB */
- #else
- #define HIOFFSET 1
- #define LOWOFFSET 0
- #endif
- 
  /* -------------------------- phasor~ ------------------------------ */
  static t_class *phasor_class;
--- 5582,5585 ----
***************
*** 6195,6202 ****
  
  struct t_vcfctl {
!     float c_re;
!     float c_im;
!     float c_q;
!     float c_isr;
  };
  
--- 5861,5868 ----
  
  struct t_vcfctl {
!     float re;
!     float im;
!     float q;
!     float isr;
  };
  
***************
*** 6217,6224 ****
      outlet_new(x, gensym("signal"));
      x->ctl = &x->cspace;
!     x->cspace.c_re = 0;
!     x->cspace.c_im = 0;
!     x->cspace.c_q = q;
!     x->cspace.c_isr = 0;
      x->a = 0;
      return (x);
--- 5883,5890 ----
      outlet_new(x, gensym("signal"));
      x->ctl = &x->cspace;
!     x->cspace.re = 0;
!     x->cspace.im = 0;
!     x->cspace.q = q;
!     x->cspace.isr = 0;
      x->a = 0;
      return (x);
***************
*** 6227,6231 ****
  static void sigvcf_ft1(t_sigvcf *x, t_floatarg f)
  {
!     x->ctl->c_q = (f > 0 ? f : 0.f);
  }
  
--- 5893,5897 ----
  static void sigvcf_ft1(t_sigvcf *x, t_floatarg f)
  {
!     x->ctl->q = (f > 0 ? f : 0.f);
  }
  
***************
*** 6239,6248 ****
      int n = (t_int)(w[6]);
      int i;
!     float re = c->c_re, re2;
!     float im = c->c_im;
!     float q = c->c_q;
      float qinv = (q > 0? 1.0f/q : 0);
      float ampcorrect = 2.0f - 2.0f / (q + 2.0f);
!     float isr = c->c_isr;
      float coefr, coefi;
      float *tab = cos_table, *addr, f1, f2, frac;
--- 5905,5914 ----
      int n = (t_int)(w[6]);
      int i;
!     float re = c->re, re2;
!     float im = c->im;
!     float q = c->q;
      float qinv = (q > 0? 1.0f/q : 0);
      float ampcorrect = 2.0f - 2.0f / (q + 2.0f);
!     float isr = c->isr;
      float coefr, coefi;
      float *tab = cos_table, *addr, f1, f2, frac;
***************
*** 6288,6293 ****
      if (PD_BIGORSMALL(im))
          im = 0;
!     c->c_re = re;
!     c->c_im = im;
      return (w+7);
  }
--- 5954,5959 ----
      if (PD_BIGORSMALL(im))
          im = 0;
!     c->re = re;
!     c->im = im;
      return (w+7);
  }
***************
*** 6295,6299 ****
  static void sigvcf_dsp(t_sigvcf *x, t_signal **sp)
  {
!     x->ctl->c_isr = 6.28318f/sp[0]->s_sr;
      dsp_add(sigvcf_perform, 6,
          sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, 
--- 5961,5965 ----
  static void sigvcf_dsp(t_sigvcf *x, t_signal **sp)
  {
!     x->ctl->isr = 6.28318f/sp[0]->s_sr;
      dsp_add(sigvcf_perform, 6,
          sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec, 





More information about the Pd-cvs mailing list