[PD-cvs] externals/mrpeach/sqosc~ sqosc~.c,1.2,1.3

Martin Peach mrpeach at users.sourceforge.net
Tue Apr 10 05:08:31 CEST 2007


Update of /cvsroot/pure-data/externals/mrpeach/sqosc~
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv26023

Modified Files:
	sqosc~.c 
Log Message:
Cleaned up, should compile under Darwin



Index: sqosc~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/mrpeach/sqosc~/sqosc~.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** sqosc~.c	29 Mar 2007 02:41:10 -0000	1.2
--- sqosc~.c	10 Apr 2007 03:08:29 -0000	1.3
***************
*** 66,72 ****
  };
  
! static t_class *sqosc_class, *scalarsqosc_class;
  
- static float *sqosc_table;
  /* COSTABSIZE is 512 in m_pd.h, we start with that... */
  #define LOGSQOSCTABSIZE 9
--- 66,71 ----
  };
  
! static t_class *sqosc_class;
  
  /* COSTABSIZE is 512 in m_pd.h, we start with that... */
  #define LOGSQOSCTABSIZE 9
***************
*** 87,91 ****
  } t_sqosc;
  
- static void sqosc_maketable(void);
  void sqosc_tilde_setup(void);
  static void sqosc_ft1(t_sqosc *x, t_float f);
--- 86,89 ----
***************
*** 95,118 ****
  static void *sqosc_new(t_floatarg f, t_floatarg pw, t_float bw);
  
- static void sqosc_maketable(void)
- {
-     int    i;
-     float  *fp, phase, phsinc = (2. * 3.14159) / SQOSCTABSIZE; 
-     union  tabfudge tf;
- 
-     if (sqosc_table) return;
-     sqosc_table = (float *)getbytes(sizeof(float) * (SQOSCTABSIZE+1));
-     for (i = SQOSCTABSIZE + 1, fp = sqosc_table, phase = 0; i--;
-         fp++, phase += phsinc)
-     {
-         *fp = cos(phase);
-     }
-     /* here we check at startup whether the byte alignment
-         is as we declared it.  If not, the code has to be
-         recompiled the other way. */
-     tf.tf_d = UNITBIT32 + 0.5;
-     if ((unsigned)tf.tf_i[LOWOFFSET] != 0x80000000)
-         bug("cos~: unexpected machine alignment");
- }
  
  static void *sqosc_new(t_floatarg f, t_floatarg pw, t_floatarg bw)
--- 93,96 ----
***************
*** 221,225 ****
      t_float         sample;
      int             n = (int)(w[4]);
!     float           *tab = sqosc_table, *addr, f1, f2, frac;
      int             index;  
      double          dphase = x->x_phase + UNITBIT32;
--- 199,203 ----
      t_float         sample;
      int             n = (int)(w[4]);
!     float           *addr, f1, f2, frac;
      int             index;  
      double          dphase = x->x_phase + UNITBIT32;
***************
*** 341,345 ****
      else f2 = -twothirds;
      sample = f1 + frac * (f2 - f1); /* the final sample */
!     if (_finite(sample))*out++ = sample;
      else *out++ = 0.0;
  
--- 319,323 ----
      else f2 = -twothirds;
      sample = f1 + frac * (f2 - f1); /* the final sample */
!     if (finite(sample))*out++ = sample;
      else *out++ = 0.0;
  
***************
*** 380,384 ****
      class_addmethod(sqosc_class, (t_method)sqosc_pw, gensym("pw"), A_FLOAT, 0);
  
-     sqosc_maketable(); /* make the same table as cos_table */
  }
  
--- 358,361 ----





More information about the Pd-cvs mailing list