From 4a83a80c044c9613bd50a63dd9ac5a97e2c028b5 Mon Sep 17 00:00:00 2001 From: Tom Schouten Date: Tue, 15 Aug 2006 15:11:52 +0000 Subject: creb 0.9.2 import svn path=/trunk/externals/creb/; revision=5607 --- modules/Makefile | 16 +++++++--- modules/bdiag~.c | 24 ++++++++------- modules/bfft~.c | 7 +++-- modules/bitsplit~.c | 2 +- modules/blocknorm~.c | 9 ++++-- modules/cheby~.c | 6 ++-- modules/diag~.c | 6 +--- modules/dist~.c | 7 +++-- modules/dynwav~.c | 21 +++++++------ modules/eadsr~.c | 61 +++++++++++-------------------------- modules/ead~.c | 44 ++++----------------------- modules/ear~.c | 35 --------------------- modules/eblosc~.c | 81 +++++++++++++++++++++++++++++-------------------- modules/extlib_util.h | 6 ---- modules/fdn~.c | 35 +++++++++++++-------- modules/ffpoly.c | 4 +-- modules/filters.h | 6 ---- modules/lattice~.c | 6 ++-- modules/permut~.c | 13 +++++--- modules/qmult~.c | 3 +- modules/qnorm~.c | 3 +- modules/resofilt~.c | 57 ++++++++++++++++++++-------------- modules/sbosc~.c | 6 ++-- modules/scrollgrid1D~.c | 36 +++++++++++++--------- modules/statwav~.c | 5 ++- modules/tabreadmix~.c | 11 ++++--- 26 files changed, 232 insertions(+), 278 deletions(-) (limited to 'modules') diff --git a/modules/Makefile b/modules/Makefile index f054566..7dc0178 100644 --- a/modules/Makefile +++ b/modules/Makefile @@ -1,10 +1,16 @@ include ../Makefile.config -current: ead.o ear.o eadsr.o dist.o tabreadmix.o xfm.o qmult.o qnorm.o \ - cheby.o abs.o ramp.o dwt.o bfft.o dynwav.o statwav.o bdiag.o \ - diag.o matrix.o permut.o lattice.o ratio.o ffpoly.o fwarp.o \ - junction.o fdn.o window.o cmath.o eblosc.o bitsplit.o sbosc.o \ - blocknorm.o resofilt.o scrollgrid1D.o +current: ead~.o ear~.o eadsr~.o dist~.o \ + tabreadmix~.o xfm~.o qmult~.o qnorm~.o \ + cheby~.o abs~.o ramp~.o \ + bfft~.o dynwav~.o statwav~.o bdiag~.o \ + diag~.o matrix~.o permut~.o lattice~.o ratio.o ffpoly.o fwarp.o \ + junction~.o fdn~.o bwin~.o eblosc~.o bitsplit~.o sbosc~.o \ + blocknorm~.o resofilt~.o scrollgrid1D~.o \ + \ + dwt.o cmath.o \ + \ + envelope_util.o setup.o clean: diff --git a/modules/bdiag~.c b/modules/bdiag~.c index b18c1b2..ac0a363 100644 --- a/modules/bdiag~.c +++ b/modules/bdiag~.c @@ -22,13 +22,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include +#include "extlib_util.h" #include #include -#ifndef IS_DENORMAL -#include "extlib_util.h" -#endif #define MAXORDER 64 @@ -83,7 +79,8 @@ static void bdiag_reset(t_bdiag *x) -static void bdiag_eigen(t_bdiag *x, t_floatarg index, t_floatarg aval, t_floatarg bval) +static void bdiag_eigen(t_bdiag *x, t_floatarg index, + t_floatarg aval, t_floatarg bval) { int i = (int)index; if (i<0) return; @@ -94,7 +91,8 @@ static void bdiag_eigen(t_bdiag *x, t_floatarg index, t_floatarg aval, t_floatar } /* set decay time and frequency of pole at index */ -static void bdiag_timefreq(t_bdiag *x, t_floatarg index, t_floatarg time, t_floatarg freq) +static void bdiag_timefreq(t_bdiag *x, t_floatarg index, + t_floatarg time, t_floatarg freq) { float r,a,b,n; float sr = sys_getsr() / (float)x->x_ctl.c_order; @@ -217,7 +215,8 @@ static void bdiag_dsp(t_bdiag *x, t_signal **sp) } - dsp_add(bdiag_perform, 4, &x->x_ctl, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + dsp_add(bdiag_perform, 4, &x->x_ctl, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec); } } @@ -270,8 +269,11 @@ void bdiag_tilde_setup(void) class_addmethod(bdiag_class, (t_method)bdiag_reset, gensym("reset"), 0); class_addmethod(bdiag_class, (t_method)bdiag_dsp, gensym("dsp"), 0); - class_addmethod(bdiag_class, (t_method)bdiag_eigen, gensym("eigen"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); - class_addmethod(bdiag_class, (t_method)bdiag_timefreq, gensym("timefreq"), A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); - class_addmethod(bdiag_class, (t_method)bdiag_preset, gensym("preset"), A_DEFFLOAT, 0); + class_addmethod(bdiag_class, (t_method)bdiag_eigen, gensym("eigen"), + A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addmethod(bdiag_class, (t_method)bdiag_timefreq, gensym("timefreq"), + A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addmethod(bdiag_class, (t_method)bdiag_preset, gensym("preset"), + A_DEFFLOAT, 0); } diff --git a/modules/bfft~.c b/modules/bfft~.c index 750f020..b57f028 100644 --- a/modules/bfft~.c +++ b/modules/bfft~.c @@ -1,7 +1,8 @@ /* - * bfft.c - code for some fourrier transform variants and utility functions - * data organization is in (real, imag) pairs - * the first 2 components are (DC, NY) + * bfft.c - Code for some fourrier transform variants and utility + * functions. Data organization is in (real, imag) pairs the first 2 + * components are (DC, NY) + * * Copyright (c) 2000-2003 by Tom Schouten * * This program is free software; you can redistribute it and/or modify diff --git a/modules/bitsplit~.c b/modules/bitsplit~.c index 9239d0b..e89b078 100644 --- a/modules/bitsplit~.c +++ b/modules/bitsplit~.c @@ -1,5 +1,5 @@ /* - * bitsplit.c - convert a signal to a binary vector + * bitsplit.c - Convert a signal to a binary vector. * Copyright (c) 2000-2003 by Tom Schouten * * This program is free software; you can redistribute it and/or modify diff --git a/modules/blocknorm~.c b/modules/blocknorm~.c index bcf695a..1c8e3df 100644 --- a/modules/blocknorm~.c +++ b/modules/blocknorm~.c @@ -1,5 +1,7 @@ /* - * blocknorm.c - normalize an array of dsp blocks (for spectral processing) + * blocknorm.c - Normalize an array of dsp blocks. (spectral + * processing primitive) + * * Copyright (c) 2000-2003 by Tom Schouten * * This program is free software; you can redistribute it and/or modify @@ -68,7 +70,7 @@ static t_int *blocknorm_perform(t_int *word) /* normalize */ for (j=0;jx_ctl.c_output = malloc(sizeof(float)*i); j = i; - while (--j) inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"), gensym("signal")); + while (--j) inlet_new(&x->x_obj, &x->x_obj.ob_pd, + gensym("signal"), gensym("signal")); while (i--) outlet_new(&x->x_obj, gensym("signal")); return (void *)x; diff --git a/modules/cheby~.c b/modules/cheby~.c index 6774028..7bf97b2 100644 --- a/modules/cheby~.c +++ b/modules/cheby~.c @@ -91,7 +91,8 @@ static t_int *cheby_perform(t_int *w) static void cheby_dsp(t_cheby *x, t_signal **sp) { - dsp_add(cheby_perform, 4, &x->x_ctl, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + dsp_add(cheby_perform, 4, &x->x_ctl, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec); } static void cheby_free(void) @@ -132,7 +133,8 @@ void cheby_tilde_setup(void) CLASS_MAINSIGNALIN(cheby_class, t_cheby, x_f); class_addmethod(cheby_class, (t_method)cheby_bang, gensym("bang"), 0); class_addmethod(cheby_class, (t_method)cheby_dsp, gensym("dsp"), 0); - class_addmethod(cheby_class, (t_method)cheby_coef, gensym("coef"), A_DEFFLOAT, A_DEFFLOAT, 0); + class_addmethod(cheby_class, (t_method)cheby_coef, gensym("coef"), + A_DEFFLOAT, A_DEFFLOAT, 0); } diff --git a/modules/diag~.c b/modules/diag~.c index 7244c33..1e6bd96 100644 --- a/modules/diag~.c +++ b/modules/diag~.c @@ -22,13 +22,9 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include +#include "extlib_util.h" #include #include -#ifndef IS_DENORMAL -#include "extlib_util.h" -#endif #define MAXORDER 64 diff --git a/modules/dist~.c b/modules/dist~.c index 34b9a63..1206b17 100644 --- a/modules/dist~.c +++ b/modules/dist~.c @@ -17,8 +17,8 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include +#include "extlib_util.h" + #define CLIP 0 #define INVERSE 1 @@ -237,7 +237,8 @@ static t_int *dist_perform(t_int *w) static void dist_dsp(t_dist *x, t_signal **sp) { - dsp_add(dist_perform, 4, &x->x_ctl, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + dsp_add(dist_perform, 4, &x->x_ctl, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec); } void dist_free(void) diff --git a/modules/dynwav~.c b/modules/dynwav~.c index 9157f12..3645f58 100644 --- a/modules/dynwav~.c +++ b/modules/dynwav~.c @@ -1,7 +1,6 @@ /* - * blosc.c - bandlimited oscillators - * data organization is in (real, imag) pairs - * the first 2 components are (DC, NY) + * dynwav~.c - dynamic wavetable oscillators + * * Copyright (c) 2000-2003 by Tom Schouten * * This program is free software; you can redistribute it and/or modify @@ -109,7 +108,8 @@ static t_int *dynwav_perform(t_int *w) return (w+6); } -static t_int *dynwav_perform_8point(t_int *w) /* werkt nog nie tegoei */ +static t_int *dynwav_perform_8point(t_int *w) +/* FIXME: i thought this was broken. */ { @@ -134,11 +134,11 @@ static t_int *dynwav_perform_8point(t_int *w) /* werkt nog nie tegoei */ if (buf && dbuf) { - /* const float N1 = 1 / ( 2 * (1-(1/9)) * (1-(1/25)) * (1-(1/49)) ); - ** const float N2 = 1 / ( (1-(9)) * 2 * (1-(9/25)) * (1-(9/49)) ); - ** const float N3 = 1 / ( (1-(25)) * (1-(25/9)) * 2 * (1-(25/49)) ); - ** const float N4 = 1 / ( (1-(49)) * (1-(49/9)) * (1-(49/25)) * 2 ); - */ +/* const float N1 = 1 / ( 2 * (1-(1/9)) * (1-(1/25)) * (1-(1/49)) ); +** const float N2 = 1 / ( (1-(9)) * 2 * (1-(9/25)) * (1-(9/49)) ); +** const float N3 = 1 / ( (1-(25)) * (1-(25/9)) * 2 * (1-(25/49)) ); +** const float N4 = 1 / ( (1-(49)) * (1-(49/9)) * (1-(49/25)) * 2 ); +*/ const float N1 = 0.59814453125; const float N2 = -0.11962890625; @@ -262,7 +262,8 @@ static void dynwav_dsp(t_dynwav *x, t_signal **sp) } - dsp_add(dynwav_perform_8point, 5, &x->x_ctl, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); + dsp_add(dynwav_perform_8point, 5, &x->x_ctl, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); } diff --git a/modules/eadsr~.c b/modules/eadsr~.c index a47fd2d..d2a1968 100644 --- a/modules/eadsr~.c +++ b/modules/eadsr~.c @@ -17,8 +17,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include #include "extlib_util.h" typedef struct eadsrctl @@ -134,12 +132,13 @@ void eadsr_free(void) t_class *eadsr_class; -void *eadsr_new(t_floatarg attack, t_floatarg decay, t_floatarg sustain, t_floatarg release) +void *eadsr_new(t_floatarg attack, t_floatarg decay, + t_floatarg sustain, t_floatarg release) { t_eadsr *x = (t_eadsr *)pd_new(eadsr_class); inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("attack")); inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("decay")); - inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("sustain")); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("sustain")); inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("release")); outlet_new(&x->x_obj, gensym("signal")); @@ -158,50 +157,24 @@ void eadsr_tilde_setup(void) { //post("eadsr~ v0.1"); eadsr_class = class_new(gensym("eadsr~"), (t_newmethod)eadsr_new, - (t_method)eadsr_free, sizeof(t_eadsr), 0, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); - class_addmethod(eadsr_class, (t_method)eadsr_float, gensym("float"), A_FLOAT, 0); - class_addmethod(eadsr_class, (t_method)eadsr_start, gensym("start"), 0); + (t_method)eadsr_free, sizeof(t_eadsr), 0, A_DEFFLOAT, + A_DEFFLOAT, A_DEFFLOAT, A_DEFFLOAT, 0); + class_addmethod(eadsr_class, (t_method)eadsr_float, + gensym("float"), A_FLOAT, 0); + class_addmethod(eadsr_class, (t_method)eadsr_start, + gensym("start"), 0); class_addmethod(eadsr_class, (t_method)eadsr_start, gensym("bang"), 0); class_addmethod(eadsr_class, (t_method)eadsr_stop, gensym("stop"), 0); class_addmethod(eadsr_class, (t_method)eadsr_dsp, gensym("dsp"), 0); - class_addmethod(eadsr_class, (t_method)eadsr_attack, gensym("attack"), A_FLOAT, 0); - class_addmethod(eadsr_class, (t_method)eadsr_decay, gensym("decay"), A_FLOAT, 0); - class_addmethod(eadsr_class, (t_method)eadsr_sustain, gensym("sustain"), A_FLOAT, 0); - class_addmethod(eadsr_class, (t_method)eadsr_release, gensym("release"), A_FLOAT, 0); + class_addmethod(eadsr_class, (t_method)eadsr_attack, + gensym("attack"), A_FLOAT, 0); + class_addmethod(eadsr_class, (t_method)eadsr_decay, + gensym("decay"), A_FLOAT, 0); + class_addmethod(eadsr_class, (t_method)eadsr_sustain, + gensym("sustain"), A_FLOAT, 0); + class_addmethod(eadsr_class, (t_method)eadsr_release, + gensym("release"), A_FLOAT, 0); } -/* - * Utility functions for exponential decay - * Copyright (c) 2000-2003 by Tom Schouten - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -//#include "extlib_util.h" - -float milliseconds_2_one_minus_realpole(float time) -{ - float r; - - if (time < 0.0f) time = 0.0f; - r = -expm1(1000.0f * log(ENVELOPE_RANGE) / (sys_getsr() * time)); - if (!(r < 1.0f)) r = 1.0f; - - //post("%f",r); - return r; -} diff --git a/modules/ead~.c b/modules/ead~.c index 6171332..e58b08a 100644 --- a/modules/ead~.c +++ b/modules/ead~.c @@ -17,8 +17,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include #include "extlib_util.h" /* pointer to */ @@ -121,7 +119,8 @@ static void ead_free(void) /* constructor */ -static void *ead_new(t_floatarg attack, t_floatarg decay, t_floatarg sustain, t_floatarg release) +static void *ead_new(t_floatarg attack, t_floatarg decay, + t_floatarg sustain, t_floatarg release) { /* create instance */ t_ead *x = (t_ead *)pd_new(ead_class); @@ -152,40 +151,9 @@ void ead_tilde_setup(void) class_addmethod(ead_class, (t_method)ead_start, gensym("start"), 0); class_addmethod(ead_class, (t_method)ead_start, gensym("bang"), 0); class_addmethod(ead_class, (t_method)ead_dsp, gensym("dsp"), 0); - class_addmethod(ead_class, (t_method)ead_attack, gensym("attack"), A_FLOAT, 0); - class_addmethod(ead_class, (t_method)ead_decay, gensym("decay"), A_FLOAT, 0); + class_addmethod(ead_class, (t_method)ead_attack, + gensym("attack"), A_FLOAT, 0); + class_addmethod(ead_class, (t_method)ead_decay, + gensym("decay"), A_FLOAT, 0); } -/* - * Utility functions for exponential decay - * Copyright (c) 2000-2003 by Tom Schouten - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -//#include "extlib_util.h" - -float milliseconds_2_one_minus_realpole(float time) -{ - float r; - - if (time < 0.0f) time = 0.0f; - r = -expm1(1000.0f * log(ENVELOPE_RANGE) / (sys_getsr() * time)); - if (!(r < 1.0f)) r = 1.0f; - - //post("%f",r); - return r; -} diff --git a/modules/ear~.c b/modules/ear~.c index 1e81ce4..28fe097 100644 --- a/modules/ear~.c +++ b/modules/ear~.c @@ -17,8 +17,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include #include "extlib_util.h" typedef struct earctl @@ -142,36 +140,3 @@ void ear_tilde_setup(void) } -/* - * Utility functions for exponential decay - * Copyright (c) 2000-2003 by Tom Schouten - * - * This program is free software; you can redistribute it and/or modify - * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or - * (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU General Public License for more details. - * - * You should have received a copy of the GNU General Public License - * along with this program; if not, write to the Free Software - * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. - */ - - -//#include "extlib_util.h" - -float milliseconds_2_one_minus_realpole(float time) -{ - float r; - - if (time < 0.0f) time = 0.0f; - r = -expm1(1000.0f * log(ENVELOPE_RANGE) / (sys_getsr() * time)); - if (!(r < 1.0f)) r = 1.0f; - - //post("%f",r); - return r; -} diff --git a/modules/eblosc~.c b/modules/eblosc~.c index df1b059..b2c6199 100644 --- a/modules/eblosc~.c +++ b/modules/eblosc~.c @@ -64,8 +64,12 @@ typedef struct eblosc /* phase converters */ -static inline float _phase_to_float(u32 p){return ((float)p) * (1.0f / 4294967296.0f);} -static inline u32 _float_to_phase(float f){return (u32)(f * 4294967296.0f);} +static inline float _phase_to_float(u32 p){ + return ((float)p) * (1.0f / 4294967296.0f); +} +static inline u32 _float_to_phase(float f){ + return (u32)(f * 4294967296.0f); +} @@ -144,8 +148,8 @@ static void _bang_comparator(t_ebloscctl *ctl, float prev, float curr) int voice; - /* determine the location of the discontinuity (in oversampled coordiates - using linear interpolation */ + /* determine the location of the discontinuity (in oversampled + coordiates using linear interpolation */ float f = (float)S * curr / (curr - prev); @@ -208,8 +212,8 @@ static void _bang_phasor(t_ebloscctl *ctl, float freq) voice = ctl->c_next_voice++; ctl->c_next_voice &= VOICES-1; - /* determine the location of the discontinuity (in oversampled coordinates) - which is S * (new phase) / (increment) */ + /* determine the location of the discontinuity (in oversampled + coordinates) which is S * (new phase) / (increment) */ table_index = phase / phase_inc_decimated; @@ -218,7 +222,8 @@ static void _bang_phasor(t_ebloscctl *ctl, float freq) table_phase = phase - (table_index * phase_inc_decimated); - /* use it to initialize the new voice index and interpolation fraction */ + /* use it to initialize the new voice index and interpolation + * fraction */ ctl->c_index[voice] = table_index; ctl->c_frac[voice] = (float)table_phase / (float)phase_inc_decimated; @@ -233,9 +238,9 @@ static void _bang_phasor(t_ebloscctl *ctl, float freq) } -/* the 2 oscillator version: - the second osc can reset the first osc's phase (hence it determines the pitch) - the first osc determines the waveform */ +/* the 2 oscillator version: the second osc can reset the first osc's + phase (hence it determines the pitch) the first osc determines the + waveform */ static void _bang_hardsync_phasor(t_ebloscctl *ctl, float freq, float freq2) { @@ -297,8 +302,8 @@ static void _bang_hardsync_phasor(t_ebloscctl *ctl, float freq, float freq2) voice = ctl->c_next_voice++; ctl->c_next_voice &= VOICES-1; - /* determine the location of the discontinuity (in oversampled coordinates) - which is S * (new phase) / (increment) */ + /* determine the location of the discontinuity (in oversampled + coordinates) which is S * (new phase) / (increment) */ table_index = phase / phase_inc_decimated; @@ -307,11 +312,11 @@ static void _bang_hardsync_phasor(t_ebloscctl *ctl, float freq, float freq2) table_phase = phase - (table_index * phase_inc_decimated); - /* determine the step size - as opposed to saw/impulse waveforms, the step is not always equal to one. it is: - oldphase - phase + phase_inc - but for the unit step this will overflow to zero, so we - reduce the bit depth to prevent overflow */ + /* determine the step size. as opposed to saw/impulse + waveforms, the step is not always equal to one. it is: + oldphase - phase + phase_inc but for the unit step this + will overflow to zero, so we reduce the bit depth to + prevent overflow */ stepsize = _phase_to_float(((oldphase-phase) >> LOVERSAMPLE) + phase_inc_decimated) * (float)S; @@ -354,7 +359,8 @@ static t_int *eblosc_perform_hardsync_saw(t_int *w) /* add aliased sawtooth wave */ sample += _phase_to_float(ctl->c_phase) - 0.5f; - /* highpass filter output to remove DC offset and low frequency aliasing */ + /* highpass filter output to remove DC offset and low + * frequency aliasing */ ctl->c_butter->BangSmooth(sample, sample, 0.05f); /* send to output */ @@ -416,7 +422,8 @@ static t_int *eblosc_perform_pulse(t_int *w) /* get the bandlimited discontinuity */ float sample = _get_bandlimited_discontinuity(ctl, bli); - /* highpass filter output to remove DC offset and low frequency aliasing */ + /* highpass filter output to remove DC offset and low + * frequency aliasing */ ctl->c_butter->BangSmooth(sample, sample, 0.05f); /* send to output */ @@ -496,30 +503,35 @@ static void eblosc_dsp(t_eblosc *x, t_signal **sp) if (x->x_ctl.c_waveform == gensym("syncsaw")){ x->x_ctl.c_scale = 1.0f; x->x_ctl.c_scale_update = 1.0f; - dsp_add(eblosc_perform_hardsync_saw, 5, &x->x_ctl, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); + dsp_add(eblosc_perform_hardsync_saw, 5, &x->x_ctl, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec, sp[2]->s_vec); } /* 1 osc */ else if (x->x_ctl.c_waveform == gensym("pulse")){ x->x_ctl.c_scale = 1.0f; x->x_ctl.c_scale_update = 1.0f; - dsp_add(eblosc_perform_pulse, 4, &x->x_ctl, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + dsp_add(eblosc_perform_pulse, 4, &x->x_ctl, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec); } else if (x->x_ctl.c_waveform == gensym("pulse2")){ x->x_ctl.c_phase_inc_scale *= 2; x->x_ctl.c_scale = 1.0f; x->x_ctl.c_scale_update = -1.0f; - dsp_add(eblosc_perform_pulse, 4, &x->x_ctl, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + dsp_add(eblosc_perform_pulse, 4, &x->x_ctl, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec); } else if (x->x_ctl.c_waveform == gensym("comparator")){ x->x_ctl.c_scale = 1.0f; x->x_ctl.c_scale_update = 1.0f; - dsp_add(eblosc_perform_comparator, 4, &x->x_ctl, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + dsp_add(eblosc_perform_comparator, 4, &x->x_ctl, + sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); } else{ x->x_ctl.c_scale = 1.0f; x->x_ctl.c_scale_update = 1.0f; - dsp_add(eblosc_perform_saw, 4, &x->x_ctl, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + dsp_add(eblosc_perform_saw, 4, &x->x_ctl, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec); } @@ -542,12 +554,14 @@ static void *eblosc_new(t_symbol *s) /* optional signal inlets */ if (s == gensym("syncsaw")){ - inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"), gensym("signal")); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, + gensym("signal"), gensym("signal")); } /* optional phase inlet */ if (s != gensym("comparator")){ - inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("float"), gensym("phase")); + inlet_new(&x->x_obj, &x->x_obj.ob_pd, + gensym("float"), gensym("phase")); } /* create the postfilter */ @@ -585,15 +599,16 @@ extern "C" build_tables(); eblosc_class = class_new(gensym("eblosc~"), (t_newmethod)eblosc_new, - (t_method)eblosc_free, sizeof(t_eblosc), 0, A_DEFSYMBOL, A_NULL); + (t_method)eblosc_free, sizeof(t_eblosc), + 0, A_DEFSYMBOL, A_NULL); CLASS_MAINSIGNALIN(eblosc_class, t_eblosc, x_f); - class_addmethod(eblosc_class, (t_method)eblosc_dsp, gensym("dsp"), A_NULL); - class_addmethod(eblosc_class, (t_method)eblosc_phase, gensym("phase"), A_FLOAT, A_NULL); - class_addmethod(eblosc_class, (t_method)eblosc_phase2, gensym("phase2"), A_FLOAT, A_NULL); - - + class_addmethod(eblosc_class, (t_method)eblosc_dsp, + gensym("dsp"), A_NULL); + class_addmethod(eblosc_class, (t_method)eblosc_phase, + gensym("phase"), A_FLOAT, A_NULL); + class_addmethod(eblosc_class, (t_method)eblosc_phase2, + gensym("phase2"), A_FLOAT, A_NULL); } - } #endif diff --git a/modules/extlib_util.h b/modules/extlib_util.h index e6c074b..3f92ab0 100644 --- a/modules/extlib_util.h +++ b/modules/extlib_util.h @@ -17,9 +17,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#ifndef CREB_EXTLIB_UTIL_H -#define CREB_EXTLIB_UTIL_H - #include #include "m_pd.h" @@ -45,6 +42,3 @@ typedef union //#define IS_DENORMAL(f) (((*(unsigned int *)&(f))&0x7f800000) == 0) #define IS_DENORMAL(f) (((((t_flint)(f)).i) & 0x7f800000) == 0) - -#endif /* CREB_EXTLIB_UTIL_H */ - diff --git a/modules/fdn~.c b/modules/fdn~.c index 65682b7..2681752 100644 --- a/modules/fdn~.c +++ b/modules/fdn~.c @@ -26,10 +26,8 @@ add more diffuse feedback matrix (hadamard) check filtering code */ -#include -#include -#include "extlib_util.h" +#include "extlib_util.h" #include #include #include @@ -106,7 +104,8 @@ typedef struct fdn static void fdn_order(t_fdn *x, t_int order){ if (order > x->x_ctl.c_maxorder) { - post("fdn: this should not happen (panic!) order %d is larger than maxorder %d:", + post("fdn: this should not happen (panic!) order %d " + "is larger than maxorder %d:", order, x->x_ctl.c_maxorder ); exit(1); } @@ -131,8 +130,12 @@ static void fdn_print(t_fdn *x) static void fdn_reset(t_fdn *x) { int i; - if (x->x_ctl.c_buf) memset(x->x_ctl.c_buf, 0, x->x_ctl.c_bufsize * sizeof(float)); - if (x->x_ctl.c_vectorbuffer) memset(x->x_ctl.c_vectorbuffer, 0, x->x_ctl.c_maxorder * 2 * sizeof(float)); + if (x->x_ctl.c_buf) + memset(x->x_ctl.c_buf, 0, x->x_ctl.c_bufsize + * sizeof(float)); + if (x->x_ctl.c_vectorbuffer) + memset(x->x_ctl.c_vectorbuffer, + 0, x->x_ctl.c_maxorder * 2 * sizeof(float)); } @@ -326,7 +329,7 @@ static void fdn_setupdelayline(t_fdn *x){ int sum, t, n; int mask = x->x_ctl.c_bufsize - 1; int start = x->x_ctl.c_tap[0]; - t_int *tap = x->x_ctl.c_tap; + int *tap = x->x_ctl.c_tap; float *length = x->x_ctl.c_length; float scale = sys_getsr() * .001f; @@ -338,7 +341,8 @@ static void fdn_setupdelayline(t_fdn *x){ } if (sum > mask){ - post("fdn: warning: not enough delay memory, behaviour is undefined (this could lead to instability...)"); + post("fdn: warning: not enough delay memory, behaviour " + "is undefined (this could lead to instability...)"); } @@ -442,7 +446,8 @@ static void *fdn_new(t_floatarg maxiorder, t_floatarg maxibufsize) bufsize = bufround; - post("fdn: maximum nb of delay lines %d, total buffer size %d samples (%f seconds)", + post("fdn: maximum nb of delay lines %d, total buffer " + "size %d samples (%f seconds)", order, bufsize, ((float)bufsize) / sys_getsr()); @@ -489,12 +494,16 @@ void fdn_tilde_setup(void) CLASS_MAINSIGNALIN(fdn_class, t_fdn, x_f); class_addmethod(fdn_class, (t_method)fdn_print, gensym("print"), 0); class_addmethod(fdn_class, (t_method)fdn_reset, gensym("reset"), 0); - class_addmethod(fdn_class, (t_method)fdn_timehigh, gensym("timehigh"), A_DEFFLOAT, 0); - class_addmethod(fdn_class, (t_method)fdn_timelow, gensym("timelow"), A_DEFFLOAT, 0); + class_addmethod(fdn_class, (t_method)fdn_timehigh, + gensym("timehigh"), A_DEFFLOAT, 0); + class_addmethod(fdn_class, (t_method)fdn_timelow, + gensym("timelow"), A_DEFFLOAT, 0); class_addmethod(fdn_class, (t_method)fdn_list, gensym("lines"), A_GIMME, 0); class_addmethod(fdn_class, (t_method)fdn_dsp, gensym("dsp"), 0); - class_addmethod(fdn_class, (t_method)fdn_linear, gensym("linear"), A_FLOAT, A_FLOAT, A_FLOAT, 0); - class_addmethod(fdn_class, (t_method)fdn_exponential, gensym("exponential"), A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(fdn_class, (t_method)fdn_linear, + gensym("linear"), A_FLOAT, A_FLOAT, A_FLOAT, 0); + class_addmethod(fdn_class, (t_method)fdn_exponential, + gensym("exponential"), A_FLOAT, A_FLOAT, A_FLOAT, 0); } diff --git a/modules/ffpoly.c b/modules/ffpoly.c index c325969..023f29d 100644 --- a/modules/ffpoly.c +++ b/modules/ffpoly.c @@ -49,7 +49,7 @@ static void ffpoly_compute(t_ffpoly *x, t_floatarg fcoef) int in = (int)fcoef; int fo = x->x_field_order; int po = x->x_poly_order; - t_int* c = x->x_coef; + int* c = x->x_coef; int i, out; in %= fo; @@ -135,7 +135,7 @@ static void *ffpoly_new(t_floatarg fpolyorder, t_floatarg ffieldorder) x->x_poly_order = polyorder; x->x_field_order = fieldorder; - x->x_coef = (t_int *)malloc((x->x_poly_order + 1) * sizeof(int)); + x->x_coef = (int *)malloc((x->x_poly_order + 1) * sizeof(int)); /* set poly to f(x) = x */ ffpoly_coefficients(x, x->x_field_order); diff --git a/modules/filters.h b/modules/filters.h index 8a32363..e0d1c49 100644 --- a/modules/filters.h +++ b/modules/filters.h @@ -2,9 +2,6 @@ /* defined as inline functions with call by reference to enable compiler ref/deref optim */ -#ifndef CREB_FILTERS_H -#define CREB_FILTERS_H - /* the typedef */ #ifndef T #define T float @@ -227,6 +224,3 @@ PP eval_conj_pole_zero_ratfunc(float *val, float *arg, float *poles, float *zero (sample the impulse response) */ - -#endif /* CREB_FILTERS_H */ - diff --git a/modules/lattice~.c b/modules/lattice~.c index 6f8e816..28adf19 100644 --- a/modules/lattice~.c +++ b/modules/lattice~.c @@ -85,7 +85,8 @@ static t_int *lattice_perform(t_int *w) static void lattice_dsp(t_lattice *x, t_signal **sp) { - dsp_add(lattice_perform, 4, &x->x_ctl, sp[0]->s_n, sp[0]->s_vec, sp[1]->s_vec); + dsp_add(lattice_perform, 4, &x->x_ctl, sp[0]->s_n, + sp[0]->s_vec, sp[1]->s_vec); } static void lattice_free(void) @@ -138,7 +139,8 @@ void lattice_tilde_setup(void) CLASS_MAINSIGNALIN(lattice_class, t_lattice, x_f); class_addmethod(lattice_class, (t_method)lattice_dsp, gensym("dsp"), 0); class_addmethod(lattice_class, (t_method)lattice_reset, gensym("reset"), 0); - class_addmethod(lattice_class, (t_method)lattice_rc, gensym("rc"), A_FLOAT, A_FLOAT, 0); + class_addmethod(lattice_class, (t_method)lattice_rc, + gensym("rc"), A_FLOAT, A_FLOAT, 0); } diff --git a/modules/permut~.c b/modules/permut~.c index a81cc12..7738f84 100644 --- a/modules/permut~.c +++ b/modules/permut~.c @@ -19,15 +19,18 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include + #include -#include "extlib_util.h" #include +//#include "m_pd.h" +#include "extlib_util.h" + + typedef struct permutctl { char c_type; - t_int *c_permutationtable; + int *c_permutationtable; int c_blocksize; } t_permutctl; @@ -59,7 +62,7 @@ static void permut_random(t_permut *x, t_floatarg seed) int i,j; int N = x->x_ctl.c_blocksize; int mask = N-1; - t_int *p = x->x_ctl.c_permutationtable; + int *p = x->x_ctl.c_permutationtable; int r, last = 0; //srand(* ((unsigned int *)(&seed))); @@ -100,7 +103,7 @@ static void permut_resize_table(t_permut *x, int size) { if (x->x_ctl.c_permutationtable) free(x->x_ctl.c_permutationtable); - x->x_ctl.c_permutationtable = (t_int *)malloc(sizeof(int)*size); + x->x_ctl.c_permutationtable = (int *)malloc(sizeof(int)*size); x->x_ctl.c_blocksize = size; /* make sure it's initialized */ diff --git a/modules/qmult~.c b/modules/qmult~.c index 94766e1..56898ac 100644 --- a/modules/qmult~.c +++ b/modules/qmult~.c @@ -147,7 +147,8 @@ static void *qmult_new(t_floatarg channels) int i; t_qmult *x = (t_qmult *)pd_new(qmult_class); - for (i=1;i<8;i++) inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"), gensym("signal")); + for (i=1;i<8;i++) inlet_new(&x->x_obj, &x->x_obj.ob_pd, + gensym("signal"), gensym("signal")); for (i=0;i<4;i++) outlet_new(&x->x_obj, gensym("signal")); return (void *)x; diff --git a/modules/qnorm~.c b/modules/qnorm~.c index e826b1b..98548d9 100644 --- a/modules/qnorm~.c +++ b/modules/qnorm~.c @@ -119,7 +119,8 @@ static void *qnorm_new(t_floatarg channels) int i; t_qnorm *x = (t_qnorm *)pd_new(qnorm_class); - for (i=1;i<4;i++) inlet_new(&x->x_obj, &x->x_obj.ob_pd, gensym("signal"), gensym("signal")); + for (i=1;i<4;i++) inlet_new(&x->x_obj, &x->x_obj.ob_pd, + gensym("signal"), gensym("signal")); for (i=0;i<4;i++) outlet_new(&x->x_obj, gensym("signal")); return (void *)x; diff --git a/modules/resofilt~.c b/modules/resofilt~.c index ba74532..0227dfc 100644 --- a/modules/resofilt~.c +++ b/modules/resofilt~.c @@ -86,15 +86,19 @@ static t_int *resofilt_perform_fourpole(t_int *w) t_float f_prev = ctl->c_f_prev; t_float r_prev = ctl->c_r_prev; - /* use rms of input to drive freq and reso - this is such that connecting a dsp signal to the inlets has a reasonable result, - even if the inputs are oscillatory. the rms values will be interpolated linearly - (that is, linearly in the "analog" domain, so exponentially in the z-domain) */ + /* use rms of input to drive freq and reso. this is such that + connecting a dsp signal to the inlets has a reasonable result, + even if the inputs are oscillatory. the rms values will be + interpolated linearly (that is, linearly in the "analog" domain, + so exponentially in the z-domain) */ reso_rms = freq_rms = 0.0f; for (i=0; i1), >1 == self osc */ + /* first input is the reso frequency (absolute) */ + t_float _freq = *freq++; + /* second input is the resonnance (0->1), >1 == self osc */ + t_float _reso = *reso++; + freq_rms += _freq * _freq; reso_rms += _reso * _reso; } @@ -104,12 +108,14 @@ static t_int *resofilt_perform_fourpole(t_int *w) r = sqrt(sqrt(reso_rms)); - /* calculate the new pole locations - we use an impulse invariant transform: the moog vcf poles are located at + /* calculate the new pole locations. we use an impulse invariant + transform: the moog vcf poles are located at + s_p = (-1 +- r \sqrt{+- j}, with r = (k/4)^(1/4) \in [0,1] - the poles are always complex, so we can use an orthogonal implementation - both conj pole pairs have the same angle, so we can use one phasor and 2 radii + the poles are always complex, so we can use an orthogonal + implementation both conj pole pairs have the same angle, so we + can use one phasor and 2 radii */ /* compute phasor, radius and update eqs @@ -179,7 +185,8 @@ static t_int *resofilt_perform_fourpole(t_int *w) *out++ = x; - /* saturate (normalize if pow > 1) state to prevent explosion and to allow self-osc */ + /* saturate (normalize if pow > 1) state to prevent explosion + * and to allow self-osc */ _sat_state(stateA); _sat_state(stateB); @@ -222,13 +229,15 @@ static t_int *resofilt_perform_threepole(t_int *w) t_float f_prev = ctl->c_f_prev; t_float r_prev = ctl->c_r_prev; - t_float sqrt5 = sqrtf(5.0f); + t_float sqrt5 = sqrt(5.0); /* use rms of input to drive freq and reso */ reso_rms = freq_rms = 0.0f; for (i=0; i1), >1 == self osc */ + /* first input is the reso frequency (absolute) */ + t_float _freq = *freq++; + /* second input is the resonnance (0->1), >1 == self osc */ + t_float _reso = *reso++; freq_rms += _freq * _freq; reso_rms += _reso * _reso; } @@ -238,8 +247,9 @@ static t_int *resofilt_perform_threepole(t_int *w) r = cbrt(reso_rms); - /* calculate the new pole locations - we use an impulse invariant transform: the 303 vcf poles are located at + /* calculate the new pole locations. we use an impulse invariant + transform: the 303 vcf poles are located at + s_p = omega(-1 + r sqrt(5) e^{pi/3(1+2p)}) real pole: omega * (-1 -r) @@ -248,13 +258,13 @@ static t_int *resofilt_perform_threepole(t_int *w) imag = omega (+- 2 r) - this is a strange beast. legend goes it was "invented" by taking the moog vcf - and moving one cap up, such that the not-so controllable 3-pole that emerged - would avoid the moog patent.. + this is a strange beast. legend goes it was "invented" by taking + the moog vcf and moving one cap up, such that the not-so + controllable 3-pole that emerged would avoid the moog patent.. - so, the sound is not so much the locations of the poles, but how the filter - reacts to time varying controls. i.e. the pole movement with constant reso, - used in the tb-303. + so, the sound is not so much the locations of the poles, but how + the filter reacts to time varying controls. i.e. the pole + movement with constant reso, used in the tb-303. */ @@ -320,7 +330,8 @@ static t_int *resofilt_perform_threepole(t_int *w) *out++ = x; - /* saturate (normalize if pow > 1) state to prevent explosion and to allow self-osc */ + /* saturate (normalize if pow > 1) state to prevent explosion + * and to allow self-osc */ _sat_state(stateA); _sat_state(stateB); diff --git a/modules/sbosc~.c b/modules/sbosc~.c index 511c770..7b740b8 100644 --- a/modules/sbosc~.c +++ b/modules/sbosc~.c @@ -1,7 +1,7 @@ /* - * sbosc.c - smallband oscillator. periodic, linear interpolated frequency center. - * data organization is in (real, imag) pairs - * the first 2 components are (DC, NY) + * sbosc.c - smallband oscillator. periodic, linear interpolated + * frequency center. + * * Copyright (c) 2000-2003 by Tom Schouten * * This program is free software; you can redistribute it and/or modify diff --git a/modules/scrollgrid1D~.c b/modules/scrollgrid1D~.c index bcac7fe..d47bb51 100644 --- a/modules/scrollgrid1D~.c +++ b/modules/scrollgrid1D~.c @@ -21,14 +21,15 @@ /* 1D scroll grid attractor for more information see: - Yalcin M., Ozoguz S., Suykens J.A.K., Vandewalle J., - ``Families of Scroll Grid Attractors'', - International Journal of Bifurcation and Chaos, vol. 12, no. 1, Jan. 2002, pp. 23-41. - - this file implements a digital variant of the method introduced in the paper, - so that it can be used as a parametrizable, bounded chatotic oscillator. - in short it is a switched linear system, with some added hard limiting to - convert unstable oscillations into stable ones. + Yalcin M., Ozoguz S., Suykens J.A.K., Vandewalle J., ``Families of + Scroll Grid Attractors'', International Journal of Bifurcation and + Chaos, vol. 12, no. 1, Jan. 2002, pp. 23-41. + + this file implements a digital variant of the method introduced in + the paper, so that it can be used as a parametrizable, bounded + chatotic oscillator. in short it is a switched linear system, + with some added hard limiting to convert unstable oscillations + into stable ones. */ @@ -108,9 +109,12 @@ static t_int *scrollgrid1D_perform(t_int *w) //post("%f", r1); /* base transform + clipping to prevent blowup */ - x = _sat(0.5f * (state[0] - state[2]), (float)o); /* projection onto axis containing fixed */ - y = _sat(0.5f * state[1], 1.0f); /* the "pure" oscillation axis */ - z = _sat(0.5f * (state[0] + state[2]), 1.0f); /* orthogonal complement of x */ + /* projection onto axis containing fixed */ + x = _sat(0.5f * (state[0] - state[2]), (float)o); + /* the "pure" oscillation axis */ + y = _sat(0.5f * state[1], 1.0f); + /* orthogonal complement of x */ + z = _sat(0.5f * (state[0] + state[2]), 1.0f); /* output */ *outx++ = x; @@ -209,12 +213,14 @@ static void *scrollgrid1D_new(t_floatarg algotype) void scrollgrid1D_tilde_setup(void) { //post("scrollgrid1D~ v0.1"); - scrollgrid1D_class = class_new(gensym("scrollgrid1D~"), (t_newmethod)scrollgrid1D_new, + scrollgrid1D_class = class_new(gensym("scrollgrid1D~"), + (t_newmethod)scrollgrid1D_new, (t_method)scrollgrid1D_free, sizeof(t_scrollgrid1D), 0, A_DEFFLOAT, 0); CLASS_MAINSIGNALIN(scrollgrid1D_class, t_scrollgrid1D, x_f); - class_addmethod(scrollgrid1D_class, (t_method)scrollgrid1D_dsp, gensym("dsp"), 0); - class_addmethod(scrollgrid1D_class, (t_method)scrollgrid1D_reset, gensym("reset"), 0); - + class_addmethod(scrollgrid1D_class, (t_method)scrollgrid1D_dsp, + gensym("dsp"), 0); + class_addmethod(scrollgrid1D_class, (t_method)scrollgrid1D_reset, + gensym("reset"), 0); } diff --git a/modules/statwav~.c b/modules/statwav~.c index 13d9c9f..4fd2765 100644 --- a/modules/statwav~.c +++ b/modules/statwav~.c @@ -1,7 +1,6 @@ /* - * dynwav.c - static wavetable oscillator (scale + tabread) - * data organization is in (real, imag) pairs - * the first 2 components are (DC, NY) + * statwav.c - static wavetable oscillator (scale + tabread) + * * Copyright (c) 2000-2003 by Tom Schouten * * This program is free software; you can redistribute it and/or modify diff --git a/modules/tabreadmix~.c b/modules/tabreadmix~.c index d787f02..9661ec4 100644 --- a/modules/tabreadmix~.c +++ b/modules/tabreadmix~.c @@ -17,8 +17,6 @@ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA. */ -#include -#include #include "extlib_util.h" /******************** tabreadmix~ ***********************/ @@ -105,11 +103,14 @@ static t_int *tabreadmix_tilde_perform(t_int *w) /* mix and write */ newpos = (int)(*pos++); - *out++ = currgain * buf[x->x_currpos++] + prevgain * buf[x->x_prevpos++]; + *out++ = currgain * buf[x->x_currpos++] + + prevgain * buf[x->x_prevpos++]; /* advance oscillator */ - c = x->x_xfade_state_c * x->x_xfade_cos - x->x_xfade_state_s * x->x_xfade_sin; - s = x->x_xfade_state_c * x->x_xfade_sin + x->x_xfade_state_s * x->x_xfade_cos; + c = x->x_xfade_state_c * x->x_xfade_cos + - x->x_xfade_state_s * x->x_xfade_sin; + s = x->x_xfade_state_c * x->x_xfade_sin + + x->x_xfade_state_s * x->x_xfade_cos; x->x_xfade_state_c = c; x->x_xfade_state_s = s; } -- cgit v1.2.1