aboutsummaryrefslogtreecommitdiff
path: root/externals
diff options
context:
space:
mode:
Diffstat (limited to 'externals')
-rw-r--r--externals/vanilla/Makefile4
-rw-r--r--externals/vanilla/delread~-help.pd33
-rw-r--r--externals/vanilla/delread~.c100
-rw-r--r--externals/vanilla/delwrite~-help.pd15
-rw-r--r--externals/vanilla/delwrite~.c84
-rw-r--r--externals/vanilla/delwrite~.h45
-rw-r--r--externals/vanilla/lib_d_delay.c5
-rw-r--r--externals/vanilla/vd~-help.pd19
-rw-r--r--externals/vanilla/vd~.c96
9 files changed, 394 insertions, 7 deletions
diff --git a/externals/vanilla/Makefile b/externals/vanilla/Makefile
index df04f386..f6a6450f 100644
--- a/externals/vanilla/Makefile
+++ b/externals/vanilla/Makefile
@@ -5,7 +5,7 @@ LIBRARY_NAME = vanilla
# add your .c source files, one object per file, to the SOURCES
# variable, help files will be included automatically
-SOURCES = abs~.c bng.c clip~.c cnv.c dbtopow~.c dbtorms~.c del.c delay.c exp~.c ftom~.c hdl.c hradio.c hsl.c hslider.c key.c keyname.c keyup.c line.c list.c log~.c metro.c mtof~.c my_canvas.c my_numbox.c nbx.c netsend.c netreceive.c openpanel.c pipe.c powtodb~.c pow~.c print.c qlist.c radiobut.c radiobutton.c rdb.c rmstodb~.c rsqrt~.c savepanel.c sqrt~.c textfile.c tgl.c timer.c toggle.c vdl.c vradio.c vsl.c vslider.c vu.c wrap~.c random.c loadbang.c namecanvas.c cputime.c realtime.c bang~.c print~.c adc~.c dac~.c
+SOURCES = abs~.c bng.c clip~.c cnv.c dbtopow~.c dbtorms~.c del.c delay.c exp~.c ftom~.c hdl.c hradio.c hsl.c hslider.c key.c keyname.c keyup.c line.c list.c log~.c metro.c mtof~.c my_canvas.c my_numbox.c nbx.c netsend.c netreceive.c openpanel.c pipe.c powtodb~.c pow~.c print.c qlist.c radiobut.c radiobutton.c rdb.c rmstodb~.c rsqrt~.c savepanel.c sqrt~.c textfile.c tgl.c timer.c toggle.c vdl.c vradio.c vsl.c vslider.c vu.c wrap~.c random.c loadbang.c namecanvas.c cputime.c realtime.c bang~.c print~.c adc~.c dac~.c delread~.c delwrite~.c vd~.c
# list all pd objects (i.e. myobject.pd) files here, and their helpfiles will
# be included automatically
@@ -90,7 +90,7 @@ ifeq ($(UNAME),Darwin)
EXTENSION = pd_darwin
OS = macosx
PD_PATH = /Applications/Pd-extended.app/Contents/Resources
- OPT_CFLAGS = -ftree-vectorize -ftree-vectorizer-verbose=2 -fast
+ OPT_CFLAGS =
# build universal 32-bit on 10.4 and 32/64 on newer
ifeq ($(shell uname -r | sed 's|\([0-9][0-9]*\)\.[0-9][0-9]*\.[0-9][0-9]*|\1|'), 8)
FAT_FLAGS = -arch ppc -arch i386 -mmacosx-version-min=10.4
diff --git a/externals/vanilla/delread~-help.pd b/externals/vanilla/delread~-help.pd
new file mode 100644
index 00000000..682f6e98
--- /dev/null
+++ b/externals/vanilla/delread~-help.pd
@@ -0,0 +1,33 @@
+#N canvas 24 20 796 472 12;
+#X text 351 276 1st argument: name of delay line;
+#X floatatom 116 253 0 0 0;
+#X text 151 255 float input (delay time in ms);
+#X text 127 310 signal output (delayed signal);
+#X text 21 52 You can use more than one delread~ objects for the same delay line.;
+#X text 20 81 If the specified delay time is longer than the size of the delay line or less than zero it is clipped to the length of the delay line.;
+#X obj 383 226 delwrite~ del_example 1000;
+#X floatatom 383 177 0 0 0;
+#X obj 116 375 snapshot~;
+#X floatatom 116 399 0 0 0;
+#X obj 24 246 loadbang;
+#X obj 24 313 metro 200;
+#X msg 32 273 \; pd dsp 1;
+#X obj 116 286 delread~ del_example 1000;
+#X obj 24 16 delread~;
+#X text 424 176 input to delay line;
+#X obj 383 201 sig~;
+#X text 433 443 updated for Pd version 0.33;
+#X text 89 16 - read a signal from a delay line;
+#X text 21 133 Note: if the delaywrite~ runs after the delread~ the minimum delay is actually one DSP period \, not zero.;
+#X text 351 292 2nd argument: (initial) delay time in ms;
+#X obj 126 444 delwrite~;
+#X obj 217 444 vd~;
+#X text 36 443 see also:;
+#X connect 1 0 13 0;
+#X connect 7 0 16 0;
+#X connect 8 0 9 0;
+#X connect 10 0 11 0;
+#X connect 10 0 12 0;
+#X connect 11 0 8 0;
+#X connect 13 0 8 0;
+#X connect 16 0 6 0;
diff --git a/externals/vanilla/delread~.c b/externals/vanilla/delread~.c
new file mode 100644
index 00000000..fb5700eb
--- /dev/null
+++ b/externals/vanilla/delread~.c
@@ -0,0 +1,100 @@
+/* Copyright (c) 1997-1999 Miller Puckette.
+* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+/* send~, delread~, throw~, catch~ */
+
+#include "m_pd.h"
+#include "delwrite~.h"
+
+static t_class *sigdelread_class;
+
+typedef struct _sigdelread
+{
+ t_object x_obj;
+ t_symbol *x_sym;
+ t_float x_deltime; /* delay in msec */
+ int x_delsamps; /* delay in samples */
+ t_float x_sr; /* samples per msec */
+ t_float x_n; /* vector size */
+ int x_zerodel; /* 0 or vecsize depending on read/write order */
+} t_sigdelread;
+
+static void sigdelread_float(t_sigdelread *x, t_float f);
+
+static void *sigdelread_new(t_symbol *s, t_floatarg f)
+{
+ t_sigdelread *x = (t_sigdelread *)pd_new(sigdelread_class);
+ x->x_sym = s;
+ x->x_sr = 1;
+ x->x_n = 1;
+ x->x_zerodel = 0;
+ sigdelread_float(x, f);
+ outlet_new(&x->x_obj, &s_signal);
+ return (x);
+}
+
+static void sigdelread_float(t_sigdelread *x, t_float f)
+{
+ int samps;
+ t_sigdelwrite *delwriter =
+ (t_sigdelwrite *)pd_findbyclass(x->x_sym, sigdelwrite_class);
+ x->x_deltime = f;
+ if (delwriter)
+ {
+ int delsize = delwriter->x_cspace.c_n;
+ x->x_delsamps = (int)(0.5 + x->x_sr * x->x_deltime)
+ + x->x_n - x->x_zerodel;
+ if (x->x_delsamps < x->x_n) x->x_delsamps = x->x_n;
+ else if (x->x_delsamps > delwriter->x_cspace.c_n - DEFDELVS)
+ x->x_delsamps = delwriter->x_cspace.c_n - DEFDELVS;
+ }
+}
+
+static t_int *sigdelread_perform(t_int *w)
+{
+ t_sample *out = (t_sample *)(w[1]);
+ t_delwritectl *c = (t_delwritectl *)(w[2]);
+ int delsamps = *(int *)(w[3]);
+ int n = (int)(w[4]);
+ int phase = c->c_phase - delsamps, nsamps = c->c_n;
+ t_sample *vp = c->c_vec, *bp, *ep = vp + (c->c_n + XTRASAMPS);
+ if (phase < 0) phase += nsamps;
+ bp = vp + phase;
+
+ while (n--)
+ {
+ *out++ = *bp++;
+ if (bp == ep) bp -= nsamps;
+ }
+ return (w+5);
+}
+
+static void sigdelread_dsp(t_sigdelread *x, t_signal **sp)
+{
+ t_sigdelwrite *delwriter =
+ (t_sigdelwrite *)pd_findbyclass(x->x_sym, sigdelwrite_class);
+ x->x_sr = sp[0]->s_sr * 0.001;
+ x->x_n = sp[0]->s_n;
+ if (delwriter)
+ {
+ sigdelwrite_checkvecsize(delwriter, sp[0]->s_n);
+ x->x_zerodel = (delwriter->x_sortno == ugen_getsortno() ?
+ 0 : delwriter->x_vecsize);
+ sigdelread_float(x, x->x_deltime);
+ dsp_add(sigdelread_perform, 4,
+ sp[0]->s_vec, &delwriter->x_cspace, &x->x_delsamps, sp[0]->s_n);
+ }
+ else if (*x->x_sym->s_name)
+ error("delread~: %s: no such delwrite~",x->x_sym->s_name);
+}
+
+void delread_tilde_setup(void)
+{
+ sigdelread_class = class_new(gensym("delread~"),
+ (t_newmethod)sigdelread_new, 0,
+ sizeof(t_sigdelread), 0, A_DEFSYM, A_DEFFLOAT, 0);
+ class_addmethod(sigdelread_class, (t_method)sigdelread_dsp,
+ gensym("dsp"), 0);
+ class_addfloat(sigdelread_class, (t_method)sigdelread_float);
+}
diff --git a/externals/vanilla/delwrite~-help.pd b/externals/vanilla/delwrite~-help.pd
new file mode 100644
index 00000000..50ca3f63
--- /dev/null
+++ b/externals/vanilla/delwrite~-help.pd
@@ -0,0 +1,15 @@
+#N canvas 12 24 663 281 12;
+#X obj 24 16 delwrite~;
+#X obj 24 158 delwrite~ del_line_xxx 500;
+#X text 88 123 signal input;
+#X text 116 16 writes a signal in a delay line;
+#X text 271 156 1st argument: name of delay line;
+#X text 411 243 updated for Pd version 0.33;
+#X obj 24 124 sig~ 0;
+#X text 19 50 Delwrite~ allocates memory for a delay line and writes an audio signal into it. Delread~ objects by hte same name read from the delay line.;
+#X text 294 186 (= max. delay time);
+#X text 271 172 2nd argument: length of delay line in msec;
+#X text 24 203 see also:;
+#X obj 112 205 delread~;
+#X obj 193 205 vd~;
+#X connect 6 0 1 0;
diff --git a/externals/vanilla/delwrite~.c b/externals/vanilla/delwrite~.c
new file mode 100644
index 00000000..808c2f00
--- /dev/null
+++ b/externals/vanilla/delwrite~.c
@@ -0,0 +1,84 @@
+/* Copyright (c) 1997-1999 Miller Puckette.
+* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+/* send~, delread~, throw~, catch~ */
+
+#include "m_pd.h"
+#include "delwrite~.h"
+
+static void *sigdelwrite_new(t_symbol *s, t_floatarg msec)
+{
+ int nsamps;
+ t_sigdelwrite *x = (t_sigdelwrite *)pd_new(sigdelwrite_class);
+ if (!*s->s_name) s = gensym("delwrite~");
+ pd_bind(&x->x_obj.ob_pd, s);
+ x->x_sym = s;
+ nsamps = msec * sys_getsr() * (t_float)(0.001f);
+ if (nsamps < 1) nsamps = 1;
+ nsamps += ((- nsamps) & (SAMPBLK - 1));
+ nsamps += DEFDELVS;
+ x->x_cspace.c_n = nsamps;
+ x->x_cspace.c_vec =
+ (t_sample *)getbytes((nsamps + XTRASAMPS) * sizeof(t_sample));
+ x->x_cspace.c_phase = XTRASAMPS;
+ x->x_sortno = 0;
+ x->x_vecsize = 0;
+ x->x_f = 0;
+ return (x);
+}
+
+static t_int *sigdelwrite_perform(t_int *w)
+{
+ t_sample *in = (t_sample *)(w[1]);
+ t_delwritectl *c = (t_delwritectl *)(w[2]);
+ int n = (int)(w[3]);
+ int phase = c->c_phase, nsamps = c->c_n;
+ t_sample *vp = c->c_vec, *bp = vp + phase, *ep = vp + (c->c_n + XTRASAMPS);
+ phase += n;
+
+ while (n--)
+ {
+ t_sample f = *in++;
+ if (PD_BIGORSMALL(f))
+ f = 0;
+ *bp++ = f;
+ if (bp == ep)
+ {
+ vp[0] = ep[-4];
+ vp[1] = ep[-3];
+ vp[2] = ep[-2];
+ vp[3] = ep[-1];
+ bp = vp + XTRASAMPS;
+ phase -= nsamps;
+ }
+ }
+ bp = vp + c->c_phase;
+
+ c->c_phase = phase;
+ return (w+4);
+}
+
+static void sigdelwrite_dsp(t_sigdelwrite *x, t_signal **sp)
+{
+ dsp_add(sigdelwrite_perform, 3, sp[0]->s_vec, &x->x_cspace, sp[0]->s_n);
+ x->x_sortno = ugen_getsortno();
+ sigdelwrite_checkvecsize(x, sp[0]->s_n);
+}
+
+static void sigdelwrite_free(t_sigdelwrite *x)
+{
+ pd_unbind(&x->x_obj.ob_pd, x->x_sym);
+ freebytes(x->x_cspace.c_vec,
+ (x->x_cspace.c_n + XTRASAMPS) * sizeof(t_sample));
+}
+
+void delwrite_tilde_setup(void)
+{
+ sigdelwrite_class = class_new(gensym("delwrite~"),
+ (t_newmethod)sigdelwrite_new, (t_method)sigdelwrite_free,
+ sizeof(t_sigdelwrite), 0, A_DEFSYM, A_DEFFLOAT, 0);
+ CLASS_MAINSIGNALIN(sigdelwrite_class, t_sigdelwrite, x_f);
+ class_addmethod(sigdelwrite_class, (t_method)sigdelwrite_dsp,
+ gensym("dsp"), 0);
+}
diff --git a/externals/vanilla/delwrite~.h b/externals/vanilla/delwrite~.h
new file mode 100644
index 00000000..260e2c35
--- /dev/null
+++ b/externals/vanilla/delwrite~.h
@@ -0,0 +1,45 @@
+
+typedef struct delwritectl
+{
+ int c_n;
+ t_sample *c_vec;
+ int c_phase;
+} t_delwritectl;
+
+typedef struct _sigdelwrite
+{
+ t_object x_obj;
+ t_symbol *x_sym;
+ t_delwritectl x_cspace;
+ int x_sortno; /* DSP sort number at which this was last put on chain */
+ int x_rsortno; /* DSP sort # for first delread or write in chain */
+ int x_vecsize; /* vector size for delread~ to use */
+ t_float x_f;
+} t_sigdelwrite;
+
+static t_class *sigdelwrite_class;
+
+extern int ugen_getsortno(void);
+
+#define DEFDELVS 64 /* LATER get this from canvas at DSP time */
+
+#define XTRASAMPS 4
+#define SAMPBLK 4
+
+ /* routine to check that all delwrites/delreads/vds have same vecsize */
+static void sigdelwrite_checkvecsize(t_sigdelwrite *x, int vecsize)
+{
+ if (x->x_rsortno != ugen_getsortno())
+ {
+ x->x_vecsize = vecsize;
+ x->x_rsortno = ugen_getsortno();
+ }
+ /*
+ LATER this should really check sample rate and blocking, once that is
+ supported. Probably we don't actually care about vecsize.
+ For now just suppress this check. */
+#if 0
+ else if (vecsize != x->x_vecsize)
+ pd_error(x, "delread/delwrite/vd vector size mismatch");
+#endif
+}
diff --git a/externals/vanilla/lib_d_delay.c b/externals/vanilla/lib_d_delay.c
deleted file mode 100644
index 67fab609..00000000
--- a/externals/vanilla/lib_d_delay.c
+++ /dev/null
@@ -1,5 +0,0 @@
-#include "../../pd/src/d_delay.c"
-void lib_d_delay_setup(void)
-{
- d_delay_setup();
-}
diff --git a/externals/vanilla/vd~-help.pd b/externals/vanilla/vd~-help.pd
new file mode 100644
index 00000000..5a36ff73
--- /dev/null
+++ b/externals/vanilla/vd~-help.pd
@@ -0,0 +1,19 @@
+#N canvas 109 10 654 410 12;
+#X floatatom 50 194 0 0 0;
+#X obj 50 287 outlet~;
+#X text 130 286 signal output (delayed signal);
+#X obj 24 16 vd~;
+#X text 60 9 reads a signal from a delay line at a variable delay time (4-point-interpolation);
+#X obj 50 222 sig~;
+#X text 99 219 signal input (delay time in ms);
+#X obj 50 254 vd~ del_example;
+#X text 193 252 creation argument: name of delay line;
+#X text 31 51 vd~ implements a 4-point interpolating delay tap from a corresponding delwrite~ object. The delay in milliseconds of the tap is specified by the incoming signal.;
+#X text 35 340 see also:;
+#X obj 123 343 delwrite~;
+#X obj 212 342 delread~;
+#X text 354 373 updated for Pd version 0.33;
+#X text 28 103 The delay time is always at least one sample and at most the length of the delay line (specified by hte delwrite~). In addition \, in case the delwrite~ runs later in the DSP loop than the vd~ \, the delay is constrained below by one vector length (64 samples.);
+#X connect 0 0 5 0;
+#X connect 5 0 7 0;
+#X connect 7 0 1 0;
diff --git a/externals/vanilla/vd~.c b/externals/vanilla/vd~.c
new file mode 100644
index 00000000..3998c013
--- /dev/null
+++ b/externals/vanilla/vd~.c
@@ -0,0 +1,96 @@
+/* Copyright (c) 1997-1999 Miller Puckette.
+* For information on usage and redistribution, and for a DISCLAIMER OF ALL
+* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
+
+/* send~, delread~, throw~, catch~ */
+
+#include "m_pd.h"
+#include "delwrite~.h"
+
+static t_class *sigvd_class;
+
+typedef struct _sigvd
+{
+ t_object x_obj;
+ t_symbol *x_sym;
+ t_float x_sr; /* samples per msec */
+ int x_zerodel; /* 0 or vecsize depending on read/write order */
+ t_float x_f;
+} t_sigvd;
+
+static void *sigvd_new(t_symbol *s)
+{
+ t_sigvd *x = (t_sigvd *)pd_new(sigvd_class);
+ if (!*s->s_name) s = gensym("vd~");
+ x->x_sym = s;
+ x->x_sr = 1;
+ x->x_zerodel = 0;
+ outlet_new(&x->x_obj, &s_signal);
+ x->x_f = 0;
+ return (x);
+}
+
+static t_int *sigvd_perform(t_int *w)
+{
+ t_sample *in = (t_sample *)(w[1]);
+ t_sample *out = (t_sample *)(w[2]);
+ t_delwritectl *ctl = (t_delwritectl *)(w[3]);
+ t_sigvd *x = (t_sigvd *)(w[4]);
+ int n = (int)(w[5]);
+
+ int nsamps = ctl->c_n;
+ t_sample limit = nsamps - n - 1;
+ t_sample fn = n-1;
+ t_sample *vp = ctl->c_vec, *bp, *wp = vp + ctl->c_phase;
+ t_sample zerodel = x->x_zerodel;
+ while (n--)
+ {
+ t_sample delsamps = x->x_sr * *in++ - zerodel, frac;
+ int idelsamps;
+ t_sample a, b, c, d, cminusb;
+ if (delsamps < 1.00001f) delsamps = 1.00001f;
+ if (delsamps > limit) delsamps = limit;
+ delsamps += fn;
+ fn = fn - 1.0f;
+ idelsamps = delsamps;
+ frac = delsamps - (t_sample)idelsamps;
+ bp = wp - idelsamps;
+ if (bp < vp + 4) bp += nsamps;
+ d = bp[-3];
+ c = bp[-2];
+ b = bp[-1];
+ a = bp[0];
+ cminusb = c-b;
+ *out++ = b + frac * (
+ cminusb - 0.1666667f * (1.-frac) * (
+ (d - a - 3.0f * cminusb) * frac + (d + 2.0f*a - 3.0f*b)
+ )
+ );
+ }
+ return (w+6);
+}
+
+static void sigvd_dsp(t_sigvd *x, t_signal **sp)
+{
+ t_sigdelwrite *delwriter =
+ (t_sigdelwrite *)pd_findbyclass(x->x_sym, sigdelwrite_class);
+ x->x_sr = sp[0]->s_sr * 0.001;
+ if (delwriter)
+ {
+ sigdelwrite_checkvecsize(delwriter, sp[0]->s_n);
+ x->x_zerodel = (delwriter->x_sortno == ugen_getsortno() ?
+ 0 : delwriter->x_vecsize);
+ dsp_add(sigvd_perform, 5,
+ sp[0]->s_vec, sp[1]->s_vec,
+ &delwriter->x_cspace, x, sp[0]->s_n);
+ }
+ else error("vd~: %s: no such delwrite~",x->x_sym->s_name);
+}
+
+void vd_tilde_setup(void)
+{
+ sigvd_class = class_new(gensym("vd~"), (t_newmethod)sigvd_new, 0,
+ sizeof(t_sigvd), 0, A_DEFSYM, 0);
+ class_addmethod(sigvd_class, (t_method)sigvd_dsp, gensym("dsp"), 0);
+ CLASS_MAINSIGNALIN(sigvd_class, t_sigvd, x_f);
+}