[PD-cvs] externals/ggee/filters bandpass.c, 1.1.1.1, 1.2 equalizer.c, 1.2, 1.3 highpass.c, 1.1.1.1, 1.2 highshelf.c, 1.1.1.1, 1.2 hlshelf.c, 1.1.1.1, 1.2 lowpass.c, 1.1.1.1, 1.2 lowshelf.c, 1.1.1.1, 1.2 moog~.c, 1.2, 1.3 notch.c, 1.1.1.1, 1.2

Hans-Christoph Steiner eighthave at users.sourceforge.net
Mon Nov 14 22:59:11 CET 2005


Update of /cvsroot/pure-data/externals/ggee/filters
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv8684/filters

Modified Files:
	bandpass.c equalizer.c highpass.c highshelf.c hlshelf.c 
	lowpass.c lowshelf.c moog~.c notch.c 
Log Message:
these pragmas are only used for MSVC, not MinGW or Cygwin, therefore changing the define from NT to _MSC_VER

Index: equalizer.c
===================================================================
RCS file: /cvsroot/pure-data/externals/ggee/filters/equalizer.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** equalizer.c	26 Nov 2002 09:06:36 -0000	1.2
--- equalizer.c	14 Nov 2005 21:59:08 -0000	1.3
***************
*** 1,89 ****
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef NT
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! 
! 
! /* ------------------- equ ----------------------------*/
! static t_class *equ_class;
! 
! void equ_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float alpha = e_alpha(x->x_bw*0.01,omega);
!      t_float b0 = 1 + alpha*e_A(x->x_gain);
!      t_float b1 = -2.*cos(omega);
!      t_float b2 = 1 - alpha*e_A(x->x_gain);
!      t_float a0 = 1 + alpha/e_A(x->x_gain);
!      t_float a1 = -2.*cos(omega);
!      t_float a2 = 1 - alpha/e_A(x->x_gain);
! 
! /*      post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("equ: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void equ_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      equ_bang(x);
! }
! 
! 
! static void *equ_new(t_floatarg f,t_floatarg g,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(equ_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
!     floatinlet_new(&x->x_obj, &x->x_gain);    
!     floatinlet_new(&x->x_obj, &x->x_bw);
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     if (g != 0.) x->x_gain = g;
!     return (x);
! }
! 
! 
! void equalizer_setup(void)
! {
!     equ_class = class_new(gensym("equalizer"), (t_newmethod)equ_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(equ_class,equ_bang);
!     class_addfloat(equ_class,equ_float);
! }
! 
! 
! 
! 
! 
--- 1,89 ----
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef _MSC_VER
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! 
! 
! /* ------------------- equ ----------------------------*/
! static t_class *equ_class;
! 
! void equ_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float alpha = e_alpha(x->x_bw*0.01,omega);
!      t_float b0 = 1 + alpha*e_A(x->x_gain);
!      t_float b1 = -2.*cos(omega);
!      t_float b2 = 1 - alpha*e_A(x->x_gain);
!      t_float a0 = 1 + alpha/e_A(x->x_gain);
!      t_float a1 = -2.*cos(omega);
!      t_float a2 = 1 - alpha/e_A(x->x_gain);
! 
! /*      post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("equ: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void equ_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      equ_bang(x);
! }
! 
! 
! static void *equ_new(t_floatarg f,t_floatarg g,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(equ_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
!     floatinlet_new(&x->x_obj, &x->x_gain);    
!     floatinlet_new(&x->x_obj, &x->x_bw);
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     if (g != 0.) x->x_gain = g;
!     return (x);
! }
! 
! 
! void equalizer_setup(void)
! {
!     equ_class = class_new(gensym("equalizer"), (t_newmethod)equ_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(equ_class,equ_bang);
!     class_addfloat(equ_class,equ_float);
! }
! 
! 
! 
! 
! 

Index: lowshelf.c
===================================================================
RCS file: /cvsroot/pure-data/externals/ggee/filters/lowshelf.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** lowshelf.c	17 Jun 2002 10:13:54 -0000	1.1.1.1
--- lowshelf.c	14 Nov 2005 21:59:08 -0000	1.2
***************
*** 1,91 ****
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef NT
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! 
! 
! /* ------------------- lowshelf ----------------------------*/
! 
! static t_class *lowshelf_class;
! 
! void lowshelf_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float A = e_A(x->x_gain);
!      t_float cs = cos(omega);
!      t_float sn = sin(omega);
!      t_float beta = e_beta(A,x->x_bw*0.01);
! 
!      t_float b0 =    A*((A+1) - (A-1)*cs + beta*sn);
!      t_float b1 = 2.*A*((A-1) - (A+1)*cs);
!      t_float b2 =    A*((A+1) - (A-1)*cs - beta*sn);
!      t_float a0 =      ((A+1) + (A-1)*cs + beta*sn);
!      t_float a1 =  -2.*((A-1) + (A+1)*cs);
!      t_float a2 =      ((A+1) + (A-1)*cs - beta*sn);
! 
! /*     post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("lowshelf: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void lowshelf_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      lowshelf_bang(x);
! }
! 
! 
! static void *lowshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(lowshelf_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
!     floatinlet_new(&x->x_obj, &x->x_gain);    
!     floatinlet_new(&x->x_obj, &x->x_bw);
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     if (g != 0.) x->x_gain = g;
!     return (x);
! }
! 
! 
! void lowshelf_setup(void)
! {
!     lowshelf_class = class_new(gensym("lowshelf"), (t_newmethod)lowshelf_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(lowshelf_class,lowshelf_bang);
!     class_addfloat(lowshelf_class,lowshelf_float);
! }
! 
! 
--- 1,91 ----
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef _MSC_VER
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! 
! 
! /* ------------------- lowshelf ----------------------------*/
! 
! static t_class *lowshelf_class;
! 
! void lowshelf_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float A = e_A(x->x_gain);
!      t_float cs = cos(omega);
!      t_float sn = sin(omega);
!      t_float beta = e_beta(A,x->x_bw*0.01);
! 
!      t_float b0 =    A*((A+1) - (A-1)*cs + beta*sn);
!      t_float b1 = 2.*A*((A-1) - (A+1)*cs);
!      t_float b2 =    A*((A+1) - (A-1)*cs - beta*sn);
!      t_float a0 =      ((A+1) + (A-1)*cs + beta*sn);
!      t_float a1 =  -2.*((A-1) + (A+1)*cs);
!      t_float a2 =      ((A+1) + (A-1)*cs - beta*sn);
! 
! /*     post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("lowshelf: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void lowshelf_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      lowshelf_bang(x);
! }
! 
! 
! static void *lowshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(lowshelf_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
!     floatinlet_new(&x->x_obj, &x->x_gain);    
!     floatinlet_new(&x->x_obj, &x->x_bw);
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     if (g != 0.) x->x_gain = g;
!     return (x);
! }
! 
! 
! void lowshelf_setup(void)
! {
!     lowshelf_class = class_new(gensym("lowshelf"), (t_newmethod)lowshelf_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(lowshelf_class,lowshelf_bang);
!     class_addfloat(lowshelf_class,lowshelf_float);
! }
! 
! 

Index: bandpass.c
===================================================================
RCS file: /cvsroot/pure-data/externals/ggee/filters/bandpass.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** bandpass.c	17 Jun 2002 10:13:54 -0000	1.1.1.1
--- bandpass.c	14 Nov 2005 21:59:08 -0000	1.2
***************
*** 1,86 ****
! 
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef NT
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! /* ------------------- bandpass ----------------------------*/
! 
! static t_class *bandpass_class;
! 
! void bandpass_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float alpha = e_alpha(x->x_bw* 0.01,omega);
!      t_float b1 = 0.;
!      t_float b0 = alpha;
!      t_float b2 = -alpha;
!      t_float a0 = 1 + alpha;
!      t_float a1 = -2.*cos(omega);
!      t_float a2 = 1 - alpha;
! 
! /*     post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("bandpass: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void bandpass_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      bandpass_bang(x);
! }
! 
! 
! static void *bandpass_new(t_floatarg f,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(bandpass_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
! /*    floatinlet_new(&x->x_obj, &x->x_gain);    */
!     floatinlet_new(&x->x_obj, &x->x_bw);
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     return (x);
! }
! 
! 
! void bandpass_setup(void)
! {
!     bandpass_class = class_new(gensym("bandpass"), (t_newmethod)bandpass_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(bandpass_class,bandpass_bang);
!     class_addfloat(bandpass_class,bandpass_float);
! }
! 
! 
! 
--- 1,86 ----
! 
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef _MSC_VER
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! /* ------------------- bandpass ----------------------------*/
! 
! static t_class *bandpass_class;
! 
! void bandpass_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float alpha = e_alpha(x->x_bw* 0.01,omega);
!      t_float b1 = 0.;
!      t_float b0 = alpha;
!      t_float b2 = -alpha;
!      t_float a0 = 1 + alpha;
!      t_float a1 = -2.*cos(omega);
!      t_float a2 = 1 - alpha;
! 
! /*     post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("bandpass: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void bandpass_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      bandpass_bang(x);
! }
! 
! 
! static void *bandpass_new(t_floatarg f,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(bandpass_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
! /*    floatinlet_new(&x->x_obj, &x->x_gain);    */
!     floatinlet_new(&x->x_obj, &x->x_bw);
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     return (x);
! }
! 
! 
! void bandpass_setup(void)
! {
!     bandpass_class = class_new(gensym("bandpass"), (t_newmethod)bandpass_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(bandpass_class,bandpass_bang);
!     class_addfloat(bandpass_class,bandpass_float);
! }
! 
! 
! 

Index: hlshelf.c
===================================================================
RCS file: /cvsroot/pure-data/externals/ggee/filters/hlshelf.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** hlshelf.c	17 Jun 2002 10:13:54 -0000	1.1.1.1
--- hlshelf.c	14 Nov 2005 21:59:08 -0000	1.2
***************
*** 1,226 ****
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! #include <m_pd.h>
! #include <math.h>
! 
! #ifdef NT
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! 
! /* ------------------------ hlshelf ----------------------------- */
! 
! 
! #ifndef M_PI
! #define M_PI 3.141593f
! #endif
! 
! #define SRATE 44100.0
! #define MAX_GAIN 120.0f
! 
! static t_class *hlshelf_class;
! 
! 
! typedef struct _hlshelf
! {
!      t_object x_obj;
!      float s_rate;
!      float s_gain0;
!      float s_gain1;
!      float s_gain2;
!      float s_ltransfq;
!      float s_htransfq;
!      float s_lradians;
!      float s_hradians;
! } t_hlshelf;
! 
! 
! int hlshelf_check_stability(t_float fb1,
! 			    t_float fb2, 
! 			    t_float ff1,
! 			    t_float ff2,
! 			    t_float ff3)
! {
!     float discriminant = fb1 * fb1 + 4 * fb2;
! 
!     if (discriminant < 0) /* imaginary roots -- resonant filter */
!     {
!     	    /* they're conjugates so we just check that the product
!     	    is less than one */
!     	if (fb2 >= -1.0f) goto stable;
!     }
!     else    /* real roots */
!     {
!     	    /* check that the parabola 1 - fb1 x - fb2 x^2 has a
!     	    	vertex between -1 and 1, and that it's nonnegative
!     	    	at both ends, which implies both roots are in [1-,1]. */
!     	if (fb1 <= 2.0f && fb1 >= -2.0f &&
!     	    1.0f - fb1 -fb2 >= 0 && 1.0f + fb1 - fb2 >= 0)
!     	    	goto stable;
!     }
!     return 0;
! stable:
!     return 1;
! }
! 
! 
! void hlshelf_check(t_hlshelf *x)
! {
! 
!      if(x->s_gain0 - x->s_gain1 > MAX_GAIN) {
! 	  x->s_gain0 = x->s_gain1 + MAX_GAIN; 
! 	  post("setting gain0 to %f",x->s_gain0);
!      }
! 
! 
!      if(x->s_gain1 > MAX_GAIN) {
! 	  x->s_gain1 = MAX_GAIN;
! 	  post("setting gain1 to %f",x->s_gain1);
!      }
! 
!      if(x->s_gain2 - x->s_gain1 > MAX_GAIN) {
! 	  x->s_gain2 = x->s_gain1 + MAX_GAIN; 
! 	  post("setting gain2 to %f",x->s_gain2);
!      }
! 
!   /* constrain: 0 <= x->s_ltransfq < x->s_htransfq. */
!      x->s_ltransfq = (x->s_ltransfq < x->s_htransfq) ? x->s_ltransfq : x->s_htransfq - 0.5f;
!      
!      if (x->s_ltransfq < 0) x->s_ltransfq = 0.0f;
!      
!      x->s_lradians = M_PI * x->s_ltransfq / x->s_rate;
!      x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate));	
! 
! }
! 
! 
! void hlshelf_bang(t_hlshelf *x)
! {
!      t_atom at[6];
!      float c0, c1, c2, d0, d1, d2;	/* output coefs */
!      float a1, a2, b1, b2, g1, g2;	/* temp coefs */
!      double xf;
! 
!      hlshelf_check(x);
!      
!      /* low shelf */
!      xf = 0.5 * 0.115129255 * (double)(x->s_gain0 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */
!      if(xf < -200.) /* exp(x) -> 0 */
!      {
! 	  a1 = 1.0f;
! 	  b1 = -1.0f;
! 	  g1 = 0.0f;
!      }
!      else
!      {
! 	  double t = tan(x->s_lradians);
! 	  double e = exp(xf);
! 	  double r = t / e;
! 	  double kr = t * e;
! 	  
! 	  a1 = (r - 1) / (r + 1);		
! 	  b1 = (kr - 1) / (kr + 1);
! 	  g1 = (kr + 1) / (r + 1);
!      }
!      
!      /* high shelf */
!      xf = 0.5 * 0.115129255 * (double)(x->s_gain2 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */
!      if(xf < -200.) /* exp(x) -> 0 */
!      {
! 	  a2 = -1.0f;
! 	  b2 = 1.0f;
! 	  g2 = 0.0f;
!      }
!      else
!      {
! 	  double t = tan(x->s_hradians);
! 	  double e = exp(xf);
! 	  double r = t / e;
! 	  double kr = t * e;
! 	  
! 	  a2 = (1 - r) / (1 + r);
! 	  b2 = (1 - kr) / (1 + kr);
! 	  g2 = (1 + kr) / (1 + r);
!      }
!      
!      /* form product */
!      c0 = g1 * g2 * (float)(exp((double)(x->s_gain1) * 0.05f * 2.302585093f));  ;
!      c1 = a1 + a2;
!      c2 = a1 * a2;
!      d0 =  1.0f;
!      d1 = b1 + b2;
!      d2 = b1 * b2;
! 
!      if (!hlshelf_check_stability(-c1/d0,-c2/d0,d0/d0,d1/d0,d2/d0)) {
!        post("hlshelf: filter unstable -> resetting");
!        c0=1.;c1=0.;c2=0.;
!        d0=1.;d1=0.;d2=0.;
!      }
! 
!      SETFLOAT(at,-c1/d0);
!      SETFLOAT(at+1,-c2/d0);
!      SETFLOAT(at+2,d0/d0);
!      SETFLOAT(at+3,d1/d0);
!      SETFLOAT(at+4,d2/d0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! void hlshelf_float(t_hlshelf *x,t_floatarg f)
! {
!      x->s_gain0 = f;
!      hlshelf_bang(x);
! }
! 
! 
! static void *hlshelf_new(t_symbol* s,t_int argc, t_atom* at)
! {
!     t_hlshelf *x = (t_hlshelf *)pd_new(hlshelf_class);
!     t_float k0 = atom_getfloat(at);
!     t_float k1 = atom_getfloat(at+1);
!     t_float k2 = atom_getfloat(at+2);
!     t_float f1 = atom_getfloat(at+3);
!     t_float f2 = atom_getfloat(at+4);
! 
! 
!     f1 = atom_getfloat(at);
!     f2 = atom_getfloat(at);
! 
!     if ((f1 == 0.0f && f2 == 0.0f) || f1 > f2){ /* all gains = 0db */
! 	 f1 = 150.0f;	
! 	 f2 = 5000.0f;
!     }
! 
!     if (f1 < 0) f1 = 0.0f;
!     if (f2 > SRATE) f2 = .5f*SRATE;
!  
!     x->s_rate = SRATE;		/* srate default  */
!     x->s_gain0 = k0;
!     x->s_gain1 = k1;
!     x->s_gain2 = k2;
!     
!     x->s_ltransfq = 0.0f;
!     x->s_htransfq = SRATE/2;
! 
!     x->s_lradians = M_PI * x->s_ltransfq / x->s_rate;
!     x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate));
! 
!     floatinlet_new(&x->x_obj, &x->s_gain1);
!     floatinlet_new(&x->x_obj, &x->s_gain2);
!     floatinlet_new(&x->x_obj, &x->s_ltransfq);
!     floatinlet_new(&x->x_obj, &x->s_htransfq);
!     outlet_new(&x->x_obj, &s_list);
! 
!     return (x);
! }
! 
! void hlshelf_setup(void)
! {
!     hlshelf_class = class_new(gensym("hlshelf"), (t_newmethod)hlshelf_new, 0,
! 				sizeof(t_hlshelf), 0, A_GIMME, 0);
!     class_addbang(hlshelf_class,hlshelf_bang);
!     class_addfloat(hlshelf_class,hlshelf_float);
! }
! 
! 
--- 1,226 ----
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! #include <m_pd.h>
! #include <math.h>
! 
! #ifdef _MSC_VER
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! 
! /* ------------------------ hlshelf ----------------------------- */
! 
! 
! #ifndef M_PI
! #define M_PI 3.141593f
! #endif
! 
! #define SRATE 44100.0
! #define MAX_GAIN 120.0f
! 
! static t_class *hlshelf_class;
! 
! 
! typedef struct _hlshelf
! {
!      t_object x_obj;
!      float s_rate;
!      float s_gain0;
!      float s_gain1;
!      float s_gain2;
!      float s_ltransfq;
!      float s_htransfq;
!      float s_lradians;
!      float s_hradians;
! } t_hlshelf;
! 
! 
! int hlshelf_check_stability(t_float fb1,
! 			    t_float fb2, 
! 			    t_float ff1,
! 			    t_float ff2,
! 			    t_float ff3)
! {
!     float discriminant = fb1 * fb1 + 4 * fb2;
! 
!     if (discriminant < 0) /* imaginary roots -- resonant filter */
!     {
!     	    /* they're conjugates so we just check that the product
!     	    is less than one */
!     	if (fb2 >= -1.0f) goto stable;
!     }
!     else    /* real roots */
!     {
!     	    /* check that the parabola 1 - fb1 x - fb2 x^2 has a
!     	    	vertex between -1 and 1, and that it's nonnegative
!     	    	at both ends, which implies both roots are in [1-,1]. */
!     	if (fb1 <= 2.0f && fb1 >= -2.0f &&
!     	    1.0f - fb1 -fb2 >= 0 && 1.0f + fb1 - fb2 >= 0)
!     	    	goto stable;
!     }
!     return 0;
! stable:
!     return 1;
! }
! 
! 
! void hlshelf_check(t_hlshelf *x)
! {
! 
!      if(x->s_gain0 - x->s_gain1 > MAX_GAIN) {
! 	  x->s_gain0 = x->s_gain1 + MAX_GAIN; 
! 	  post("setting gain0 to %f",x->s_gain0);
!      }
! 
! 
!      if(x->s_gain1 > MAX_GAIN) {
! 	  x->s_gain1 = MAX_GAIN;
! 	  post("setting gain1 to %f",x->s_gain1);
!      }
! 
!      if(x->s_gain2 - x->s_gain1 > MAX_GAIN) {
! 	  x->s_gain2 = x->s_gain1 + MAX_GAIN; 
! 	  post("setting gain2 to %f",x->s_gain2);
!      }
! 
!   /* constrain: 0 <= x->s_ltransfq < x->s_htransfq. */
!      x->s_ltransfq = (x->s_ltransfq < x->s_htransfq) ? x->s_ltransfq : x->s_htransfq - 0.5f;
!      
!      if (x->s_ltransfq < 0) x->s_ltransfq = 0.0f;
!      
!      x->s_lradians = M_PI * x->s_ltransfq / x->s_rate;
!      x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate));	
! 
! }
! 
! 
! void hlshelf_bang(t_hlshelf *x)
! {
!      t_atom at[6];
!      float c0, c1, c2, d0, d1, d2;	/* output coefs */
!      float a1, a2, b1, b2, g1, g2;	/* temp coefs */
!      double xf;
! 
!      hlshelf_check(x);
!      
!      /* low shelf */
!      xf = 0.5 * 0.115129255 * (double)(x->s_gain0 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */
!      if(xf < -200.) /* exp(x) -> 0 */
!      {
! 	  a1 = 1.0f;
! 	  b1 = -1.0f;
! 	  g1 = 0.0f;
!      }
!      else
!      {
! 	  double t = tan(x->s_lradians);
! 	  double e = exp(xf);
! 	  double r = t / e;
! 	  double kr = t * e;
! 	  
! 	  a1 = (r - 1) / (r + 1);		
! 	  b1 = (kr - 1) / (kr + 1);
! 	  g1 = (kr + 1) / (r + 1);
!      }
!      
!      /* high shelf */
!      xf = 0.5 * 0.115129255 * (double)(x->s_gain2 - x->s_gain1); /* ln(10) / 20 = 0.115129255 */
!      if(xf < -200.) /* exp(x) -> 0 */
!      {
! 	  a2 = -1.0f;
! 	  b2 = 1.0f;
! 	  g2 = 0.0f;
!      }
!      else
!      {
! 	  double t = tan(x->s_hradians);
! 	  double e = exp(xf);
! 	  double r = t / e;
! 	  double kr = t * e;
! 	  
! 	  a2 = (1 - r) / (1 + r);
! 	  b2 = (1 - kr) / (1 + kr);
! 	  g2 = (1 + kr) / (1 + r);
!      }
!      
!      /* form product */
!      c0 = g1 * g2 * (float)(exp((double)(x->s_gain1) * 0.05f * 2.302585093f));  ;
!      c1 = a1 + a2;
!      c2 = a1 * a2;
!      d0 =  1.0f;
!      d1 = b1 + b2;
!      d2 = b1 * b2;
! 
!      if (!hlshelf_check_stability(-c1/d0,-c2/d0,d0/d0,d1/d0,d2/d0)) {
!        post("hlshelf: filter unstable -> resetting");
!        c0=1.;c1=0.;c2=0.;
!        d0=1.;d1=0.;d2=0.;
!      }
! 
!      SETFLOAT(at,-c1/d0);
!      SETFLOAT(at+1,-c2/d0);
!      SETFLOAT(at+2,d0/d0);
!      SETFLOAT(at+3,d1/d0);
!      SETFLOAT(at+4,d2/d0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! void hlshelf_float(t_hlshelf *x,t_floatarg f)
! {
!      x->s_gain0 = f;
!      hlshelf_bang(x);
! }
! 
! 
! static void *hlshelf_new(t_symbol* s,t_int argc, t_atom* at)
! {
!     t_hlshelf *x = (t_hlshelf *)pd_new(hlshelf_class);
!     t_float k0 = atom_getfloat(at);
!     t_float k1 = atom_getfloat(at+1);
!     t_float k2 = atom_getfloat(at+2);
!     t_float f1 = atom_getfloat(at+3);
!     t_float f2 = atom_getfloat(at+4);
! 
! 
!     f1 = atom_getfloat(at);
!     f2 = atom_getfloat(at);
! 
!     if ((f1 == 0.0f && f2 == 0.0f) || f1 > f2){ /* all gains = 0db */
! 	 f1 = 150.0f;	
! 	 f2 = 5000.0f;
!     }
! 
!     if (f1 < 0) f1 = 0.0f;
!     if (f2 > SRATE) f2 = .5f*SRATE;
!  
!     x->s_rate = SRATE;		/* srate default  */
!     x->s_gain0 = k0;
!     x->s_gain1 = k1;
!     x->s_gain2 = k2;
!     
!     x->s_ltransfq = 0.0f;
!     x->s_htransfq = SRATE/2;
! 
!     x->s_lradians = M_PI * x->s_ltransfq / x->s_rate;
!     x->s_hradians= M_PI * (0.5f - (x->s_htransfq / x->s_rate));
! 
!     floatinlet_new(&x->x_obj, &x->s_gain1);
!     floatinlet_new(&x->x_obj, &x->s_gain2);
!     floatinlet_new(&x->x_obj, &x->s_ltransfq);
!     floatinlet_new(&x->x_obj, &x->s_htransfq);
!     outlet_new(&x->x_obj, &s_list);
! 
!     return (x);
! }
! 
! void hlshelf_setup(void)
! {
!     hlshelf_class = class_new(gensym("hlshelf"), (t_newmethod)hlshelf_new, 0,
! 				sizeof(t_hlshelf), 0, A_GIMME, 0);
!     class_addbang(hlshelf_class,hlshelf_bang);
!     class_addfloat(hlshelf_class,hlshelf_float);
! }
! 
! 

Index: highpass.c
===================================================================
RCS file: /cvsroot/pure-data/externals/ggee/filters/highpass.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** highpass.c	17 Jun 2002 10:13:54 -0000	1.1.1.1
--- highpass.c	14 Nov 2005 21:59:08 -0000	1.2
***************
*** 1,87 ****
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef NT
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! 
! /* ------------------- highpass ----------------------------*/
! 
! static t_class *highpass_class;
! 
! void highpass_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float alpha = e_alpha(x->x_bw* 0.01,omega);
!      t_float b1 = -(1 + cos(omega));
!      t_float b0 = -b1/2.;
!      t_float b2 = b0;
!      t_float a0 = 1 + alpha;
!      t_float a1 = -2.*cos(omega);
!      t_float a2 = 1 - alpha;
! 
! /*     post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("highpass: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void highpass_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      highpass_bang(x);
! }
! 
! 
! static void *highpass_new(t_floatarg f,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(highpass_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
! /*    floatinlet_new(&x->x_obj, &x->x_gain);    */
!     floatinlet_new(&x->x_obj, &x->x_bw);
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     return (x);
! }
! 
! 
! void highpass_setup(void)
! {
!     highpass_class = class_new(gensym("highpass"), (t_newmethod)highpass_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(highpass_class,highpass_bang);
!     class_addfloat(highpass_class,highpass_float);
! }
! 
! 
! 
! 
--- 1,87 ----
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef _MSC_VER
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! 
! /* ------------------- highpass ----------------------------*/
! 
! static t_class *highpass_class;
! 
! void highpass_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float alpha = e_alpha(x->x_bw* 0.01,omega);
!      t_float b1 = -(1 + cos(omega));
!      t_float b0 = -b1/2.;
!      t_float b2 = b0;
!      t_float a0 = 1 + alpha;
!      t_float a1 = -2.*cos(omega);
!      t_float a2 = 1 - alpha;
! 
! /*     post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("highpass: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void highpass_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      highpass_bang(x);
! }
! 
! 
! static void *highpass_new(t_floatarg f,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(highpass_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
! /*    floatinlet_new(&x->x_obj, &x->x_gain);    */
!     floatinlet_new(&x->x_obj, &x->x_bw);
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     return (x);
! }
! 
! 
! void highpass_setup(void)
! {
!     highpass_class = class_new(gensym("highpass"), (t_newmethod)highpass_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(highpass_class,highpass_bang);
!     class_addfloat(highpass_class,highpass_float);
! }
! 
! 
! 
! 

Index: highshelf.c
===================================================================
RCS file: /cvsroot/pure-data/externals/ggee/filters/highshelf.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** highshelf.c	17 Jun 2002 10:13:54 -0000	1.1.1.1
--- highshelf.c	14 Nov 2005 21:59:08 -0000	1.2
***************
*** 1,90 ****
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef NT
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! 
! /* ------------------- highshelf ----------------------------*/
! 
! static t_class *highshelf_class;
! 
! void highshelf_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float A = e_A(x->x_gain);
!      t_float cs = cos(omega);
!      t_float sn = sin(omega);
!      t_float beta = e_beta(A,x->x_bw* 0.01);
! 
!      t_float b0 =    A*((A+1) + (A-1)*cs + beta*sn);
!      t_float b1 =-2.*A*((A-1) + (A+1)*cs);
!      t_float b2 =    A*((A+1) + (A-1)*cs - beta*sn);
!      t_float a0 =      ((A+1) - (A-1)*cs + beta*sn);
!      t_float a1 =   2.*((A-1) - (A+1)*cs);
!      t_float a2 =      ((A+1) - (A-1)*cs - beta*sn);
! 
! /*     post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("highshelf: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void highshelf_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      highshelf_bang(x);
! }
! 
! 
! static void *highshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(highshelf_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
!     floatinlet_new(&x->x_obj, &x->x_gain);    
!     floatinlet_new(&x->x_obj, &x->x_bw);
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     if (g != 0.) x->x_gain = g;
!     return (x);
! }
! 
! 
! void highshelf_setup(void)
! {
!     highshelf_class = class_new(gensym("highshelf"), (t_newmethod)highshelf_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(highshelf_class,highshelf_bang);
!     class_addfloat(highshelf_class,highshelf_float);
! }
! 
! 
--- 1,90 ----
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef _MSC_VER
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! 
! /* ------------------- highshelf ----------------------------*/
! 
! static t_class *highshelf_class;
! 
! void highshelf_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float A = e_A(x->x_gain);
!      t_float cs = cos(omega);
!      t_float sn = sin(omega);
!      t_float beta = e_beta(A,x->x_bw* 0.01);
! 
!      t_float b0 =    A*((A+1) + (A-1)*cs + beta*sn);
!      t_float b1 =-2.*A*((A-1) + (A+1)*cs);
!      t_float b2 =    A*((A+1) + (A-1)*cs - beta*sn);
!      t_float a0 =      ((A+1) - (A-1)*cs + beta*sn);
!      t_float a1 =   2.*((A-1) - (A+1)*cs);
!      t_float a2 =      ((A+1) - (A-1)*cs - beta*sn);
! 
! /*     post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw);*/
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("highshelf: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void highshelf_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      highshelf_bang(x);
! }
! 
! 
! static void *highshelf_new(t_floatarg f,t_floatarg g,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(highshelf_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
!     floatinlet_new(&x->x_obj, &x->x_gain);    
!     floatinlet_new(&x->x_obj, &x->x_bw);
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     if (g != 0.) x->x_gain = g;
!     return (x);
! }
! 
! 
! void highshelf_setup(void)
! {
!     highshelf_class = class_new(gensym("highshelf"), (t_newmethod)highshelf_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(highshelf_class,highshelf_bang);
!     class_addfloat(highshelf_class,highshelf_float);
! }
! 
! 

Index: moog~.c
===================================================================
RCS file: /cvsroot/pure-data/externals/ggee/filters/moog~.c,v
retrieving revision 1.2
retrieving revision 1.3
diff -C2 -d -r1.2 -r1.3
*** moog~.c	26 Nov 2002 12:35:23 -0000	1.2
--- moog~.c	14 Nov 2005 21:59:08 -0000	1.3
***************
*** 1,182 ****
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! #include "math.h"
! #include <m_pd.h>
! 
! /* ----------------------------- moog ----------------------------- */
! static t_class *moog_class;
! 
! 
! typedef struct _moog
! {
!      t_object x_obj;
!   t_pd   in2;
!      t_float x_1,x_2,x_3,x_4;
!      t_float y_1,y_2,y_3,y_4;
! } t_moog;
! 
! static void moog_reset(t_moog *x)
! {
! 	x->x_1 = x->x_2 = x->x_3 = x->x_4 = 0.0;
! 	x->y_1 = x->y_2 = x->y_3 = x->y_4 = 0.0;
! 
! }
! 
! 
! 
! static void *moog_new(t_symbol *s, int argc, t_atom *argv)
! {
!     if (argc > 1) post("moog~: extra arguments ignored");
!     {
! 	t_moog *x = (t_moog *)pd_new(moog_class);
! 	outlet_new(&x->x_obj, &s_signal);
! 	inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
! 	inlet_new(&x->x_obj, &x->in2, &s_signal, &s_signal);
! 	moog_reset(x);
! 	return (x);
!     }
! 
! 
! }
! 
! 
! 
! static t_float calc_k(t_float f,t_float k) {
!   if (k>4.) k =4.;
!   if (k < 0.) k = 0.;
!   if (f <= 3800) return k;
!   k = k - 0.5*((f-3800)/4300);
!   return k;
! }
! 
! t_int *moog_perform(t_int *w)
! {
!     t_moog* x = (t_moog*) (w[1]); 
!     t_float *in1 = (t_float *)(w[2]);
!     t_float *p = (t_float *)(w[3]);
!     t_float *k = (t_float *)(w[4]);
! 
!     t_float *out = (t_float *)(w[5]);
!     int n = (int)(w[6]);
!     float in;
!     float pt,pt1;
!     
!     float x1 = x->x_1;
!     float x2 = x->x_2;
!     float x3 = x->x_3;
!     float x4 = x->x_4;
!     float ys1 = x->y_1;
!     float ys2 = x->y_2;
!     float ys3 = x->y_3;
!     float ys4 = x->y_4;
! 
! 
!    while (n--) {
!      if (*p > 8140) *p = 8140.;
!      *k = calc_k(*p,*k);
!      pt =*p;
!      pt1=(pt+1)*0.76923077;
!      in = *in1++ - *k*ys4;
!      ys1 = (pt1)*in + 0.3*x1 - pt*ys1;
!      x1 = in;
!      ys2 = (pt1)*ys1 + 0.3*x2 - pt*ys2;
!      x2 = ys1;
!      ys3 = (pt1)*ys2 + 0.3 *x3 - pt*ys3;
!      x3 = ys2;
!      ys4 = (pt1)*ys3 + 0.3*x4 - pt*ys4;
!      x4 = ys3;
!      *out++ = ys4;
!    }
! 
!    
!     x->y_1 = ys1;
!     x->y_2 = ys2;
!     x->y_3 = ys3;
!     x->y_4 = ys4;
!     x->x_1 = x1;
!     x->x_2 = x2;
!     x->x_3 = x3;
!     x->x_4 = x4;
! 
!     return (w+7);
! }
! 
! 
! #define CLIP(x)  x = ((x) > 1.0 ? (1.0) : (x))
! 
! t_int *moog_perf8(t_int *w)
! {
!     t_moog* x = (t_moog*) (w[1]); 
!     t_float *in1 = (t_float *)(w[2]);
!     t_float *p = (t_float *)(w[3]);
!     t_float *k = (t_float *)(w[4]);
!     t_float *out = (t_float *)(w[5]);
!     int n = (int)(w[6]);
! 
!     t_float x1 = x->x_1;
!     t_float x2 = x->x_2;
!     t_float x3 = x->x_3;
!     t_float x4 = x->x_4;
!     t_float ys1 = x->y_1;
!     t_float ys2 = x->y_2;
!     t_float ys3 = x->y_3;
!     t_float ys4 = x->y_4;
!     t_float temp,temp2;
!     t_float pt,pt1;
!     t_float in;
! 
!     while (n--) {
!       if (*p > 8140.) *p = 8140.;
!       *k = calc_k(*p,*k);
! 
!      pt =*p* 0.01*0.0140845 - 0.9999999f;
!      pt1=(pt+1.0)*0.76923077;
!      in = *in1++ - *k*ys4;
!      ys1 = pt1*(in + 0.3*x1) - pt*ys1;
!      x1 = in;
!      ys2 = pt1*(ys1 + 0.3*x2) - pt*ys2;
!      x2 = ys1;
!      ys3 = pt1*(ys2 + 0.3*x3) - pt*ys3;
!      x3 = ys2;
!      ys4 = pt1*(ys3 + 0.3*x4) - pt*ys4;
!      x4 = ys3;
!      *out++ = ys4;
! 
!       p++;k++;
!     }
! 
!     x->y_1 = ys1;
!     x->y_2 = ys2;
!     x->y_3 = ys3;
!     x->y_4 = ys4;
!     x->x_1 = x1;
!     x->x_2 = x2;
!     x->x_3 = x3;
!     x->x_4 = x4;
!     
!     return (w+7);
! }
! 
! void dsp_add_moog(t_moog *x, t_sample *in1, t_sample *in2, t_sample *in3, t_sample *out, int n)
! {
!     if (n&7)
!     	dsp_add(moog_perform, 6,(t_int)x, in1,in2,in3, out, n);
!     else	
!     	dsp_add(moog_perf8, 6,(t_int) x, in1, in2, in3, out, n);
! }
! 
! static void moog_dsp(t_moog *x, t_signal **sp)
! {
!     dsp_add_moog(x,sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,sp[0]->s_n);
! }
! 
! 
! void moog_tilde_setup(void)
! {
!     moog_class = class_new(gensym("moog~"), (t_newmethod)moog_new, 0,
!     	sizeof(t_moog), 0, A_GIMME, 0);
!     class_addmethod(moog_class, nullfn, gensym("signal"), 0);
!     class_addmethod(moog_class, (t_method)moog_reset, gensym("reset"), 0);
!     class_addmethod(moog_class, (t_method)moog_dsp, gensym("dsp"), A_NULL);
! }
--- 1,182 ----
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! #include "math.h"
! #include <m_pd.h>
! 
! /* ----------------------------- moog ----------------------------- */
! static t_class *moog_class;
! 
! 
! typedef struct _moog
! {
!      t_object x_obj;
!   t_pd   in2;
!      t_float x_1,x_2,x_3,x_4;
!      t_float y_1,y_2,y_3,y_4;
! } t_moog;
! 
! static void moog_reset(t_moog *x)
! {
! 	x->x_1 = x->x_2 = x->x_3 = x->x_4 = 0.0;
! 	x->y_1 = x->y_2 = x->y_3 = x->y_4 = 0.0;
! 
! }
! 
! 
! 
! static void *moog_new(t_symbol *s, int argc, t_atom *argv)
! {
!     if (argc > 1) post("moog~: extra arguments ignored");
!     {
! 	t_moog *x = (t_moog *)pd_new(moog_class);
! 	outlet_new(&x->x_obj, &s_signal);
! 	inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal);
! 	inlet_new(&x->x_obj, &x->in2, &s_signal, &s_signal);
! 	moog_reset(x);
! 	return (x);
!     }
! 
! 
! }
! 
! 
! 
! static t_float calc_k(t_float f,t_float k) {
!   if (k>4.) k =4.;
!   if (k < 0.) k = 0.;
!   if (f <= 3800) return k;
!   k = k - 0.5*((f-3800)/4300);
!   return k;
! }
! 
! t_int *moog_perform(t_int *w)
! {
!     t_moog* x = (t_moog*) (w[1]); 
!     t_float *in1 = (t_float *)(w[2]);
!     t_float *p = (t_float *)(w[3]);
!     t_float *k = (t_float *)(w[4]);
! 
!     t_float *out = (t_float *)(w[5]);
!     int n = (int)(w[6]);
!     float in;
!     float pt,pt1;
!     
!     float x1 = x->x_1;
!     float x2 = x->x_2;
!     float x3 = x->x_3;
!     float x4 = x->x_4;
!     float ys1 = x->y_1;
!     float ys2 = x->y_2;
!     float ys3 = x->y_3;
!     float ys4 = x->y_4;
! 
! 
!    while (n--) {
!      if (*p > 8140) *p = 8140.;
!      *k = calc_k(*p,*k);
!      pt =*p;
!      pt1=(pt+1)*0.76923077;
!      in = *in1++ - *k*ys4;
!      ys1 = (pt1)*in + 0.3*x1 - pt*ys1;
!      x1 = in;
!      ys2 = (pt1)*ys1 + 0.3*x2 - pt*ys2;
!      x2 = ys1;
!      ys3 = (pt1)*ys2 + 0.3 *x3 - pt*ys3;
!      x3 = ys2;
!      ys4 = (pt1)*ys3 + 0.3*x4 - pt*ys4;
!      x4 = ys3;
!      *out++ = ys4;
!    }
! 
!    
!     x->y_1 = ys1;
!     x->y_2 = ys2;
!     x->y_3 = ys3;
!     x->y_4 = ys4;
!     x->x_1 = x1;
!     x->x_2 = x2;
!     x->x_3 = x3;
!     x->x_4 = x4;
! 
!     return (w+7);
! }
! 
! 
! #define CLIP(x)  x = ((x) > 1.0 ? (1.0) : (x))
! 
! t_int *moog_perf8(t_int *w)
! {
!     t_moog* x = (t_moog*) (w[1]); 
!     t_float *in1 = (t_float *)(w[2]);
!     t_float *p = (t_float *)(w[3]);
!     t_float *k = (t_float *)(w[4]);
!     t_float *out = (t_float *)(w[5]);
!     int n = (int)(w[6]);
! 
!     t_float x1 = x->x_1;
!     t_float x2 = x->x_2;
!     t_float x3 = x->x_3;
!     t_float x4 = x->x_4;
!     t_float ys1 = x->y_1;
!     t_float ys2 = x->y_2;
!     t_float ys3 = x->y_3;
!     t_float ys4 = x->y_4;
!     t_float temp,temp2;
!     t_float pt,pt1;
!     t_float in;
! 
!     while (n--) {
!       if (*p > 8140.) *p = 8140.;
!       *k = calc_k(*p,*k);
! 
!      pt =*p* 0.01*0.0140845 - 0.9999999f;
!      pt1=(pt+1.0)*0.76923077;
!      in = *in1++ - *k*ys4;
!      ys1 = pt1*(in + 0.3*x1) - pt*ys1;
!      x1 = in;
!      ys2 = pt1*(ys1 + 0.3*x2) - pt*ys2;
!      x2 = ys1;
!      ys3 = pt1*(ys2 + 0.3*x3) - pt*ys3;
!      x3 = ys2;
!      ys4 = pt1*(ys3 + 0.3*x4) - pt*ys4;
!      x4 = ys3;
!      *out++ = ys4;
! 
!       p++;k++;
!     }
! 
!     x->y_1 = ys1;
!     x->y_2 = ys2;
!     x->y_3 = ys3;
!     x->y_4 = ys4;
!     x->x_1 = x1;
!     x->x_2 = x2;
!     x->x_3 = x3;
!     x->x_4 = x4;
!     
!     return (w+7);
! }
! 
! void dsp_add_moog(t_moog *x, t_sample *in1, t_sample *in2, t_sample *in3, t_sample *out, int n)
! {
!     if (n&7)
!     	dsp_add(moog_perform, 6,(t_int)x, in1,in2,in3, out, n);
!     else	
!     	dsp_add(moog_perf8, 6,(t_int) x, in1, in2, in3, out, n);
! }
! 
! static void moog_dsp(t_moog *x, t_signal **sp)
! {
!     dsp_add_moog(x,sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec, sp[3]->s_vec,sp[0]->s_n);
! }
! 
! 
! void moog_tilde_setup(void)
! {
!     moog_class = class_new(gensym("moog~"), (t_newmethod)moog_new, 0,
!     	sizeof(t_moog), 0, A_GIMME, 0);
!     class_addmethod(moog_class, nullfn, gensym("signal"), 0);
!     class_addmethod(moog_class, (t_method)moog_reset, gensym("reset"), 0);
!     class_addmethod(moog_class, (t_method)moog_dsp, gensym("dsp"), A_NULL);
! }

Index: notch.c
===================================================================
RCS file: /cvsroot/pure-data/externals/ggee/filters/notch.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** notch.c	17 Jun 2002 10:13:55 -0000	1.1.1.1
--- notch.c	14 Nov 2005 21:59:08 -0000	1.2
***************
*** 1,89 ****
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef NT
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! 
! 
! /* ------------------- notch ----------------------------*/
! 
! static t_class *notch_class;
! 
! void notch_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float alpha = e_alpha(x->x_bw* 0.01,omega);
!      t_float b1 = -2.*cos(omega);
!      t_float b0 = 1;
!      t_float b2 = b0;
!      t_float a0 = 1 + alpha;
!      t_float a1 = -2.*cos(omega);
!      t_float a2 = 1 - alpha;
! 
! /*     post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("notch: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void notch_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      notch_bang(x);
! }
! 
! 
! static void *notch_new(t_floatarg f,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(notch_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
! /*    floatinlet_new(&x->x_obj, &x->x_gain);    */
!     floatinlet_new(&x->x_obj, &x->x_bw);
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     return (x);
! }
! 
! 
! void notch_setup(void)
! {
!     notch_class = class_new(gensym("notch"), (t_newmethod)notch_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(notch_class,notch_bang);
!     class_addfloat(notch_class,notch_float);
! }
! 
! 
! 
! 
! 
--- 1,89 ----
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef _MSC_VER
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! 
! 
! /* ------------------- notch ----------------------------*/
! 
! static t_class *notch_class;
! 
! void notch_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float alpha = e_alpha(x->x_bw* 0.01,omega);
!      t_float b1 = -2.*cos(omega);
!      t_float b0 = 1;
!      t_float b2 = b0;
!      t_float a0 = 1 + alpha;
!      t_float a1 = -2.*cos(omega);
!      t_float a2 = 1 - alpha;
! 
! /*     post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("notch: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void notch_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      notch_bang(x);
! }
! 
! 
! static void *notch_new(t_floatarg f,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(notch_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
! /*    floatinlet_new(&x->x_obj, &x->x_gain);    */
!     floatinlet_new(&x->x_obj, &x->x_bw);
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     return (x);
! }
! 
! 
! void notch_setup(void)
! {
!     notch_class = class_new(gensym("notch"), (t_newmethod)notch_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(notch_class,notch_bang);
!     class_addfloat(notch_class,notch_float);
! }
! 
! 
! 
! 
! 

Index: lowpass.c
===================================================================
RCS file: /cvsroot/pure-data/externals/ggee/filters/lowpass.c,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -C2 -d -r1.1.1.1 -r1.2
*** lowpass.c	17 Jun 2002 10:13:54 -0000	1.1.1.1
--- lowpass.c	14 Nov 2005 21:59:08 -0000	1.2
***************
*** 1,89 ****
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef NT
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! 
! 
! /* ------------------- lowpass ----------------------------*/
! 
! static t_class *lowpass_class;
! 
! void lowpass_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float alpha = e_alpha(x->x_bw*0.01,omega);
!      t_float b1 = 1 - cos(omega);
!      t_float b0 = b1/2.;
!      t_float b2 = b0;
!      t_float a0 = 1 + alpha;
!      t_float a1 = -2.*cos(omega);
!      t_float a2 = 1 - alpha;
! 
! /*     post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("lowpass: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void lowpass_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      lowpass_bang(x);
! }
! 
! 
! static void *lowpass_new(t_floatarg f,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(lowpass_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
! /*    floatinlet_new(&x->x_obj, &x->x_gain);     */
!     floatinlet_new(&x->x_obj, &x->x_bw);
! 
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     return (x);
! }
! 
! 
! void lowpass_setup(void)
! {
!     lowpass_class = class_new(gensym("lowpass"), (t_newmethod)lowpass_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(lowpass_class,lowpass_bang);
!     class_addfloat(lowpass_class,lowpass_float);
! }
! 
! 
! 
! 
--- 1,89 ----
! /* (C) Guenter Geiger <geiger at epy.co.at> */
! 
! 
! /*
! 
!  These filter coefficients computations are taken from
!  http://www.harmony-central.com/Computer/Programming/Audio-EQ-Cookbook.txt  
! 
!  written by Robert Bristow-Johnson
! 
! */
! 
! #include <m_pd.h>
! #ifdef _MSC_VER
! #pragma warning( disable : 4244 )
! #pragma warning( disable : 4305 )
! #endif
! #include <math.h>
! #include "filters.h"
! 
! 
! 
! /* ------------------- lowpass ----------------------------*/
! 
! static t_class *lowpass_class;
! 
! void lowpass_bang(t_rbjfilter *x)
! {
!      t_atom at[5];
!      t_float omega = e_omega(x->x_freq,x->x_rate);
!      t_float alpha = e_alpha(x->x_bw*0.01,omega);
!      t_float b1 = 1 - cos(omega);
!      t_float b0 = b1/2.;
!      t_float b2 = b0;
!      t_float a0 = 1 + alpha;
!      t_float a1 = -2.*cos(omega);
!      t_float a2 = 1 - alpha;
! 
! /*     post("bang %f %f %f",x->x_freq, x->x_gain, x->x_bw); */
!      
!      if (!check_stability(-a1/a0,-a2/a0,b0/a0,b1/a0,b2/a0)) {
!        post("lowpass: filter unstable -> resetting");
!        a0=1.;a1=0.;a2=0.;
!        b0=1.;b1=0.;b2=0.;
!      }
! 
!      SETFLOAT(at,-a1/a0);
!      SETFLOAT(at+1,-a2/a0);
!      SETFLOAT(at+2,b0/a0);
!      SETFLOAT(at+3,b1/a0);
!      SETFLOAT(at+4,b2/a0);
!      
!      outlet_list(x->x_obj.ob_outlet,&s_list,5,at);
! }
! 
! 
! void lowpass_float(t_rbjfilter *x,t_floatarg f)
! {
!      x->x_freq = f;
!      lowpass_bang(x);
! }
! 
! 
! static void *lowpass_new(t_floatarg f,t_floatarg bw)
! {
!     t_rbjfilter *x = (t_rbjfilter *)pd_new(lowpass_class);
! 
!     x->x_rate = 44100.0;
!     outlet_new(&x->x_obj,&s_float);
! /*    floatinlet_new(&x->x_obj, &x->x_gain);     */
!     floatinlet_new(&x->x_obj, &x->x_bw);
! 
!     if (f > 0.) x->x_freq = f;
!     if (bw > 0.) x->x_bw = bw;
!     return (x);
! }
! 
! 
! void lowpass_setup(void)
! {
!     lowpass_class = class_new(gensym("lowpass"), (t_newmethod)lowpass_new, 0,
! 				sizeof(t_rbjfilter), 0,A_DEFFLOAT,A_DEFFLOAT,0);
!     class_addbang(lowpass_class,lowpass_bang);
!     class_addfloat(lowpass_class,lowpass_float);
! }
! 
! 
! 
! 





More information about the Pd-cvs mailing list