aboutsummaryrefslogtreecommitdiff
path: root/pd/extra/bonk~
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/bonk~
parentbf8ced1efe1a032342e864edc635fa4e2676670d (diff)
checked in pd-0.43-0.src.tar.gz
svn path=/trunk/; revision=15557
Diffstat (limited to 'pd/extra/bonk~')
-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
4 files changed, 55 insertions, 8 deletions
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