aboutsummaryrefslogtreecommitdiff
path: root/pd/extra
diff options
context:
space:
mode:
Diffstat (limited to 'pd/extra')
-rw-r--r--pd/extra/expr-help.pd110
-rw-r--r--pd/extra/makefile2
-rw-r--r--pd/extra/sigmund~/sigmund~-help.pd4
-rw-r--r--pd/extra/sigmund~/sigmund~.c186
4 files changed, 189 insertions, 113 deletions
diff --git a/pd/extra/expr-help.pd b/pd/extra/expr-help.pd
index adc575fb..8fafb35d 100644
--- a/pd/extra/expr-help.pd
+++ b/pd/extra/expr-help.pd
@@ -1,4 +1,4 @@
-#N canvas 70 36 1012 579 10;
+#N canvas 165 94 1012 579 12;
#X text 66 10 expression evaluation family - expr \, expr~ \, fexpr~
;
#X text 63 239 Syntyax:;
@@ -37,34 +37,34 @@ semicolon is used to separates the expressions.;
#X text 635 309 $y1 -> $y1[-1] $y2 -> $y2[-1] .....;
#N canvas 0 0 828 385 Examples 0;
#X obj 33 151 expr 1;
-#X floatatom 197 119 0 0 0;
-#X floatatom 33 181 0 0 0;
+#X floatatom 197 119 0 0 0 0 - - -;
+#X floatatom 33 181 0 0 0 0 - - -;
#X msg 33 123 bang;
#X obj 101 149 expr 2 + 3;
#X msg 101 122 bang;
-#X floatatom 101 177 0 0 0;
-#X floatatom 196 177 0 0 0;
+#X floatatom 101 177 0 0 0 0 - - -;
+#X floatatom 196 177 0 0 0 0 - - -;
#X obj 196 149 expr 2+$f1;
-#X floatatom 34 220 0 0 0;
-#X floatatom 34 277 0 0 0;
+#X floatatom 34 220 0 0 0 0 - - -;
+#X floatatom 34 277 0 0 0 0 - - -;
#X obj 34 249 expr $f1 * $f2;
-#X floatatom 113 220 0 0 0;
-#N canvas 0 0 450 300 graph1 0;
+#X floatatom 113 220 0 0 0 0 - - -;
+#N canvas 0 0 450 300 (subpatch) 0;
#X array array1 10 float 0;
#X coords 0 10 10 0 200 150 1;
#X restore 584 180 graph;
-#X floatatom 35 315 0 0 0;
-#X floatatom 35 371 0 0 0;
-#X floatatom 194 219 0 0 0;
-#X floatatom 194 276 0 0 0;
+#X floatatom 35 315 0 0 0 0 - - -;
+#X floatatom 35 371 0 0 0 0 - - -;
+#X floatatom 194 219 0 0 0 0 - - -;
+#X floatatom 194 276 0 0 0 0 - - -;
#X obj 194 248 expr $s2[$f1];
#X msg 267 220 symbol array1;
#X obj 35 343 expr sin(2 * 3.14159 * $f1 / 360);
#X msg 330 281 \; array1 1 4 2 8 5 6 1 4 2 8 5 6;
-#X floatatom 310 184 5 0 0;
-#X floatatom 395 186 5 0 0;
-#X floatatom 480 184 5 0 0;
-#X floatatom 310 105 5 0 0;
+#X floatatom 310 184 5 0 0 0 - - -;
+#X floatatom 395 186 5 0 0 0 - - -;
+#X floatatom 480 184 5 0 0 0 - - -;
+#X floatatom 310 105 5 0 0 0 - - -;
#X obj 310 132 expr $f1 \; if ($f1 > 0 \, $f1 * 2 \, 0) \; if ($f1
<= 0 \, $f1 / 2 \, 0);
#X text 34 56 Examples of expr object;
@@ -94,15 +94,15 @@ semicolon is used to separates the expressions.;
#X obj -24 355 print~;
#X msg 13 334 bang;
#X obj -24 276 sig~ 440;
-#X floatatom 49 293 0 0 0;
-#X floatatom -24 253 0 0 0;
+#X floatatom 49 293 0 0 0 0 - - -;
+#X floatatom -24 253 0 0 0 0 - - -;
#X obj -24 316 expr~ $v1*$f2;
#X obj 85 356 print~;
#X msg 101 335 bang;
-#X floatatom 85 268 0 0 0;
-#X floatatom 158 270 0 0 0;
-#X floatatom 357 291 0 0 0;
-#X floatatom 244 267 0 0 0;
+#X floatatom 85 268 0 0 0 0 - - -;
+#X floatatom 158 270 0 0 0 0 - - -;
+#X floatatom 357 291 0 0 0 0 - - -;
+#X floatatom 244 267 0 0 0 0 - - -;
#X obj 244 294 osc~;
#X msg 369 47 \; pd dsp 0;
#X msg 291 49 \; pd dsp 1;
@@ -114,9 +114,9 @@ semicolon is used to separates the expressions.;
#X text 241 245 frequency;
#X text 373 273 amplitude;
#X obj 85 315 expr~ $v1*$v2;
-#X floatatom 207 471 5 0 0;
+#X floatatom 207 471 5 0 0 0 - - -;
#X obj -40 520 tabsend~ a1;
-#N canvas 0 0 450 300 graph4 0;
+#N canvas 0 0 450 300 (subpatch) 0;
#X array a1 64 float 0;
#X coords 0 1 63 -1 200 140 1;
#X restore -39 542 graph;
@@ -134,20 +134,20 @@ $i1 \, this may change in later releases;
#X obj 417 522 tabsend~ a2;
#X obj 580 518 tabsend~ a3;
#X obj 417 439 osc~ 2756.25;
-#N canvas 0 0 450 300 graph1 0;
+#N canvas 0 0 450 300 (subpatch) 0;
#X array a2 64 float 1;
-#A 0 -0.419198 -0.487122 -0.481805 -0.400382 -0.252053 -0.0571681 0.155563
-0.353314 0.504227 0.582557 0.573016 0.473664 0.296682 0.0669659 -0.18137
--0.410083 -0.582709 -0.670415 -0.656787 -0.540803 -0.337462 -0.0758923
-0.204826 0.461522 0.653623 0.74958 0.732042 0.600932 0.373867 0.0838359
--0.225617 -0.506972 -0.716061 -0.819026 -0.797803 -0.653251 -0.405409
--0.0906877 0.243486 0.545852 0.769218 0.877835 0.853191 0.697093 0.431698
-0.096368 -0.258195 -0.577642 -0.812367 -0.925245 -0.897515 -0.731894
--0.452386 -0.100793 0.269551 0.601932 0.844984 0.960659 0.930205 0.757204
-0.467199 0.103913 -0.277405 -0.618414;
+#A 0 -0.797042 -0.728354 -0.551199 -0.29486 -5.74798e-08 0.28779 0.525076
+0.677165 0.723186 0.658973 0.49724 0.265198 -5.86755e-06 -0.257244
+-0.467812 -0.601285 -0.639938 -0.581051 -0.436842 -0.232108 -4.49318e-08
+0.223344 0.404462 0.517604 0.548393 0.495593 0.370771 0.195993 -4.2964e-06
+-0.186556 -0.335875 -0.427214 -0.449737 -0.4037 -0.299884 -0.157342
+-3.00576e-08 0.14734 0.262927 0.331275 0.34523 0.306564 0.225106 0.116645
+-2.503e-06 -0.106219 -0.186565 -0.231035 -0.236249 -0.205455 -0.147412
+-0.0744387 -1.36289e-08 0.0637127 0.10778 0.127799 0.124205 0.101679
+0.0677997 0.0312617 -5.8003e-07 -0.0203835 -0.0275998 -0.0229047;
#X coords 0 1 63 -1 200 140 1;
#X restore 347 554 graph;
-#N canvas 0 0 450 300 graph2 0;
+#N canvas 0 0 450 300 (subpatch) 0;
#X array a3 64 float 0;
#X coords 0 1 63 -1 200 140 1;
#X restore 569 554 graph;
@@ -184,17 +184,17 @@ $i1 \, this may change in later releases;
#X msg 428 84 \; pd dsp 1;
#X text 426 64 audio on;
#X text 518 65 audio off;
-#X floatatom 126 304 0 0 0;
-#X floatatom 259 323 0 0 0;
+#X floatatom 126 304 0 0 0 0 - - -;
+#X floatatom 259 323 0 0 0 0 - - -;
#X msg 226 283 -10;
#X text 53 103 fexpr~ examples:;
#X obj 125 571 print~;
#X msg 247 552 bang;
-#X floatatom 125 475 0 0 0;
+#X floatatom 125 475 0 0 0 0 - - -;
#X obj 126 347 fexpr~ ($x1[$f2]+$x1)/2;
#X obj 125 532 fexpr~ $x1+$y[-1];
-#X floatatom 635 366 0 0 0;
-#X floatatom 795 387 0 0 0;
+#X floatatom 635 366 0 0 0 0 - - -;
+#X floatatom 795 387 0 0 0 0 - - -;
#X obj 630 456 dac~;
#X obj 632 407 fexpr~ ($x1[$f2/1000]+$x1)/2;
#X msg 864 317 0 10000;
@@ -329,15 +329,15 @@ output;
#X obj 176 67 v pr;
#X obj 307 68 v r;
#X obj 233 69 v b;
-#X floatatom 176 38 5 0 0;
-#X floatatom 307 40 5 0 0;
+#X floatatom 176 38 5 0 0 0 - - -;
+#X floatatom 307 40 5 0 0 0 - - -;
#X msg 177 13 10;
#X obj 231 10 expr 8./3;
#X msg 128 136 set 1.2 2.3 4.4;
-#X floatatom 233 39 7 0 0;
+#X floatatom 233 39 7 0 0 0 - - -;
#X msg 75 46 stop;
#X msg 75 67 start;
-#X floatatom 399 40 5 0 0;
+#X floatatom 399 40 5 0 0 0 - - -;
#X obj 399 69 v dt;
#X msg 310 12 18;
#X msg 395 13 0.01;
@@ -366,15 +366,15 @@ which generate chotic signals;
#X obj 128 298 tabsend~ lorenz1a;
#X obj 234 278 tabsend~ lorenz2a;
#X obj 339 259 tabsend~ lorenz3a;
-#N canvas 0 0 450 300 graph1 0;
+#N canvas 0 0 450 300 (subpatch) 0;
#X array lorenz1a 64 float 0;
#X coords 0 1 63 -1 200 140 1;
#X restore 73 437 graph;
-#N canvas 0 0 450 300 graph2 0;
+#N canvas 0 0 450 300 (subpatch) 0;
#X array lorenz2a 64 float 0;
#X coords 0 1 63 -1 200 140 1;
#X restore 331 435 graph;
-#N canvas 0 0 450 300 graph3 0;
+#N canvas 0 0 450 300 (subpatch) 0;
#X array lorenz3a 64 float 0;
#X coords 0 1 63 -1 200 140 1;
#X restore 592 436 graph;
@@ -413,27 +413,27 @@ which generate chotic signals;
#X obj 176 67 v pr;
#X obj 307 68 v r;
#X obj 233 69 v b;
-#X floatatom 176 38 5 0 0;
-#X floatatom 307 40 5 0 0;
+#X floatatom 176 38 5 0 0 0 - - -;
+#X floatatom 307 40 5 0 0 0 - - -;
#X msg 177 13 10;
#X obj 231 10 expr 8./3;
-#N canvas 0 0 450 300 graph1 0;
+#N canvas 0 0 450 300 (subpatch) 0;
#X array lorenz1 2048 float 0;
#X coords 0 -1 2047 1 200 140 1;
#X restore 82 357 graph;
-#N canvas 0 0 450 300 graph2 0;
+#N canvas 0 0 450 300 (subpatch) 0;
#X array lorenz2 2048 float 0;
#X coords 0 -1 2047 1 200 140 1;
#X restore 327 353 graph;
-#N canvas 0 0 450 300 graph3 0;
+#N canvas 0 0 450 300 (subpatch) 0;
#X array lorenz3 2048 float 0;
#X coords 0 -1 2047 1 200 140 1;
#X restore 570 347 graph;
#X msg 128 136 set 1.2 2.3 4.4;
-#X floatatom 233 39 7 0 0;
+#X floatatom 233 39 7 0 0 0 - - -;
#X msg 75 46 stop;
#X msg 75 67 start;
-#X floatatom 399 40 5 0 0;
+#X floatatom 399 40 5 0 0 0 - - -;
#X obj 399 69 v dt;
#X msg 310 12 18;
#X msg 395 13 0.01;
diff --git a/pd/extra/makefile b/pd/extra/makefile
index 9b2dd931..ee028616 100644
--- a/pd/extra/makefile
+++ b/pd/extra/makefile
@@ -37,7 +37,7 @@ LINUXINCLUDE = -I../../src
.c.pd_linux:
$(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
- $(CC) -export_dynamic -shared -o $*.pd_linux $*.o -lc -lm
+ $(CC) -shared -o $*.pd_linux $*.o -lc -lm
strip --strip-unneeded $*.pd_linux
rm -f $*.o
diff --git a/pd/extra/sigmund~/sigmund~-help.pd b/pd/extra/sigmund~/sigmund~-help.pd
index 9b3e1caa..5ddbf6d1 100644
--- a/pd/extra/sigmund~/sigmund~-help.pd
+++ b/pd/extra/sigmund~/sigmund~-help.pd
@@ -1,4 +1,4 @@
-#N canvas 193 41 580 617 12;
+#N canvas 167 -7 580 617 12;
#X text 42 4 sigmund~ - sinusoidal analysis and pitch tracking;
#N canvas 432 117 573 597 using-with-tables 0;
#X obj 29 368 print peak;
@@ -90,7 +90,7 @@ of a note at or near the previously output pitch.;
#X connect 1 0 2 0;
#X connect 2 0 3 0;
#X restore 330 531 pd setting-parameters;
-#N canvas 149 65 641 815 sinusoid-tracking 0;
+#N canvas 67 29 641 815 sinusoid-tracking 0;
#X obj 124 267 sigmund~ -npeak 10 peaks;
#X obj 124 214 phasor~;
#X obj 124 144 loadbang;
diff --git a/pd/extra/sigmund~/sigmund~.c b/pd/extra/sigmund~/sigmund~.c
index 58a3858f..03e4ab55 100644
--- a/pd/extra/sigmund~/sigmund~.c
+++ b/pd/extra/sigmund~/sigmund~.c
@@ -13,7 +13,7 @@
and usable in other contexts. The one external requirement is a real
single-precision FFT, invoked as in the Mayer one: */
-#if (defined(NT) && defined(PD)) /* ignore this, it's just Microsoft nonsense */
+#ifdef NT
__declspec(dllimport) extern
#endif
void mayer_realfft(int npoints, float *buf);
@@ -572,6 +572,8 @@ static void notefinder_doit(t_notefinder *x, float freq, float power,
int oldhistphase, i, k;
if (stableperiod > NHISTPOINT - 1)
stableperiod = NHISTPOINT - 1;
+ else if (stableperiod < 1)
+ stableperiod = 1;
if (++x->n_histphase == NHISTPOINT)
x->n_histphase = 0;
x->n_hist[x->n_histphase].h_freq = freq;
@@ -655,9 +657,9 @@ static void notefinder_doit(t_notefinder *x, float freq, float power,
else if (x->n_hifreq > 0 && x->n_age > stableperiod)
{
/* if we've been out of range at least 1/2 the
- last "stableperiod" analyses, clear the note */
+ last "stableperiod+1" analyses, clear the note */
int nbad = 0;
- for (i = 0, k = x->n_histphase; i < stableperiod - 1; i++)
+ for (i = 0, k = x->n_histphase; i < stableperiod + 1; i++)
{
if (--k < 0)
k = NHISTPOINT - 1;
@@ -665,7 +667,7 @@ static void notefinder_doit(t_notefinder *x, float freq, float power,
x->n_lofreq * vibmultiple <= x->n_hist[k].h_freq)
nbad++;
}
- if (2 * nbad >= stableperiod)
+ if (2 * nbad >= stableperiod + 1)
{
x->n_hifreq = x->n_lofreq = 0;
x->n_age = 0;
@@ -703,9 +705,9 @@ static void notefinder_doit(t_notefinder *x, float freq, float power,
if (freq >= 0 &&
(x->n_hifreq <= 0 || freq > x->n_hifreq || freq < x->n_lofreq))
{
- float testfhi, testflo, maxpow = 0;
- for (i = 0, k = x->n_histphase, testfhi = testflo = freq;
- i < stableperiod-1; i++)
+ float testfhi = freq, testflo = freq,
+ maxpow = x->n_hist[x->n_histphase].h_freq;
+ for (i = 0, k = x->n_histphase; i < stableperiod-1; i++)
{
if (--k < 0)
k = NHISTPOINT - 1;
@@ -716,6 +718,11 @@ static void notefinder_doit(t_notefinder *x, float freq, float power,
if (x->n_hist[k].h_power > maxpow)
maxpow = x->n_hist[k].h_power;
}
+#if 0
+ if (loud)
+ post("freq %.2g testfhi %.2g testflo %.2g maxpow %.2g",
+ freq, testfhi, testflo, maxpow);
+#endif
if (testflo > 0 && testfhi <= vibmultiple * testflo
&& maxpow > powerthresh)
{
@@ -817,6 +824,7 @@ typedef struct _sigmund
t_pxobject x_obj;
void *obex;
void *x_clock;
+ t_sample *x_inbuf2; /* extra input buffer to eat clock/DSP jitter */
#endif /* MSP */
t_varout *x_varoutv;
int x_nvarout;
@@ -867,6 +875,9 @@ static void sigmund_preinit(t_sigmund *x)
x->x_ntrack = 0;
x->x_dopitch = x->x_donote = x->x_dotracks = 0;
x->x_inbuf = 0;
+#ifdef MSP
+ x->x_inbuf2 = 0;
+#endif
}
static void sigmund_npts(t_sigmund *x, t_floatarg f)
@@ -884,9 +895,23 @@ static void sigmund_npts(t_sigmund *x, t_floatarg f)
if (x->x_mode == MODE_STREAM)
{
if (x->x_inbuf)
+ {
x->x_inbuf = (t_sample *)t_resizebytes(x->x_inbuf,
sizeof(*x->x_inbuf) * nwas, sizeof(*x->x_inbuf) * npts);
- else x->x_inbuf = (t_sample *)getbytes(sizeof(*x->x_inbuf) * npts);
+#ifdef MSP
+ x->x_inbuf2 = (t_sample *)t_resizebytes(x->x_inbuf2,
+ sizeof(*x->x_inbuf2) * nwas, sizeof(*x->x_inbuf2) * npts);
+#endif
+ }
+ else
+ {
+ x->x_inbuf = (t_sample *)getbytes(sizeof(*x->x_inbuf) * npts);
+ memset((char *)(x->x_inbuf), 0, sizeof(*x->x_inbuf) * npts);
+#ifdef MSP
+ x->x_inbuf2 = (t_sample *)getbytes(sizeof(*x->x_inbuf2) * npts);
+ memset((char *)(x->x_inbuf2), 0, sizeof(*x->x_inbuf2) * npts);
+#endif
+ }
}
else x->x_inbuf = 0;
x->x_npts = npts;
@@ -954,7 +979,7 @@ static void sigmund_doit(t_sigmund *x, int npts, float *arraypoints,
sigmund_getpitch(nfound, peakv, &freq, npts, srate, loud);
if (x->x_donote)
notefinder_doit(&x->x_notefinder, freq, power, &note, x->x_vibrato,
- x->x_stabletime * 0.001f * x->x_sr / (float)x->x_hop,
+ 1 + x->x_stabletime * 0.001f * x->x_sr / (float)x->x_hop,
exp(LOG10*0.1*(x->x_minpower - 100)), x->x_growth, loud);
if (x->x_dotracks)
sigmund_peaktrack(nfound, peakv, x->x_ntrack, x->x_trackv, loud);
@@ -1001,49 +1026,7 @@ static void sigmund_doit(t_sigmund *x, int npts, float *arraypoints,
}
}
-static void sigmund_tick(t_sigmund *x)
-{
- if (x->x_infill == x->x_npts)
- {
- sigmund_doit(x, x->x_npts, x->x_inbuf, x->x_loud, x->x_sr);
- if (x->x_hop >= x->x_npts)
- {
- x->x_infill = 0;
- x->x_countdown = x->x_hop - x->x_npts;
- }
- else
- {
- memmove(x->x_inbuf, x->x_inbuf + x->x_hop,
- (x->x_infill = x->x_npts - x->x_hop) * sizeof(*x->x_inbuf));
- x->x_countdown = 0;
- }
- x->x_loud = 0;
- }
-}
-
-static t_int *sigmund_perform(t_int *w)
-{
- t_sigmund *x = (t_sigmund *)(w[1]);
- float *in = (float *)(w[2]);
- int n = (int)(w[3]);
-
- if (x->x_hop % n)
- return (w+4);
- if (x->x_countdown > 0)
- x->x_countdown -= n;
- else if (x->x_infill != x->x_npts)
- {
- int j;
- float *fp = x->x_inbuf + x->x_infill;
- for (j = 0; j < n; j++)
- *fp++ = *in++;
- x->x_infill += n;
- if (x->x_infill == x->x_npts)
- clock_delay(x->x_clock, 0);
- }
- return (w+4);
-}
-
+static t_int *sigmund_perform(t_int *w);
static void sigmund_dsp(t_sigmund *x, t_signal **sp)
{
if (x->x_mode == MODE_STREAM)
@@ -1072,7 +1055,12 @@ static void sigmund_print(t_sigmund *x)
static void sigmund_free(t_sigmund *x)
{
if (x->x_inbuf)
+ {
freebytes(x->x_inbuf, x->x_npts * sizeof(*x->x_inbuf));
+#ifdef MSP
+ freebytes(x->x_inbuf2, x->x_npts * sizeof(*x->x_inbuf2));
+#endif
+ }
if (x->x_trackv)
freebytes(x->x_trackv, x->x_ntrack * sizeof(*x->x_trackv));
clock_free(x->x_clock);
@@ -1095,6 +1083,50 @@ static void sigmund_stabletime(t_sigmund *x, t_floatarg f);
static void sigmund_growth(t_sigmund *x, t_floatarg f);
static void sigmund_minpower(t_sigmund *x, t_floatarg f);
+static void sigmund_tick(t_sigmund *x)
+{
+ if (x->x_infill == x->x_npts)
+ {
+ sigmund_doit(x, x->x_npts, x->x_inbuf, x->x_loud, x->x_sr);
+ if (x->x_hop >= x->x_npts)
+ {
+ x->x_infill = 0;
+ x->x_countdown = x->x_hop - x->x_npts;
+ }
+ else
+ {
+ memmove(x->x_inbuf, x->x_inbuf + x->x_hop,
+ (x->x_infill = x->x_npts - x->x_hop) * sizeof(*x->x_inbuf));
+ x->x_countdown = 0;
+ }
+ if (x->x_loud)
+ x->x_loud--;
+ }
+}
+
+static t_int *sigmund_perform(t_int *w)
+{
+ t_sigmund *x = (t_sigmund *)(w[1]);
+ float *in = (float *)(w[2]);
+ int n = (int)(w[3]);
+
+ if (x->x_hop % n)
+ return (w+4);
+ if (x->x_countdown > 0)
+ x->x_countdown -= n;
+ else if (x->x_infill != x->x_npts)
+ {
+ int j;
+ float *fp = x->x_inbuf + x->x_infill;
+ for (j = 0; j < n; j++)
+ *fp++ = *in++;
+ x->x_infill += n;
+ if (x->x_infill == x->x_npts)
+ clock_delay(x->x_clock, 0);
+ }
+ return (w+4);
+}
+
static void *sigmund_new(t_symbol *s, int argc, t_atom *argv)
{
t_sigmund *x = (t_sigmund *)pd_new(sigmund_class);
@@ -1358,7 +1390,7 @@ void sigmund_tilde_setup(void)
gensym("print"), 0);
class_addmethod(sigmund_class, (t_method)sigmund_printnext,
gensym("printnext"), A_FLOAT, 0);
- post("sigmund~ version 0.04");
+ post("sigmund~ version 0.05");
}
#endif /* PD */
@@ -1369,6 +1401,50 @@ void sigmund_tilde_setup(void)
#ifdef MSP
static void *sigmund_class;
+/* Max/MSP has laxer sync between DSP and "tick"s - so in the perf routine we
+keep a circular buffer that is rectified into inbuf only when the tick comes. */
+
+static void sigmund_tick(t_sigmund *x)
+{
+ int i, j, npts = x->x_npts;
+ if (!x->x_inbuf)
+ return;
+ for (i = x->x_infill, j = 0; i < npts; i++, j++)
+ x->x_inbuf[j] = x->x_inbuf2[i];
+ for (i = 0; j < npts; i++, j++)
+ x->x_inbuf[j] = x->x_inbuf2[i];
+ sigmund_doit(x, x->x_npts, x->x_inbuf, x->x_loud, x->x_sr);
+ x->x_loud = 0;
+}
+
+static t_int *sigmund_perform(t_int *w)
+{
+ t_sigmund *x = (t_sigmund *)(w[1]);
+ float *in = (float *)(w[2]);
+ int n = (int)(w[3]), j;
+ int infill = x->x_infill;
+ float *fp = x->x_inbuf2 + infill;
+ if (infill < 0 || infill >= x->x_npts)
+ infill = 0;
+ /* for some reason this sometimes happens: */
+ if (!x->x_inbuf2)
+ return (w+4);
+ for (j = 0; j < n; j++)
+ {
+ *fp++ = *in++;
+ if (++infill == x->x_npts)
+ infill = 0, fp = x->x_inbuf2;
+ }
+ x->x_infill = infill;
+ if (x->x_countdown <= 0)
+ {
+ x->x_countdown = x->x_hop;
+ clock_delay(x->x_clock, 0);
+ }
+ x->x_countdown -= n;
+ return (w+4);
+}
+
static void *sigmund_new(t_symbol *s, long ac, t_atom *av)
{
t_sigmund *x;
@@ -1381,7 +1457,7 @@ static void *sigmund_new(t_symbol *s, long ac, t_atom *av)
dsp_setup((t_pxobject *)x, 1);
object_obex_store(x, gensym("dumpout"), outlet_new(x, NULL));
- for (i = 0; i < ac; i++)
+ for (i = 0; i < ac; i++) FIXME
if (av[i].a_type == A_SYM)
{
char *s = av[i].a_w.w_sym->s_name;
@@ -1561,7 +1637,7 @@ int main()
class_register(CLASS_BOX, c);
sigmund_class = c;
- post("sigmund~ v0.04");
+ post("sigmund~ v0.05");
return (0);
}