aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--Makefile21
-rw-r--r--Makefile.config.in4
-rw-r--r--TODO3
-rw-r--r--abs/ti_hihat.pd135
-rw-r--r--doc/scrollgrid1D~.pd72
-rw-r--r--modules++/Makefile2
-rw-r--r--modules/Makefile16
-rw-r--r--modules/bdiag~.c24
-rw-r--r--modules/bfft~.c7
-rw-r--r--modules/bitsplit~.c2
-rw-r--r--modules/blocknorm~.c9
-rw-r--r--modules/cheby~.c6
-rw-r--r--modules/diag~.c6
-rw-r--r--modules/dist~.c7
-rw-r--r--modules/dynwav~.c21
-rw-r--r--modules/eadsr~.c61
-rw-r--r--modules/ead~.c44
-rw-r--r--modules/ear~.c35
-rw-r--r--modules/eblosc~.c81
-rw-r--r--modules/extlib_util.h6
-rw-r--r--modules/fdn~.c35
-rw-r--r--modules/ffpoly.c4
-rw-r--r--modules/filters.h6
-rw-r--r--modules/lattice~.c6
-rw-r--r--modules/permut~.c13
-rw-r--r--modules/qmult~.c3
-rw-r--r--modules/qnorm~.c3
-rw-r--r--modules/resofilt~.c57
-rw-r--r--modules/sbosc~.c6
-rw-r--r--modules/scrollgrid1D~.c36
-rw-r--r--modules/statwav~.c5
-rw-r--r--modules/tabreadmix~.c11
32 files changed, 335 insertions, 412 deletions
diff --git a/Makefile b/Makefile
index c14ac9f..57935dd 100644
--- a/Makefile
+++ b/Makefile
@@ -1,28 +1,29 @@
include Makefile.config
-current:
- make -C system
+all:
make -C modules
make -C modules++
rm -f $(LIBNAME)
- $(CXX) $(LIBFLAGS) -o $(LIBNAME) system/*.o modules/*.o modules++/*.o -lm
+ $(CXX) $(LIBFLAGS) -o $(LIBNAME) modules/*.o modules++/*.o -lm
clean:
- make -C include clean
make -C modules clean
make -C modules++ clean
- make -C system clean
rm -f $(LIBNAME)
rm -f *~
tags:
- etags --language=auto include/*.h system/*.c modules/*.c modules++/*.cpp
+ etags --language=auto */*.c */*.h */*.cpp
tagsclean:
rm -f TAGS
-mrproper: clean tagsclean
- rm -rf Makefile.config config.status config.log configure autom4te.cache
-
-
+install:
+ test -d $(prefix)/lib/pd
+ install -d $(prefix)/lib/pd/extra
+ install -m 755 $(LIBNAME) $(prefix)/lib/pd/extra
+ install -m 644 abs/*.pd $(prefix)/lib/pd/extra
+ install -m 644 doc/*.pd $(prefix)/lib/pd/doc/5.reference
+ install -d $(prefix)/lib/pd/doc/creb
+ install -m 644 doc/examples/*.pd $(prefix)/lib/pd/doc/creb
diff --git a/Makefile.config.in b/Makefile.config.in
index d4a1ae6..6ba5eb6 100644
--- a/Makefile.config.in
+++ b/Makefile.config.in
@@ -2,8 +2,8 @@ PD_INCLUDE_DIR = @PD_INCLUDE_DIR@
LIBNAME = @LIBNAME@
LIBFLAGS = @LIBFLAGS@
-CREB_VERSION = 0.9.0
-
+prefix=@prefix@
+CREB_VERSION = 0.9.2
DEFS = -DPD -DCREB_VERSION=\"$(CREB_VERSION)\"
CFLAGS = $(DEFS) -O2 -funroll-loops -fomit-frame-pointer \
diff --git a/TODO b/TODO
index 68c76a8..981a605 100644
--- a/TODO
+++ b/TODO
@@ -1,4 +1,3 @@
+* rename or remove matrix~
* fix nan/denorm problems in recursive filters
-* fix envelope probs
* rewrite iir (c++) stuff -> filters.h
-
diff --git a/abs/ti_hihat.pd b/abs/ti_hihat.pd
index a75619d..9cd560a 100644
--- a/abs/ti_hihat.pd
+++ b/abs/ti_hihat.pd
@@ -1,9 +1,7 @@
-#N canvas 512 35 209 79 10;
-#X obj 160 133 inlet;
-#X text 9 2 ti_hihat;
-#X obj 211 103 inlet;
-#X obj 151 214 ead~;
-#X obj 114 214 *~;
+#N canvas 172 85 810 555 10;
+#X obj -27 21 inlet;
+#X obj 91 224 ead~;
+#X obj 90 272 *~;
#N canvas 413 387 659 494 hihat 0;
#X obj 27 324 square~;
#X obj 87 324 square~;
@@ -116,80 +114,51 @@
#X connect 47 1 36 1;
#X connect 48 0 46 0;
#X connect 48 1 22 1;
-#X restore 114 184 pd hihat;
-#X obj 112 323 vol~;
-#X obj 140 53 nbx 3 14 -1e+37 1e+37 0 1 empty empty VOL -20 7 0 10
--262144 -1 -1 111.47 256;
-#X obj 140 30 nbx 5 14 20 20000 1 1 empty empty HP -20 7 0 10 -24198
--1 -1 6796.42 256;
-#X obj 113 283 bhip~ 1;
-#X obj 74 30 nbx 3 14 -1e+37 1e+37 0 1 empty empty A' -14 7 0 10 -225271
--1 -1 -17 256;
-#X obj 43 106 +;
-#X obj 12 29 nbx 3 14 -1e+37 1e+37 0 1 empty empty A -10 7 0 10 -260818
--1 -1 16 256;
-#X obj 44 172 +;
-#X obj 13 50 nbx 3 14 -1e+37 1e+37 0 1 empty empty D -10 7 0 10 -260818
--1 -1 156 256;
-#X obj 43 83 *;
-#X obj 44 134 *;
-#X obj 101 347 outlet~;
-#X obj 80 4 tgl 15 1 empty empty empty 0 -6 0 8 -262144 -1 -1 1 1;
-#X obj 178 172 spigot;
-#X obj 74 50 nbx 3 14 -1e+37 1e+37 0 1 empty empty D' -14 7 0 10 -225271
--1 -1 -58 256;
-#X obj 174 152 t b b;
-#X obj 101 106 f;
-#X obj 315 10 inlet;
-#X obj 315 57 unpack 0 0 0 0 0 0;
-#X obj 315 123 symbol set;
-#X obj 315 146 pack s 0 0 0 0 0 0;
-#X obj 314 202 outlet;
-#X obj 315 28 route bang;
-#X msg 315 96 bang;
-#X msg 316 172 \$1 \$2 \$3 \$4 \$5 \$6 \$7;
-#X obj 176 4 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
--1;
-#X connect 0 0 21 0;
-#X connect 2 0 22 0;
-#X connect 3 0 4 1;
-#X connect 4 0 9 0;
-#X connect 5 0 4 0;
-#X connect 6 0 17 0;
-#X connect 7 0 6 1;
-#X connect 7 0 26 6;
-#X connect 8 0 9 1;
-#X connect 8 0 26 5;
-#X connect 9 0 6 0;
-#X connect 10 0 15 1;
-#X connect 10 0 26 3;
-#X connect 11 0 3 1;
-#X connect 12 0 11 1;
-#X connect 12 0 26 1;
-#X connect 13 0 3 2;
-#X connect 14 0 13 1;
-#X connect 14 0 26 2;
-#X connect 15 0 11 0;
-#X connect 16 0 13 0;
-#X connect 18 0 19 1;
-#X connect 19 0 3 0;
-#X connect 20 0 16 1;
-#X connect 20 0 26 4;
-#X connect 21 0 19 0;
-#X connect 22 0 16 0;
-#X connect 22 0 15 0;
-#X connect 23 0 28 0;
-#X connect 24 0 12 0;
-#X connect 24 1 14 0;
-#X connect 24 2 10 0;
-#X connect 24 3 20 0;
-#X connect 24 4 8 0;
-#X connect 24 5 7 0;
-#X connect 25 0 26 0;
-#X connect 26 0 30 0;
-#X connect 28 0 29 0;
-#X connect 28 1 24 0;
-#X connect 29 0 25 0;
-#X connect 30 0 27 0;
-#X connect 31 0 29 0;
-#X coords 0 0 1 1 200 50 1;
+#X restore 105 248 pd hihat;
+#X obj 130 294 nbx 5 14 20 20000 1 1 empty empty HP -20 7 0 10 -24198
+-1 -1 20 256;
+#X obj 89 313 bhip~ 1;
+#X obj 189 42 nbx 3 14 -1e+37 1e+37 0 1 empty empty A' -14 7 0 10 -225271
+-1 -1 5 256;
+#X obj 76 174 +;
+#X obj 38 39 nbx 3 14 -1e+37 1e+37 0 1 empty empty A -10 7 0 10 -260818
+-1 -1 5 256;
+#X obj 145 180 +;
+#X obj 101 39 nbx 3 14 -1e+37 1e+37 0 1 empty empty D -10 7 0 10 -260818
+-1 -1 36 256;
+#X obj 76 141 *;
+#X obj 145 142 *;
+#X obj 89 339 outlet~;
+#X obj 258 41 nbx 3 14 -1e+37 1e+37 0 1 empty empty D' -14 7 0 10 -225271
+-1 -1 36 256;
+#X obj -20 82 t b f;
+#X obj 101 17 inlet;
+#X obj 38 18 inlet;
+#X obj 257 19 inlet;
+#X obj 188 18 inlet;
+#X obj 327 21 inlet;
+#X obj 379 21 inlet;
+#X connect 0 0 15 0;
+#X connect 1 0 2 0;
+#X connect 2 0 5 0;
+#X connect 3 0 2 1;
+#X connect 4 0 5 1;
+#X connect 5 0 13 0;
+#X connect 6 0 11 1;
+#X connect 7 0 1 1;
+#X connect 8 0 7 1;
+#X connect 9 0 1 2;
+#X connect 10 0 9 1;
+#X connect 11 0 7 0;
+#X connect 12 0 9 0;
+#X connect 14 0 12 1;
+#X connect 15 0 1 0;
+#X connect 15 1 11 0;
+#X connect 15 1 12 0;
+#X connect 16 0 10 0;
+#X connect 17 0 8 0;
+#X connect 18 0 14 0;
+#X connect 19 0 6 0;
+#X connect 20 0 4 0;
+#X connect 21 0 3 0;
+#X coords 0 0 0.00245098 0.00260417 200 50 0;
diff --git a/doc/scrollgrid1D~.pd b/doc/scrollgrid1D~.pd
index 1649dfb..16ec412 100644
--- a/doc/scrollgrid1D~.pd
+++ b/doc/scrollgrid1D~.pd
@@ -1,16 +1,16 @@
#N canvas 309 57 748 724 10;
#X obj 116 116 scrollgrid1D~;
#X msg 36 92 reset;
-#X floatatom 111 87 5 0 0;
-#X floatatom 187 87 5 0 0;
-#X floatatom 237 86 5 0 0;
-#X floatatom 290 85 5 0 0;
+#X floatatom 111 87 5 0 0 0 - - -;
+#X floatatom 187 87 5 0 0 0 - - -;
+#X floatatom 237 86 5 0 0 0 - - -;
+#X floatatom 290 85 5 0 0 0 - - -;
#X obj 401 200 tabwrite~ t;
-#X obj 401 147 bng 15 250 50 0 empty empty empty 0 -6 32 8 -262144
--1 -1;
+#X obj 401 147 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
#X obj 504 206 table t 10000;
#X obj 123 222 vol~;
-#X floatatom 146 196 5 0 0;
+#X floatatom 146 196 5 0 0 0 - - -;
#X text 103 47 frequency;
#X text 197 45 T1;
#X text 249 45 T2;
@@ -20,11 +20,11 @@
#X msg 291 65 3;
#X msg 188 65 12;
#X obj 379 222 tabwrite~ t;
-#X obj 379 147 bng 15 250 50 0 empty empty empty 0 -6 32 8 -262144
--1 -1;
+#X obj 379 147 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
#X obj 353 243 tabwrite~ t;
-#X obj 353 148 bng 15 250 50 0 empty empty empty 0 -6 32 8 -262144
--1 -1;
+#X obj 353 148 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
+-1;
#X text 233 292 parameters:;
#X text 266 359 N = number of scrolls or unstable rotation centers
in attractor;
@@ -34,11 +34,11 @@ in attractor;
the other two are orthogonal to this line.;
#X text 368 130 X Y Z;
#X obj 178 222 vol~;
-#X floatatom 201 196 5 0 0;
+#X floatatom 201 196 5 0 0 0 - - -;
#X obj 64 223 vol~;
-#X floatatom 87 197 5 0 0;
+#X floatatom 87 197 5 0 0 0 - - -;
#X obj 63 282 hip~ 10;
-#X floatatom 133 286 5 0 0;
+#X floatatom 133 286 5 0 0 0 - - -;
#X obj 63 305 blop~ 4;
#X msg 132 263 500;
#X msg 163 263 5000;
@@ -49,26 +49,26 @@ some parameter values that would normally cause a blowup \, its behaviour
is limited to that of an oscillator.;
#X obj 4 283 hip~ 10;
#X obj 4 306 blop~ 4;
-#X obj 34 340 dac~;
-#X floatatom 180 170 5 0 0;
+#X floatatom 180 170 5 0 0 0 - - -;
#X obj 4 402 tabwrite~ t;
-#X obj 21 380 bng 15 250 50 0 empty empty empty 0 -6 32 8 -262144 -1
+#X obj 21 380 bng 15 250 50 0 empty empty empty 0 -6 0 8 -262144 -1
-1;
#X msg 142 66 5000;
#X text 264 309 freq = spiral frequency in Hz;
-#X text 265 493 this chaotic system is a switched unstable linear system.
-it consists of N scrolls (outward spirals). when the amplitude of the
-spiral has reached a certain threshold \, it is switched to the nearest
-fixed point (a neighbour spiral). the freq parameter determines the
-frequency of the outward spiralling motion on a scroll. T1 is the outward
-spiralling time constant. T1 large means slow buildup or mild chaotic
-motion \, T1 small means fast buildup or turbulent chaotic motion.
-T2 is the time constant with which a trajectory is attracted to the
-plane of a scroll. T2 small means fast attraction \, T2 large means
-slow attraction.;
#X text 45 11 stabilized scroll grid chaotic oscillator with scroll
centers located on a line.;
#X msg 204 262 17000;
+#X text 265 493 this chaotic system is a switched unstable linear system.
+it consists of N scrolls (outward spirals). when the amplitude of the
+spiral has reached a certain threshold \, it is switched to be attracted
+by a neighbouring scroll. the freq parameter determines the frequency
+of the outward spiralling motion on a scroll. T1 is the outward spiralling
+time constant. T1 large means slow buildup or mild chaotic motion \,
+T1 small means fast buildup or turbulent chaotic motion. T2 is the
+time constant with which a trajectory is attracted to the plane of
+a scroll. T2 small means fast attraction \, T2 large means slow attraction.
+;
+#X obj 94 378 dac~ 4;
#X connect 0 0 21 0;
#X connect 0 0 31 0;
#X connect 0 1 9 0;
@@ -97,15 +97,15 @@ centers located on a line.;
#X connect 33 0 35 0;
#X connect 34 0 35 1;
#X connect 34 0 42 1;
-#X connect 35 0 43 1;
-#X connect 35 0 45 0;
+#X connect 35 0 44 0;
+#X connect 35 0 51 0;
#X connect 36 0 34 0;
#X connect 37 0 34 0;
#X connect 41 0 42 0;
-#X connect 42 0 43 0;
-#X connect 42 0 45 0;
-#X connect 44 0 10 0;
-#X connect 44 0 30 0;
-#X connect 46 0 45 0;
-#X connect 47 0 2 0;
-#X connect 51 0 34 0;
+#X connect 42 0 44 0;
+#X connect 42 0 51 0;
+#X connect 43 0 10 0;
+#X connect 43 0 30 0;
+#X connect 45 0 44 0;
+#X connect 46 0 2 0;
+#X connect 49 0 34 0;
diff --git a/modules++/Makefile b/modules++/Makefile
index 65ba97a..e6842fd 100644
--- a/modules++/Makefile
+++ b/modules++/Makefile
@@ -1,7 +1,7 @@
include ../Makefile.config
current: all
-all: biquadseries.o filterortho.o blosc.o
+all: biquadseries~.o filterortho~.o blosc~.o
clean:
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 <m_pd.h>
-#include <math.h>
+#include "extlib_util.h"
#include <stdio.h>
#include <stdlib.h>
-#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;j<c;j++){
for (i=0;i<n;i++){
- out[j][i] *= s;
+ out[j][i] *= s; // FIXME: clockwize addressing problem
}
}
@@ -113,7 +115,8 @@ static void *blocknorm_new(t_floatarg channels)
x->x_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 <m_pd.h>
-#include <math.h>
+#include "extlib_util.h"
#include <stdio.h>
#include <stdlib.h>
-#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 <m_pd.h>
-#include <math.h>
+#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 <m_pd.h>
-#include <math.h>
#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 <m_pd.h>
-#include <math.h>
#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 <m_pd.h>
-#include <math.h>
#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 <math.h>
#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 <m_pd.h>
-#include <math.h>
-#include "extlib_util.h"
+#include "extlib_util.h"
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
@@ -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 <m_pd.h>
+
#include <math.h>
-#include "extlib_util.h"
#include <stdlib.h>
+//#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; i<n; i++){
- t_float _freq = *freq++; /* first input is the reso frequency (absolute) */
- t_float _reso = *reso++; /* second input is the resonnance (0->1), >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; i<n; i++){
- t_float _freq = *freq++; /* first input is the reso frequency (absolute) */
- t_float _reso = *reso++; /* second input is the resonnance (0->1), >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 <m_pd.h>
-#include <math.h>
#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;
}