aboutsummaryrefslogtreecommitdiff
path: root/pd/extra
diff options
context:
space:
mode:
authorHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-10-09 16:36:37 +0000
committerHans-Christoph Steiner <eighthave@users.sourceforge.net>2011-10-09 16:36:37 +0000
commit21c068f1916330e90f814bed461fe0821d1665ec (patch)
tree949b73696fff09a44b8d3eb01b70bae7174cbd14 /pd/extra
parentbf8ced1efe1a032342e864edc635fa4e2676670d (diff)
checked in pd-0.43-0.src.tar.gz
svn path=/trunk/; revision=15557
Diffstat (limited to 'pd/extra')
-rw-r--r--pd/extra/Makefile.am10
-rw-r--r--pd/extra/bonk~/GNUmakefile.am28
-rw-r--r--pd/extra/bonk~/bonk~-help.pd4
-rw-r--r--pd/extra/bonk~/bonk~.c29
-rw-r--r--pd/extra/bonk~/makefile2
-rw-r--r--pd/extra/choice/GNUmakefile.am28
-rw-r--r--pd/extra/choice/choice.c2
-rw-r--r--pd/extra/choice/makefile2
-rw-r--r--pd/extra/expr~/GNUmakefile.am50
-rw-r--r--pd/extra/expr~/makefile10
-rw-r--r--pd/extra/expr~/vexp_if.c4
-rw-r--r--pd/extra/fiddle~/GNUmakefile.am28
-rw-r--r--pd/extra/fiddle~/makefile2
-rw-r--r--pd/extra/loop~/GNUmakefile.am28
-rw-r--r--pd/extra/loop~/loop~-help.pd22
-rw-r--r--pd/extra/loop~/loop~.c26
-rw-r--r--pd/extra/loop~/makefile2
-rw-r--r--pd/extra/lrshift~/GNUmakefile.am28
-rw-r--r--pd/extra/lrshift~/lrshift~.c8
-rw-r--r--pd/extra/lrshift~/makefile2
-rw-r--r--pd/extra/makefile.subdir (renamed from pd/extra/makefile)22
-rw-r--r--pd/extra/pd~/GNUmakefile.am31
-rw-r--r--pd/extra/pd~/makefile3
-rw-r--r--pd/extra/pd~/pdsched.c25
-rw-r--r--pd/extra/pd~/pd~.c9
-rw-r--r--pd/extra/pique/GNUmakefile.am28
-rw-r--r--pd/extra/pique/makefile2
-rw-r--r--pd/extra/pique/pique.c42
-rw-r--r--pd/extra/sigmund~/GNUmakefile.am28
-rw-r--r--pd/extra/sigmund~/makefile2
-rw-r--r--pd/extra/sigmund~/sigmund~.c40
-rw-r--r--pd/extra/stdout/GNUmakefile.am28
-rw-r--r--pd/extra/stdout/makefile2
33 files changed, 476 insertions, 101 deletions
diff --git a/pd/extra/Makefile.am b/pd/extra/Makefile.am
new file mode 100644
index 00000000..766073d4
--- /dev/null
+++ b/pd/extra/Makefile.am
@@ -0,0 +1,10 @@
+SUBDIRS=bonk~ choice expr~ fiddle~ loop~ lrshift~ pd~ pique sigmund~ stdout
+
+DIST_SUBDIRS=$(SUBDIRS)
+
+PATCHES =complex-mod~.pd hilbert~.pd rev1-final.pd rev1~.pd rev1-stage.pd rev2~.pd rev3~.pd
+HELPPATCHES=complex-mod~-help.pd hilbert~-help.pd rev1~-help.pd rev2~-help.pd rev3~-help.pd
+
+libpdextradir = $(pkglibdir)/extra
+
+dist_libpdextra_DATA = $(PATCHES) $(HELPPATCHES)
diff --git a/pd/extra/bonk~/GNUmakefile.am b/pd/extra/bonk~/GNUmakefile.am
new file mode 100644
index 00000000..fb9c2ce8
--- /dev/null
+++ b/pd/extra/bonk~/GNUmakefile.am
@@ -0,0 +1,28 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+
+NAME=bonk~
+
+external_LTLIBRARIES = bonk~.la
+SOURCES = bonk~.c
+PATCHES = bonk~-help.pd
+OTHERDATA = templates.txt
+
+###############################
+# you shouldn't need to add anything below here
+dist_external_DATA = $(PATCHES) $(OTHERDATA)
+
+AUTOMAKE_OPTIONS = foreign
+AM_CPPFLAGS = -I$(top_srcdir)/src -DPD
+AM_CFLAGS = @ARCH_CFLAGS@
+AM_LIBS = $(LIBM)
+AM_LDFLAGS = -module -avoid-version -shared @ARCH_LDFLAGS@ -shrext .@EXTERNAL_EXTENSION@ -L$(top_srcdir)/src
+
+externaldir = $(pkglibdir)/extra/$(NAME)
+
+
+if MINGW
+AM_LIBS += -lpd
+endif
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
diff --git a/pd/extra/bonk~/bonk~-help.pd b/pd/extra/bonk~/bonk~-help.pd
index e52b7c50..4666d6f5 100644
--- a/pd/extra/bonk~/bonk~-help.pd
+++ b/pd/extra/bonk~/bonk~-help.pd
@@ -1,4 +1,4 @@
-#N canvas 43 123 1054 583 12;
+#N canvas 0 0 1052 581 12;
#X obj 382 492 spigot;
#X msg 484 293 bang;
#X obj 483 454 bonk~;
@@ -107,7 +107,7 @@ Bonk check the attack against a collection of stored templates to try
to guess which of two or more instruments was hit. Bonk is described
theoretically in the 1998 ICMC proceedings \, reprinted on crca.ucsd.edu/~msp
.;
-#N canvas 723 241 701 719 creation-arguments 0;
+#N canvas 0 0 699 717 creation-arguments 1;
#X text 228 14 creation arguments for bonk~;
#X text 70 272 -npts 256;
#X text 44 244 default value:;
diff --git a/pd/extra/bonk~/bonk~.c b/pd/extra/bonk~/bonk~.c
index d0f18de9..7aaf48da 100644
--- a/pd/extra/bonk~/bonk~.c
+++ b/pd/extra/bonk~/bonk~.c
@@ -82,7 +82,9 @@ void *bonk_class;
static t_class *bonk_class;
#endif
-#ifndef _MSC_VER
+#ifdef _WIN32
+#include <malloc.h>
+#elif ! defined(_MSC_VER)
#include <alloca.h>
#endif
@@ -221,6 +223,8 @@ typedef struct _bonk
double x_learndebounce; /* debounce time (in "learn" mode only) */
int x_attackbins; /* number of bins to wait for attack */
+ t_canvas *x_canvas; /* ptr to current canvas --fbar */
+
t_filterbank *x_filterbank;
t_hist x_hist[MAXNFILTERS];
t_template *x_template;
@@ -962,11 +966,18 @@ static void bonk_bang(t_bonk *x)
static void bonk_read(t_bonk *x, t_symbol *s)
{
- FILE *fd = fopen(s->s_name, "r");
float vec[MAXNFILTERS];
int i, ntemplate = 0, remaining;
float *fp, *fp2;
- if (!fd)
+
+ /* fbar: canvas_open code taken from g_array.c */
+ FILE *fd;
+ char buf[MAXPDSTRING], *bufptr;
+ int filedesc;
+
+ if ((filedesc = canvas_open(x->x_canvas,
+ s->s_name, "", buf, &bufptr, MAXPDSTRING, 0)) < 0
+ || !(fd = fdopen(filedesc, "r")))
{
post("%s: open failed", s->s_name);
return;
@@ -1001,11 +1012,18 @@ nomore:
static void bonk_write(t_bonk *x, t_symbol *s)
{
- FILE *fd = fopen(s->s_name, "w");
+ FILE *fd;
+ char buf[MAXPDSTRING]; /* fbar */
int i, ntemplate = x->x_ntemplate;
t_template *tp = x->x_template;
float *fp;
- if (!fd)
+
+ /* fbar: canvas-code as in g_array.c */
+ canvas_makefilename(x->x_canvas, s->s_name,
+ buf, MAXPDSTRING);
+ sys_bashfilename(buf, buf);
+
+ if (!(fd = fopen(buf, "w")))
{
post("%s: couldn't create", s->s_name);
return;
@@ -1048,6 +1066,7 @@ static void *bonk_new(t_symbol *s, int argc, t_atom *argv)
firstbin = DEFFIRSTBIN, minbandwidth = DEFMINBANDWIDTH;
t_insig *g;
+ x->x_canvas = canvas_getcurrent(); /* fbar: bind current canvas to x */
if (argc > 0 && argv[0].a_type == A_FLOAT)
{
/* old style args for compatibility */
diff --git a/pd/extra/bonk~/makefile b/pd/extra/bonk~/makefile
index af6399cc..7d56ed4d 100644
--- a/pd/extra/bonk~/makefile
+++ b/pd/extra/bonk~/makefile
@@ -1,4 +1,4 @@
NAME=bonk~
CSYM=bonk_tilde
-include ../makefile
+include ../makefile.subdir
diff --git a/pd/extra/choice/GNUmakefile.am b/pd/extra/choice/GNUmakefile.am
new file mode 100644
index 00000000..5ed60350
--- /dev/null
+++ b/pd/extra/choice/GNUmakefile.am
@@ -0,0 +1,28 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+
+NAME=choice
+
+external_LTLIBRARIES = choice.la
+SOURCES = choice.c
+PATCHES = choice-help.pd
+OTHERDATA =
+
+###############################
+# you shouldn't need to add anything below here
+dist_external_DATA = $(PATCHES) $(OTHERDATA)
+
+AUTOMAKE_OPTIONS = foreign
+AM_CPPFLAGS = -I$(top_srcdir)/src -DPD
+AM_CFLAGS = @ARCH_CFLAGS@
+AM_LIBS = $(LIBM)
+AM_LDFLAGS = -module -avoid-version -shared @ARCH_LDFLAGS@ -shrext .@EXTERNAL_EXTENSION@ -L$(top_srcdir)/src
+
+externaldir = $(pkglibdir)/extra/$(NAME)
+
+
+if MINGW
+AM_LIBS += -lpd
+endif
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
diff --git a/pd/extra/choice/choice.c b/pd/extra/choice/choice.c
index b7bf23ab..a50c66ac 100644
--- a/pd/extra/choice/choice.c
+++ b/pd/extra/choice/choice.c
@@ -18,7 +18,7 @@ static t_class *choice_class;
typedef struct _elem
{
float e_age;
- float e_weight[DIMENSION];
+ t_float e_weight[DIMENSION];
} t_elem;
typedef struct _choice
diff --git a/pd/extra/choice/makefile b/pd/extra/choice/makefile
index 7fc71159..ee63e8fd 100644
--- a/pd/extra/choice/makefile
+++ b/pd/extra/choice/makefile
@@ -1,4 +1,4 @@
NAME=choice
CSYM=choice
-include ../makefile
+include ../makefile.subdir
diff --git a/pd/extra/expr~/GNUmakefile.am b/pd/extra/expr~/GNUmakefile.am
new file mode 100644
index 00000000..a9074b92
--- /dev/null
+++ b/pd/extra/expr~/GNUmakefile.am
@@ -0,0 +1,50 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+NAME=expr~
+
+external_LTLIBRARIES = expr~.la
+expr__la_SOURCES = vexp.c vexp_fun.c vexp_if.c
+PATCHES = ../expr-help.pd
+OTHERDATA = LICENSE.txt README.txt
+
+dist_external_DATA = $(PATCHES) $(OTHERDATA)
+noinst_HEADERS = fts_to_pd.h vexp.h
+
+AUTOMAKE_OPTIONS = foreign
+AM_CPPFLAGS = -I$(top_srcdir)/src -DPD
+AM_CFLAGS = @ARCH_CFLAGS@
+AM_LIBS = $(LIBM)
+AM_LDFLAGS = -module -avoid-version -shared @ARCH_LDFLAGS@ -shrext .@EXTERNAL_EXTENSION@ -L$(top_srcdir)/src
+
+externaldir = $(pkglibdir)/extra/$(NAME)
+
+# install-exec-hook seems to be called before $(DESTDIR)$(externaldir) is created...
+# so we install everything in the install-data-hook
+install-data-hook:
+ cd $(DESTDIR)$(externaldir) && ( \
+ $(LN_S) expr~.@EXTERNAL_EXTENSION@ expr.@EXTERNAL_EXTENSION@; \
+ $(LN_S) expr~.@EXTERNAL_EXTENSION@ fexpr~.@EXTERNAL_EXTENSION@; \
+ cd ..; \
+ $(LN_S) $(NAME)/expr.@EXTERNAL_EXTENSION@ expr.@EXTERNAL_EXTENSION@; \
+ $(LN_S) $(NAME)/expr~.@EXTERNAL_EXTENSION@ expr~.@EXTERNAL_EXTENSION@; \
+ $(LN_S) $(NAME)/fexpr~.@EXTERNAL_EXTENSION@ fexpr~.@EXTERNAL_EXTENSION@; \
+ $(LN_S) $(NAME)/expr-help.pd expr-help.pd; \
+ $(LN_S) $(NAME)/expr-help.pd expr~-help.pd; \
+ $(LN_S) $(NAME)/expr-help.pd fexpr~-help.pd; \
+ )
+
+uninstall-hook:
+ cd $(DESTDIR)$(externaldir) && ( \
+ rm -f expr.@EXTERNAL_EXTENSION@ fexpr~.@EXTERNAL_EXTENSION@; \
+ cd ..; \
+ rm -f expr~.@EXTERNAL_EXTENSION@ expr.@EXTERNAL_EXTENSION@ fexpr~.@EXTERNAL_EXTENSION@; \
+ rm -f expr-help.pd expr~-help.pd fexpr~-help.pd; \
+ )
+
+
+
+if MINGW
+AM_LIBS += -lpd
+endif
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
diff --git a/pd/extra/expr~/makefile b/pd/extra/expr~/makefile
index 4c648140..5dee147a 100644
--- a/pd/extra/expr~/makefile
+++ b/pd/extra/expr~/makefile
@@ -6,7 +6,7 @@ install: install_linux
clean: clean_linux
-PDEXTERN=/usr/local/lib/pd/externs
+PDEXTERN=/usr/local/lib/pd/extra
# ----------------------- NT -----------------------
@@ -89,7 +89,6 @@ LINUXINCLUDE = -I../../src
expr.pd_linux: $(LINUXOBJ)
$(CC) -shared -o expr.pd_linux $(LINUXOBJ) -lc -lm
- strip --strip-unneeded expr.pd_linux
expr~.pd_linux: expr.pd_linux
-ln -s expr.pd_linux expr~.pd_linux
@@ -110,12 +109,11 @@ install_linux:
install expr.pd_linux $(PDEXTERN)
rm -f $(PDEXTERN)/expr~.pd_linux
rm -f $(PDEXTERN)/fexpr~.pd_linux
- cd $(PDEXTERN); \
- -ln -s expr.pd_linux expr~.pd_linux
- -ln -s expr.pd_linux fexpr~.pd_linux
+ cd $(PDEXTERN); ln -s expr.pd_linux expr~.pd_linux
+ cd $(PDEXTERN); ln -s expr.pd_linux fexpr~.pd_linux
-linux_clean:
+clean_linux:
rm -f *.pd_linux_o *.o
# ----------------------- MAC OSX -----------------------
diff --git a/pd/extra/expr~/vexp_if.c b/pd/extra/expr~/vexp_if.c
index 648aba73..aaaf4ef3 100644
--- a/pd/extra/expr~/vexp_if.c
+++ b/pd/extra/expr~/vexp_if.c
@@ -381,7 +381,7 @@ SDY the following coredumps why?
post("expr: internal error expr_new");
default:
pd_error(x, "expr: bad type (%lx) inlet = %d\n",
- eptr->ex_type, i + 1, 0, 0, 0);
+ eptr->ex_type, i + 1);
break;
}
}
@@ -955,7 +955,7 @@ if (!sym || !(garray = (t_garray *)pd_findbyclass(sym, garray_class)) || \
!garray_getfloatwords(garray, &size, &vec)) { \
optr->ex_type = ET_FLT; \
optr->ex_int = 0; \
- error("no such table '%s'", sym->s_name); \
+ error("no such table '%s'", sym?(sym->s_name):"(null)"); \
return; \
}
diff --git a/pd/extra/fiddle~/GNUmakefile.am b/pd/extra/fiddle~/GNUmakefile.am
new file mode 100644
index 00000000..a45338fd
--- /dev/null
+++ b/pd/extra/fiddle~/GNUmakefile.am
@@ -0,0 +1,28 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+
+NAME=fiddle~
+
+external_LTLIBRARIES = fiddle~.la
+SOURCES = fiddle~.c
+PATCHES = fiddle~-help.pd
+OTHERDATA =
+
+###############################
+# you shouldn't need to add anything below here
+dist_external_DATA = $(PATCHES) $(OTHERDATA)
+
+AUTOMAKE_OPTIONS = foreign
+AM_CPPFLAGS = -I$(top_srcdir)/src -DPD
+AM_CFLAGS = @ARCH_CFLAGS@
+AM_LIBS = $(LIBM)
+AM_LDFLAGS = -module -avoid-version -shared @ARCH_LDFLAGS@ -shrext .@EXTERNAL_EXTENSION@ -L$(top_srcdir)/src
+
+externaldir = $(pkglibdir)/extra/$(NAME)
+
+
+if MINGW
+AM_LIBS += -lpd
+endif
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
diff --git a/pd/extra/fiddle~/makefile b/pd/extra/fiddle~/makefile
index 247c905e..0820a838 100644
--- a/pd/extra/fiddle~/makefile
+++ b/pd/extra/fiddle~/makefile
@@ -1,4 +1,4 @@
NAME=fiddle~
CSYM=fiddle_tilde
-include ../makefile
+include ../makefile.subdir
diff --git a/pd/extra/loop~/GNUmakefile.am b/pd/extra/loop~/GNUmakefile.am
new file mode 100644
index 00000000..fce3b2fc
--- /dev/null
+++ b/pd/extra/loop~/GNUmakefile.am
@@ -0,0 +1,28 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+
+NAME=loop~
+
+external_LTLIBRARIES = loop~.la
+SOURCES = loop~.c
+PATCHES = loop~-help.pd test-loop~.pd
+OTHERDATA =
+
+###############################
+# you shouldn't need to add anything below here
+dist_external_DATA = $(PATCHES) $(OTHERDATA)
+
+AUTOMAKE_OPTIONS = foreign
+AM_CPPFLAGS = -I$(top_srcdir)/src -DPD
+AM_CFLAGS = @ARCH_CFLAGS@
+AM_LIBS = $(LIBM)
+AM_LDFLAGS = -module -avoid-version -shared @ARCH_LDFLAGS@ -shrext .@EXTERNAL_EXTENSION@ -L$(top_srcdir)/src
+
+externaldir = $(pkglibdir)/extra/$(NAME)
+
+
+if MINGW
+AM_LIBS += -lpd
+endif
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
diff --git a/pd/extra/loop~/loop~-help.pd b/pd/extra/loop~/loop~-help.pd
index a445b805..ff3d3a63 100644
--- a/pd/extra/loop~/loop~-help.pd
+++ b/pd/extra/loop~/loop~-help.pd
@@ -1,4 +1,4 @@
-#N canvas 33 0 647 662 12;
+#N canvas 234 90 647 662 12;
#X floatatom 41 204 0 0 0 0 - - -;
#X obj 254 382 print~;
#X msg 254 347 bang;
@@ -7,7 +7,7 @@
#X msg 55 252 bang;
#X obj 183 382 print~;
#X msg 183 347 bang;
-#N canvas 0 0 450 300 graph1 0;
+#N canvas 0 0 450 300 (subpatch) 0;
#X array array2 150000 float 0;
#X coords 0 1 150000 -1 200 150 1;
#X restore 393 464 graph;
@@ -22,7 +22,6 @@
#X floatatom 96 303 0 0 0 0 - - -;
#X obj 96 326 *~ 1000;
#X msg 43 568 read ../doc/sound/bell.aiff array2;
-#X msg 43 591 read ../doc/sound/vocal.aiff array2;
#X msg 47 229 set 0.5;
#X text 95 196 left signal input is transposition (1 is normal \, 2
is up an octave \, etc);
@@ -46,6 +45,7 @@ that changing window size doesn't change the transposition.;
to zero--you should mute the output before doing so. This may be desirable
if you've set a large window size but then want to decrease it without
waiting for the next phase crossing.;
+#X msg 43 591 read ../doc/sound/voice.wav array2;
#X connect 0 0 3 0;
#X connect 2 0 1 0;
#X connect 3 0 6 0;
@@ -56,7 +56,7 @@ waiting for the next phase crossing.;
#X connect 4 0 3 1;
#X connect 5 0 3 0;
#X connect 7 0 6 0;
-#X connect 11 0 28 0;
+#X connect 11 0 27 0;
#X connect 12 0 16 0;
#X connect 14 0 13 0;
#X connect 14 0 13 1;
@@ -65,10 +65,10 @@ waiting for the next phase crossing.;
#X connect 17 0 18 0;
#X connect 18 0 15 0;
#X connect 19 0 10 0;
-#X connect 20 0 10 0;
-#X connect 21 0 3 0;
-#X connect 28 0 14 0;
-#X connect 29 0 31 0;
-#X connect 30 0 28 1;
-#X connect 31 0 32 0;
-#X connect 32 0 30 0;
+#X connect 20 0 3 0;
+#X connect 27 0 14 0;
+#X connect 28 0 30 0;
+#X connect 29 0 27 1;
+#X connect 30 0 31 0;
+#X connect 31 0 29 0;
+#X connect 36 0 10 0;
diff --git a/pd/extra/loop~/loop~.c b/pd/extra/loop~/loop~.c
index 2f440030..2fc3193e 100644
--- a/pd/extra/loop~/loop~.c
+++ b/pd/extra/loop~/loop~.c
@@ -13,20 +13,24 @@ This file is downloadable from http://www.crca.ucsd.edu/~msp .
#ifdef PD
#include "m_pd.h"
+#else
+#define t_sample float
#endif
+
+
typedef struct _loopctl
{
double l_phase;
- float l_invwindow;
- float l_window;
+ t_sample l_invwindow;
+ t_sample l_window;
int l_resync;
} t_loopctl;
-static void loopctl_run(t_loopctl *x, float *transposein,
- float *windowin, float *rawout, float *windowout, int n)
+static void loopctl_run(t_loopctl *x, t_sample *transposein,
+ t_sample *windowin, t_sample *rawout, t_sample *windowout, int n)
{
- float window, invwindow;
+ t_sample window, invwindow;
double phase = x->l_phase;
if (x->l_resync)
{
@@ -55,7 +59,7 @@ static void loopctl_run(t_loopctl *x, float *transposein,
{
double phaseinc = invwindow * *transposein++;
double newphase;
- float nwind = *windowin++;
+ t_sample nwind = *windowin++;
if (phaseinc >= 1 || phaseinc < 0)
phaseinc = 0;
newphase = phase + phaseinc;
@@ -77,7 +81,7 @@ static void loopctl_run(t_loopctl *x, float *transposein,
newphase -= 1.;
}
phase = newphase;
- *rawout++ = (float)phase;
+ *rawout++ = (t_sample)phase;
*windowout++ = window;
}
x->l_invwindow = invwindow;
@@ -124,10 +128,10 @@ static void *loop_new(void)
static t_int *loop_perform(t_int *w)
{
t_loopctl *ctl = (t_loopctl *)(w[1]);
- t_float *in1 = (t_float *)(w[2]);
- t_float *in2 = (t_float *)(w[3]);
- t_float *out1 = (t_float *)(w[4]);
- t_float *out2 = (t_float *)(w[5]);
+ t_sample *in1 = (t_sample *)(w[2]);
+ t_sample *in2 = (t_sample *)(w[3]);
+ t_sample *out1 = (t_sample *)(w[4]);
+ t_sample *out2 = (t_sample *)(w[5]);
int n = (int)(w[6]);
loopctl_run(ctl, in1, in2, out1, out2, n);
return (w+7);
diff --git a/pd/extra/loop~/makefile b/pd/extra/loop~/makefile
index fd21f2b4..dc367b20 100644
--- a/pd/extra/loop~/makefile
+++ b/pd/extra/loop~/makefile
@@ -1,4 +1,4 @@
NAME=loop~
CSYM=loop_tilde
-include ../makefile
+include ../makefile.subdir
diff --git a/pd/extra/lrshift~/GNUmakefile.am b/pd/extra/lrshift~/GNUmakefile.am
new file mode 100644
index 00000000..4023a70e
--- /dev/null
+++ b/pd/extra/lrshift~/GNUmakefile.am
@@ -0,0 +1,28 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+
+NAME=lrshift~
+
+external_LTLIBRARIES = lrshift~.la
+SOURCES = lrshift~.c
+PATCHES = lrshift~-help.pd
+OTHERDATA =
+
+###############################
+# you shouldn't need to add anything below here
+dist_external_DATA = $(PATCHES) $(OTHERDATA)
+
+AUTOMAKE_OPTIONS = foreign
+AM_CPPFLAGS = -I$(top_srcdir)/src -DPD
+AM_CFLAGS = @ARCH_CFLAGS@
+AM_LIBS = $(LIBM)
+AM_LDFLAGS = -module -avoid-version -shared @ARCH_LDFLAGS@ -shrext .@EXTERNAL_EXTENSION@ -L$(top_srcdir)/src
+
+externaldir = $(pkglibdir)/extra/$(NAME)
+
+
+if MINGW
+AM_LIBS += -lpd
+endif
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
diff --git a/pd/extra/lrshift~/lrshift~.c b/pd/extra/lrshift~/lrshift~.c
index 166facc1..b3c90ff6 100644
--- a/pd/extra/lrshift~/lrshift~.c
+++ b/pd/extra/lrshift~/lrshift~.c
@@ -13,8 +13,8 @@ typedef struct _lrshift_tilde
static t_int *leftshift_perform(t_int *w)
{
- t_float *in = (t_float *)(w[1]);
- t_float *out= (t_float *)(w[2]);
+ t_sample *in = (t_sample *)(w[1]);
+ t_sample *out= (t_sample *)(w[2]);
int n = (int)(w[3]);
int shift = (int)(w[4]);
in += shift;
@@ -28,8 +28,8 @@ static t_int *leftshift_perform(t_int *w)
static t_int *rightshift_perform(t_int *w)
{
- t_float *in = (t_float *)(w[1]);
- t_float *out= (t_float *)(w[2]);
+ t_sample *in = (t_sample *)(w[1]);
+ t_sample *out= (t_sample *)(w[2]);
int n = (int)(w[3]);
int shift = (int)(w[4]);
n -= shift;
diff --git a/pd/extra/lrshift~/makefile b/pd/extra/lrshift~/makefile
index d6a24cfe..cbd9e8a0 100644
--- a/pd/extra/lrshift~/makefile
+++ b/pd/extra/lrshift~/makefile
@@ -1,4 +1,4 @@
NAME=lrshift~
CSYM=lrshift_tilde
-include ../makefile
+include ../makefile.subdir
diff --git a/pd/extra/makefile b/pd/extra/makefile.subdir
index ee028616..9dfadc41 100644
--- a/pd/extra/makefile
+++ b/pd/extra/makefile.subdir
@@ -1,3 +1,9 @@
+# this is the UNIX-style complicated layout dir, simple goes to $(prefix)/po
+prefix = /usr/local
+libpddir = $(prefix)/lib/pd
+
+.PHONY:
+
current: pd_linux
# ----------------------- NT -----------------------
@@ -6,7 +12,8 @@ pd_nt: $(NAME).dll
.SUFFIXES: .dll
-PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo -D_CRT_SECURE_NO_WARNINGS
+PDNTCFLAGS = /W3 /WX /DNT /DPD /nologo -D_CRT_SECURE_NO_WARNINGS \
+ -D_CRT_NONSTDC_NO_DEPRECATE
# VC="C:\Program Files\Microsoft Visual Studio\Vc98"
VC = "C:\Program Files\Microsoft Visual Studio 9.0\VC"
VSTK = "C:\Program Files\Microsoft SDKs\Windows\v6.0A"
@@ -38,7 +45,6 @@ LINUXINCLUDE = -I../../src
.c.pd_linux:
$(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
$(CC) -shared -o $*.pd_linux $*.o -lc -lm
- strip --strip-unneeded $*.pd_linux
rm -f $*.o
# ----------------------- Mac OSX -----------------------
@@ -64,5 +70,13 @@ DARWINCFLAGS = -DPD -O2 -Wall -W -Wshadow -Wstrict-prototypes \
# ----------------------------------------------------------
-clean:
- rm -f *.o *.pd_* so_locations
+distclean clean: clean-externals
+ rm -f *.o *.pd_* *.l_* *.d_* *.m_* so_locations
+
+# ----------------------------------------------------------
+# ----------------------------------------------------------
+
+install:
+ install -d $(DESTDIR)$(libpddir)/extra/$(NAME)
+ install -m644 -p *.*_* $(DESTDIR)$(libpddir)/extra/$(NAME)
+ install -m644 -p *.pd $(DESTDIR)$(libpddir)/extra/$(NAME)
diff --git a/pd/extra/pd~/GNUmakefile.am b/pd/extra/pd~/GNUmakefile.am
new file mode 100644
index 00000000..6110c88c
--- /dev/null
+++ b/pd/extra/pd~/GNUmakefile.am
@@ -0,0 +1,31 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+
+NAME=pd~
+
+PATCHES = pd~-help.pd pd~-subprocess.pd
+OTHERDATA =
+
+pd__la_SOURCES = pd~.c
+pdsched_la_SOURCES = pdsched.c
+
+external_LTLIBRARIES = pd~.la pdsched.la
+dist_external_DATA = $(PATCHES) $(OTHERDATA)
+
+
+
+
+AUTOMAKE_OPTIONS = foreign
+AM_CPPFLAGS = -I$(top_srcdir)/src -DPD
+AM_CFLAGS = @ARCH_CFLAGS@
+AM_LIBS = $(LIBM)
+AM_LDFLAGS = -module -avoid-version -shared @ARCH_LDFLAGS@ -shrext .@EXTERNAL_EXTENSION@ -L$(top_srcdir)/src
+
+externaldir = $(pkglibdir)/extra/$(NAME)
+
+
+if MINGW
+AM_LIBS += -lpd
+endif
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
diff --git a/pd/extra/pd~/makefile b/pd/extra/pd~/makefile
index d069c73d..5fc5d26b 100644
--- a/pd/extra/pd~/makefile
+++ b/pd/extra/pd~/makefile
@@ -1,7 +1,7 @@
NAME=pd~
CSYM=pd_tilde
-include ../makefile
+include ../makefile.subdir
pd_linux: pdsched.pd_linux
@@ -11,5 +11,4 @@ d_ppc: pdsched.d_ppc
pdsched.pd_linux: pdsched.c
$(CC) $(LINUXCFLAGS) $(LINUXINCLUDE) -o $*.o -c $*.c
$(CC) -shared -o $*.pd_linux $*.o -lc -lm
- strip --strip-unneeded $*.pd_linux
rm -f $*.o
diff --git a/pd/extra/pd~/pdsched.c b/pd/extra/pd~/pdsched.c
index 7efe49a9..6c6060c1 100644
--- a/pd/extra/pd~/pdsched.c
+++ b/pd/extra/pd~/pdsched.c
@@ -17,15 +17,33 @@ outputs audio and messages. */
#define BUFSIZE 65536
static char inbuf[BUFSIZE];
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
+void glob_watchdog(t_pd *dummy);
+
+static void pollwatchdog( void)
+{
+ static int sched_diddsp, sched_nextpingtime;
+ sched_diddsp++;
+ if (sys_nogui && sys_hipriority && (sched_diddsp - sched_nextpingtime > 0))
+ {
+ glob_watchdog(0);
+ /* ping every 2 seconds */
+ sched_nextpingtime = sched_diddsp +
+ 2 * (int)(sys_dacsr /(double)sys_schedblocksize);
+ }
+}
+#endif
+
int pd_extern_sched(char *flags)
{
int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV];
int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV];
- int i, j, rate, advance, callback, chin, chout, fill = 0, c;
+ int i, j, rate, advance, callback, chin, chout, fill = 0, c, blocksize;
t_binbuf *b = binbuf_new();
sys_get_audio_params(&naudioindev, audioindev, chindev,
- &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback);
+ &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback,
+ &blocksize);
chin = (naudioindev < 1 ? 0 : chindev[0]);
chout = (naudiooutdev < 1 ? 0 : choutdev[0]);
@@ -57,6 +75,9 @@ int pd_extern_sched(char *flags)
*fp++ = 0;
sched_tick(sys_time+sys_time_per_dsp_tick);
sys_pollgui();
+#if defined(__linux__) || defined(__FreeBSD__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
+ pollwatchdog();
+#endif
printf(";\n");
for (i = chout*DEFDACBLKSIZE, fp = sys_soundout; i--; fp++)
{
diff --git a/pd/extra/pd~/pd~.c b/pd/extra/pd~/pd~.c
index 165065f8..dc2eca4c 100644
--- a/pd/extra/pd~/pd~.c
+++ b/pd/extra/pd~/pd~.c
@@ -15,7 +15,7 @@
#include <sys/stat.h>
#include <sys/wait.h>
-#ifdef NT
+#ifdef _MSC_VER
#pragma warning (disable: 4305 4244)
#endif
@@ -47,7 +47,7 @@ char *class_gethelpdir(t_class *c);
#endif
-#ifdef __linux__
+#if defined(__linux__) || defined(__FreeBSD_kernel__) || defined(__GNU__)
#ifdef __x86_64__
static char pd_tilde_dllextent[] = ".l_ia64",
pd_tilde_dllextent2[] = ".pd_linux";
@@ -60,6 +60,9 @@ static char pd_tilde_dllextent[] = ".l_i386",
static char pd_tilde_dllextent[] = ".d_fat",
pd_tilde_dllextent2[] = ".pd_darwin";
#endif
+#if defined(_WIN32) || defined(__CYGWIN__)
+static char pd_tilde_dllextent[] = ".m_i386", pd_tilde_dllextent2[] = ".dll";
+#endif
/* ------------------------ pd_tilde~ ----------------------------- */
@@ -512,7 +515,7 @@ static void *pd_tilde_new(t_symbol *s, int argc, t_atom *argv)
int ninsig = 2, noutsig = 2, j, fifo = 5;
float sr = sys_getsr();
t_sample **g;
- t_symbol *pddir = sys_guidir,
+ t_symbol *pddir = sys_libdir,
*scheddir = gensym(class_gethelpdir(pd_tilde_class));
/* fprintf(stderr, "pd %s, sched %s\n", pddir->s_name, scheddir->s_name); */
while (argc > 0)
diff --git a/pd/extra/pique/GNUmakefile.am b/pd/extra/pique/GNUmakefile.am
new file mode 100644
index 00000000..61ce1715
--- /dev/null
+++ b/pd/extra/pique/GNUmakefile.am
@@ -0,0 +1,28 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+
+NAME=pique
+
+external_LTLIBRARIES = pique.la
+SOURCES = pique.c
+PATCHES = pique-help.pd
+OTHERDATA =
+
+###############################
+# you shouldn't need to add anything below here
+dist_external_DATA = $(PATCHES) $(OTHERDATA)
+
+AUTOMAKE_OPTIONS = foreign
+AM_CPPFLAGS = -I$(top_srcdir)/src -DPD
+AM_CFLAGS = @ARCH_CFLAGS@
+AM_LIBS = $(LIBM)
+AM_LDFLAGS = -module -avoid-version -shared @ARCH_LDFLAGS@ -shrext .@EXTERNAL_EXTENSION@ -L$(top_srcdir)/src
+
+externaldir = $(pkglibdir)/extra/$(NAME)
+
+
+if MINGW
+AM_LIBS += -lpd
+endif
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
diff --git a/pd/extra/pique/makefile b/pd/extra/pique/makefile
index 562ce23b..ebcbd93a 100644
--- a/pd/extra/pique/makefile
+++ b/pd/extra/pique/makefile
@@ -1,4 +1,4 @@
NAME=pique
CSYM=pique
-include ../makefile
+include ../makefile.subdir
diff --git a/pd/extra/pique/pique.c b/pd/extra/pique/pique.c
index a53ad765..19cee2ae 100644
--- a/pd/extra/pique/pique.c
+++ b/pd/extra/pique/pique.c
@@ -51,7 +51,7 @@ static float hanning(float pidetune, float sinpidetune)
(sinpidetune/(pidetune+pi) + sinpidetune/(pidetune-pi)));
}
-static float peakerror(float *fpreal, float *fpimag, float pidetune,
+static float peakerror(t_word *fpreal, t_word *fpimag, float pidetune,
float norm, float peakreal, float peakimag)
{
float sinpidetune = sin(pidetune);
@@ -61,8 +61,10 @@ static float peakerror(float *fpreal, float *fpimag, float pidetune,
peakreal * cospidetune + peakimag * sinpidetune);
float imagshould = windowshould * (
peakimag * cospidetune - peakreal * sinpidetune);
- float realgot = norm * (fpreal[0] - 0.5 * (fpreal[1] + fpreal[-1]));
- float imaggot = norm * (fpimag[0] - 0.5 * (fpimag[1] + fpimag[-1]));
+ float realgot = norm * (fpreal[0].w_float -
+ 0.5 * (fpreal[1].w_float + fpreal[-1].w_float));
+ float imaggot = norm * (fpimag[0].w_float -
+ 0.5 * (fpimag[1].w_float + fpimag[-1].w_float));
float realdev = realshould - realgot, imagdev = imagshould - imaggot;
/* post("real %f->%f; imag %f->%f", realshould, realgot,
@@ -70,7 +72,7 @@ static float peakerror(float *fpreal, float *fpimag, float pidetune,
return (realdev * realdev + imagdev * imagdev);
}
-static void pique_doit(int npts, t_float *fpreal, t_float *fpimag,
+static void pique_doit(int npts, t_word *fpreal, t_word *fpimag,
int npeak, int *nfound, t_float *fpfreq, t_float *fpamp,
t_float *fpampre, t_float *fpampim, float errthresh)
{
@@ -78,13 +80,15 @@ static void pique_doit(int npts, t_float *fpreal, t_float *fpimag,
float oneovern = 1.0/ (float)npts;
float fperbin = srate * oneovern;
float pow1, pow2 = 0, pow3 = 0, pow4 = 0, pow5 = 0;
- float re1, re2 = 0, re3 = *fpreal;
+ float re1, re2 = 0, re3 = fpreal->w_float;
float im1, im2 = 0, im3 = 0, powthresh, relativeerror;
int count, peakcount = 0, n2 = (npts >> 1);
float *fp1, *fp2;
- for (count = n2, fp1 = fpreal, fp2 = fpimag, powthresh = 0;
- count--; fp1++, fp2++)
- powthresh += (*fp1) * (*fp1) + (*fp2) * (*fp2) ;
+ t_word *wp1, *wp2;
+ for (count = n2, wp1 = fpreal, wp2 = fpimag, powthresh = 0;
+ count--; wp1++, wp2++)
+ powthresh += (wp1->w_float) * (wp1->w_float) +
+ (wp2->w_float) * (wp2->w_float) ;
powthresh *= 0.00001;
for (count = 1; count < n2; count++)
{
@@ -98,10 +102,10 @@ static void pique_doit(int npts, t_float *fpreal, t_float *fpimag,
fpimag++;
re1 = re2;
re2 = re3;
- re3 = *fpreal;
+ re3 = fpreal->w_float;
im1 = im2;
im2 = im3;
- im3 = *fpimag;
+ im3 = fpimag->w_float;
if (count < 2) continue;
pow1 = pow2;
pow2 = pow3;
@@ -118,12 +122,12 @@ static void pique_doit(int npts, t_float *fpreal, t_float *fpimag,
|| pow3 < powthresh)
continue;
/* go back for the raw FFT values around the peak. */
- rpeak = fpreal[-3];
- rpeaknext = fpreal[-2];
- rpeakprev = fpreal[-4];
- ipeak = fpimag[-3];
- ipeaknext = fpimag[-2];
- ipeakprev = fpimag[-4];
+ rpeak = fpreal[-3].w_float;
+ rpeaknext = fpreal[-2].w_float;
+ rpeakprev = fpreal[-4].w_float;
+ ipeak = fpimag[-3].w_float;
+ ipeaknext = fpimag[-2].w_float;
+ ipeakprev = fpimag[-4].w_float;
/* recalculate Hanning-windowed spectrum by convolution */
windreal = rpeak - 0.5 * (rpeaknext + rpeakprev);
windimag = ipeak - 0.5 * (ipeaknext + ipeakprev);
@@ -180,15 +184,15 @@ static void pique_list(t_pique *x, t_symbol *s, int argc, t_atom *argv)
int npeak = atom_getintarg(3, argc, argv);
int n;
t_garray *a;
- t_float *fpreal, *fpimag;
+ t_word *fpreal, *fpimag;
if (npts < 8 || npeak < 1) error("pique: bad npoints or npeak");
if (npeak > x->x_n) npeak = x->x_n;
if (!(a = (t_garray *)pd_findbyclass(symreal, garray_class)) ||
- !garray_getfloatarray(a, &n, &fpreal) ||
+ !garray_getfloatwords(a, &n, &fpreal) ||
n < npts)
error("%s: missing or bad array", symreal->s_name);
else if (!(a = (t_garray *)pd_findbyclass(symimag, garray_class)) ||
- !garray_getfloatarray(a, &n, &fpimag) ||
+ !garray_getfloatwords(a, &n, &fpimag) ||
n < npts)
error("%s: missing or bad array", symimag->s_name);
else
diff --git a/pd/extra/sigmund~/GNUmakefile.am b/pd/extra/sigmund~/GNUmakefile.am
new file mode 100644
index 00000000..840e087b
--- /dev/null
+++ b/pd/extra/sigmund~/GNUmakefile.am
@@ -0,0 +1,28 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+
+NAME=sigmund~
+
+external_LTLIBRARIES = sigmund~.la
+SOURCES = sigmund~.c
+PATCHES = sigmund~-help.pd
+OTHERDATA =
+
+###############################
+# you shouldn't need to add anything below here
+dist_external_DATA = $(PATCHES) $(OTHERDATA)
+
+AUTOMAKE_OPTIONS = foreign
+AM_CPPFLAGS = -I$(top_srcdir)/src -DPD
+AM_CFLAGS = @ARCH_CFLAGS@
+AM_LIBS = $(LIBM)
+AM_LDFLAGS = -module -avoid-version -shared @ARCH_LDFLAGS@ -shrext .@EXTERNAL_EXTENSION@ -L$(top_srcdir)/src
+
+externaldir = $(pkglibdir)/extra/$(NAME)
+
+
+if MINGW
+AM_LIBS += -lpd
+endif
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
diff --git a/pd/extra/sigmund~/makefile b/pd/extra/sigmund~/makefile
index 3dc176b3..3c2f8f1c 100644
--- a/pd/extra/sigmund~/makefile
+++ b/pd/extra/sigmund~/makefile
@@ -1,4 +1,4 @@
NAME=sigmund~
CSYM=sigmund_tilde
-include ../makefile
+include ../makefile.subdir
diff --git a/pd/extra/sigmund~/sigmund~.c b/pd/extra/sigmund~/sigmund~.c
index 92604b7e..968c5c63 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: */
-#ifdef NT
+#ifdef _MSC_VER /* this is only needed with Microsoft's compiler */
__declspec(dllimport) extern
#endif
void mayer_realfft(int npoints, float *buf);
@@ -28,7 +28,7 @@ for example, defines this in the file d_fft_mayer.c or d_fft_fftsg.c. */
#include <string.h>
#ifdef _WIN32
#include <malloc.h>
-#else
+#elif ! defined(_MSC_VER)
#include <alloca.h>
#endif
#include <stdlib.h>
@@ -230,9 +230,12 @@ static void sigmund_remask(int maxbin, int bestindex, float powmask,
}
}
+#define PEAKMASKFACTOR 1.
+#define PEAKTHRESHFACTOR 0.6
+
static void sigmund_getrawpeaks(int npts, float *insamps,
int npeak, t_peak *peakv, int *nfound, float *power, float srate, int loud,
- float param1, float param2, float param3, float hifreq)
+ float hifreq)
{
float oneovern = 1.0/ (float)npts;
float fperbin = 0.5 * srate * oneovern, totalpower = 0;
@@ -242,7 +245,6 @@ static void sigmund_getrawpeaks(int npts, float *insamps,
float *rawreal, *rawimag, *maskbuf, *powbuf;
float *bigbuf = alloca(sizeof (float ) * (2*NEGBINS + 6*npts));
int maxbin = hifreq/fperbin;
- int tweak = (param3 == 0);
if (maxbin > npts - NEGBINS)
maxbin = npts - NEGBINS;
/* if (loud) post("tweak %d", tweak); */
@@ -294,7 +296,7 @@ static void sigmund_getrawpeaks(int npts, float *insamps,
pow1 = powbuf[bin];
if (pow1 > maxpower && pow1 > maskbuf[bin])
{
- float thresh = param2 * (powbuf[bin-2]+powbuf[bin+2]);
+ float thresh = PEAKTHRESHFACTOR * (powbuf[bin-2]+powbuf[bin+2]);
if (pow1 > thresh)
maxpower = pow1, bestindex = bin;
}
@@ -304,7 +306,7 @@ static void sigmund_getrawpeaks(int npts, float *insamps,
break;
fp1 = rawreal+bestindex;
fp2 = rawimag+bestindex;
- powmask = maxpower * exp(-param1 * log(10.) / 10.);
+ powmask = maxpower * PEAKMASKFACTOR;
/* if (loud > 2)
post("maxpower %f, powmask %f, param1 %f",
maxpower, powmask, param1); */
@@ -344,11 +346,8 @@ static void sigmund_getrawpeaks(int npts, float *insamps,
peakv[peakcount].p_ampreal = oneovern * ampoutreal;
peakv[peakcount].p_ampimag = oneovern * ampoutimag;
}
- if (tweak)
- {
- sigmund_tweak(npts, rawreal, rawimag, peakcount, peakv, fperbin, loud);
- sigmund_tweak(npts, rawreal, rawimag, peakcount, peakv, fperbin, loud);
- }
+ sigmund_tweak(npts, rawreal, rawimag, peakcount, peakv, fperbin, loud);
+ sigmund_tweak(npts, rawreal, rawimag, peakcount, peakv, fperbin, loud);
for (i = 0; i < peakcount; i++)
{
peakv[i].p_pit = sigmund_ftom(peakv[i].p_freq);
@@ -360,13 +359,12 @@ static void sigmund_getrawpeaks(int npts, float *insamps,
/*************** Routines for finding fundamental pitch *************/
#define PITCHNPEAK 12
-#define PITCHUNCERTAINTY 0.3
#define HALFTONEINC 0.059
#define SUBHARMONICS 16
#define DBPERHALFTONE 0.0
static void sigmund_getpitch(int npeak, t_peak *peakv, float *freqp,
- float npts, float srate, int loud)
+ float npts, float srate, float nharmonics, float amppower, int loud)
{
float fperbin = 0.5 * srate / npts;
int npit = 48 * sigmund_ilog2(npts), i, j, k, nsalient;
@@ -407,7 +405,7 @@ static void sigmund_getpitch(int npeak, t_peak *peakv, float *freqp,
t_peak *thispeak = bigpeaks[i];
float weightindex = (48./LOG2) *
log(thispeak->p_freq/(2.*fperbin));
- float loudness = sqrt(thispeak->p_amp);
+ float loudness = pow(thispeak->p_amp, amppower);
/* post("index %f, uncertainty %f", weightindex, pitchuncertainty); */
for (j = 0; j < SUBHARMONICS; j++)
{
@@ -422,7 +420,7 @@ static void sigmund_getpitch(int npeak, t_peak *peakv, float *freqp,
if (loindex < 0)
loindex = 0;
for (k = loindex; k <= hiindex; k++)
- weights[k] += loudness * 6. / (6. + j);
+ weights[k] += loudness * nharmonics / (nharmonics + j);
}
sumweight += loudness;
}
@@ -860,8 +858,8 @@ typedef struct _sigmund
static void sigmund_preinit(t_sigmund *x)
{
x->x_npts = NPOINTS_DEF;
- x->x_param1 = 0;
- x->x_param2 = 0.6;
+ x->x_param1 = 6;
+ x->x_param2 = 0.5;
x->x_param3 = 0;
x->x_hop = HOP_DEF;
x->x_mode = MODE_STREAM;
@@ -977,10 +975,10 @@ static void sigmund_doit(t_sigmund *x, int npts, float *arraypoints,
int nfound, i, cnt;
float freq = 0, power, note = 0;
sigmund_getrawpeaks(npts, arraypoints, x->x_npeak, peakv,
- &nfound, &power, srate, loud, x->x_param1, x->x_param2, x->x_param3,
- x->x_maxfreq);
+ &nfound, &power, srate, loud, x->x_maxfreq);
if (x->x_dopitch)
- sigmund_getpitch(nfound, peakv, &freq, npts, srate, loud);
+ sigmund_getpitch(nfound, peakv, &freq, npts, srate,
+ x->x_param1, x->x_param2, loud);
if (x->x_donote)
notefinder_doit(&x->x_notefinder, freq, power, &note, x->x_vibrato,
1 + x->x_stabletime * 0.001f * x->x_sr / (float)x->x_hop,
@@ -1112,7 +1110,7 @@ static void sigmund_tick(t_sigmund *x)
static t_int *sigmund_perform(t_int *w)
{
t_sigmund *x = (t_sigmund *)(w[1]);
- float *in = (float *)(w[2]);
+ t_sample *in = (float *)(w[2]);
int n = (int)(w[3]);
if (x->x_hop % n)
diff --git a/pd/extra/stdout/GNUmakefile.am b/pd/extra/stdout/GNUmakefile.am
new file mode 100644
index 00000000..cc2a517f
--- /dev/null
+++ b/pd/extra/stdout/GNUmakefile.am
@@ -0,0 +1,28 @@
+## Makefile.am -- Process this file with automake to produce Makefile.in
+
+NAME=stdout
+
+external_LTLIBRARIES = stdout.la
+SOURCES = stdout.c
+PATCHES = stdout-help.pd
+OTHERDATA =
+
+###############################
+# you shouldn't need to add anything below here
+dist_external_DATA = $(PATCHES) $(OTHERDATA)
+
+AUTOMAKE_OPTIONS = foreign
+AM_CPPFLAGS = -I$(top_srcdir)/src -DPD
+AM_CFLAGS = @ARCH_CFLAGS@
+AM_LIBS = $(LIBM)
+AM_LDFLAGS = -module -avoid-version -shared @ARCH_LDFLAGS@ -shrext .@EXTERNAL_EXTENSION@ -L$(top_srcdir)/src
+
+externaldir = $(pkglibdir)/extra/$(NAME)
+
+
+if MINGW
+AM_LIBS += -lpd
+endif
+
+libtool: $(LIBTOOL_DEPS)
+ $(SHELL) ./config.status --recheck
diff --git a/pd/extra/stdout/makefile b/pd/extra/stdout/makefile
index 67801999..6041eeb7 100644
--- a/pd/extra/stdout/makefile
+++ b/pd/extra/stdout/makefile
@@ -1,4 +1,4 @@
NAME=stdout
CSYM=stdout
-include ../makefile
+include ../makefile.subdir