aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--makefile5
-rw-r--r--maxlib.c224
-rw-r--r--src/arbran.c34
3 files changed, 140 insertions, 123 deletions
diff --git a/makefile b/makefile
index 0094e39..74c4e15 100644
--- a/makefile
+++ b/makefile
@@ -205,11 +205,12 @@ pd_linux: $(NAME).pd_linux
.SUFFIXES: .pd_linux
LINUXCFLAGS = -DPD -DMAXLIB -DUNIX -O2 -funroll-loops -fomit-frame-pointer \
+# LINUXCFLAGS = -DPD -DUNIX -O2 -funroll-loops -fomit-frame-pointer \
-Wall -W -Wshadow \
-Wno-unused -Wno-parentheses -Wno-switch
# where is your m_pd.h ???
-LINUXINCLUDE = -I/usr/local/include -I./include
+LINUXINCLUDE = -I/usr/local/include -I./include -I../../pd/src
LINUXEXTERNALS = borax.o ignore.o match.o pitch.o speedlim.o \
plus.o minus.o divide.o multi.o average.o chord.o \
@@ -285,7 +286,7 @@ LINUXEXTERNALS = borax.o ignore.o match.o pitch.o speedlim.o \
# ----------------------------------------------------------
-PDDIR=/usr/local/lib/pd
+PDDIR=/usr/lib/pd
install:
install -d $(PDDIR)/doc/5.reference/maxlib
diff --git a/maxlib.c b/maxlib.c
index a344d47..e2242a2 100644
--- a/maxlib.c
+++ b/maxlib.c
@@ -40,62 +40,62 @@ typedef struct _maxlib
static t_class* maxlib_class;
/* objects */
-void arbran_setup();
-void average_setup();
-void beat_setup();
-void beta_setup();
-void bilex_setup();
-void borax_setup();
-void cauchy_setup();
-void chord_setup();
-void delta_setup();
-void dist_setup();
-void divide_setup();
-void divmod_setup();
-void edge_setup();
-void expo_setup();
-void fifo_setup();
-void gauss_setup();
-void gestalt_setup();
-void history_setup();
-void ignore_setup();
-void iso_setup();
-void lifo_setup();
-void limit_setup();
-void linear_setup();
-void listfunnel_setup();
-void match_setup();
-void minus_setup();
-void mlife_setup();
-void multi_setup();
-void netclient_setup();
-void netdist_setup();
-void netrec_setup();
-void netserver_setup();
-void nroute_setup();
-void pitch_setup();
-void plus_setup();
-void poisson_setup();
-void pong_setup();
-void pulse_setup();
-void remote_setup();
-void rewrap_setup();
-void rhythm_setup();
-void scale_setup();
-void score_setup();
-void speedlim_setup();
-void split_setup();
-void step_setup();
-void subst_setup();
-void temperature_setup();
-void tilt_setup();
-void timebang_setup();
-void triang_setup();
-void unroute_setup();
-void urn_setup();
-void velocity_setup();
-void weibull_setup();
-void wrap_setup();
+void maxlib_arbran_setup();
+void maxlib_average_setup();
+void maxlib_beat_setup();
+void maxlib_beta_setup();
+void maxlib_bilex_setup();
+void maxlib_borax_setup();
+void maxlib_cauchy_setup();
+void maxlib_chord_setup();
+void maxlib_delta_setup();
+void maxlib_dist_setup();
+void maxlib_divide_setup();
+void maxlib_divmod_setup();
+void maxlib_edge_setup();
+void maxlib_expo_setup();
+void maxlib_fifo_setup();
+void maxlib_gauss_setup();
+void maxlib_gestalt_setup();
+void maxlib_history_setup();
+void maxlib_ignore_setup();
+void maxlib_iso_setup();
+void maxlib_lifo_setup();
+void maxlib_limit_setup();
+void maxlib_linear_setup();
+void maxlib_listfunnel_setup();
+void maxlib_match_setup();
+void maxlib_minus_setup();
+void maxlib_mlife_setup();
+void maxlib_multi_setup();
+void maxlib_netclient_setup();
+void maxlib_netdist_setup();
+void maxlib_netrec_setup();
+void maxlib_netserver_setup();
+void maxlib_nroute_setup();
+void maxlib_pitch_setup();
+void maxlib_plus_setup();
+void maxlib_poisson_setup();
+void maxlib_pong_setup();
+void maxlib_pulse_setup();
+void maxlib_remote_setup();
+void maxlib_rewrap_setup();
+void maxlib_rhythm_setup();
+void maxlib_scale_setup();
+void maxlib_score_setup();
+void maxlib_speedlim_setup();
+void maxlib_split_setup();
+void maxlib_step_setup();
+void maxlib_subst_setup();
+void maxlib_temperature_setup();
+void maxlib_tilt_setup();
+void maxlib_timebang_setup();
+void maxlib_triang_setup();
+void maxlib_unroute_setup();
+void maxlib_urn_setup();
+void maxlib_velocity_setup();
+void maxlib_weibull_setup();
+void maxlib_wrap_setup();
static void* maxlib_new(t_symbol* s)
{
@@ -108,62 +108,62 @@ void maxlib_setup(void)
maxlib_class = class_new(gensym("maxlib"), (t_newmethod)maxlib_new, 0,
sizeof(t_maxlib), 0,0);
- arbran_setup();
- average_setup();
- beat_setup();
- beta_setup();
- bilex_setup();
- borax_setup();
- cauchy_setup();
- chord_setup();
- delta_setup();
- dist_setup();
- divide_setup();
- divmod_setup();
- edge_setup();
- expo_setup();
- fifo_setup();
- gauss_setup();
- gestalt_setup();
- history_setup();
- ignore_setup();
- iso_setup();
- lifo_setup();
- limit_setup();
- linear_setup();
- listfunnel_setup();
- match_setup();
- minus_setup();
- mlife_setup();
- multi_setup();
- netclient_setup();
- netdist_setup();
- netrec_setup();
- netserver_setup();
- nroute_setup();
- pitch_setup();
- plus_setup();
- poisson_setup();
- pong_setup();
- pulse_setup();
- remote_setup();
- rewrap_setup();
- rhythm_setup();
- scale_setup();
- score_setup();
- speedlim_setup();
- split_setup();
- step_setup();
- subst_setup();
- temperature_setup();
- tilt_setup();
- timebang_setup();
- triang_setup();
- unroute_setup();
- urn_setup();
- velocity_setup();
- weibull_setup();
- wrap_setup();
+ maxlib_arbran_setup();
+ maxlib_average_setup();
+ maxlib_beat_setup();
+ maxlib_beta_setup();
+ maxlib_bilex_setup();
+ maxlib_borax_setup();
+ maxlib_cauchy_setup();
+ maxlib_chord_setup();
+ maxlib_delta_setup();
+ maxlib_dist_setup();
+ maxlib_divide_setup();
+ maxlib_divmod_setup();
+ maxlib_edge_setup();
+ maxlib_expo_setup();
+ maxlib_fifo_setup();
+ maxlib_gauss_setup();
+ maxlib_gestalt_setup();
+ maxlib_history_setup();
+ maxlib_ignore_setup();
+ maxlib_iso_setup();
+ maxlib_lifo_setup();
+ maxlib_limit_setup();
+ maxlib_linear_setup();
+ maxlib_listfunnel_setup();
+ maxlib_match_setup();
+ maxlib_minus_setup();
+ maxlib_mlife_setup();
+ maxlib_multi_setup();
+ maxlib_netclient_setup();
+ maxlib_netdist_setup();
+ maxlib_netrec_setup();
+ maxlib_netserver_setup();
+ maxlib_nroute_setup();
+ maxlib_pitch_setup();
+ maxlib_plus_setup();
+ maxlib_poisson_setup();
+ maxlib_pong_setup();
+ maxlib_pulse_setup();
+ maxlib_remote_setup();
+ maxlib_rewrap_setup();
+ maxlib_rhythm_setup();
+ maxlib_scale_setup();
+ maxlib_score_setup();
+ maxlib_speedlim_setup();
+ maxlib_split_setup();
+ maxlib_step_setup();
+ maxlib_subst_setup();
+ maxlib_temperature_setup();
+ maxlib_tilt_setup();
+ maxlib_timebang_setup();
+ maxlib_triang_setup();
+ maxlib_unroute_setup();
+ maxlib_urn_setup();
+ maxlib_velocity_setup();
+ maxlib_weibull_setup();
+ maxlib_wrap_setup();
post("\n maxlib :: Music Analysis eXtensions LIBrary");
post(" written by Olaf Matthes <olaf.matthes@gmx.de>");
diff --git a/src/arbran.c b/src/arbran.c
index b4e4b2c..cb39963 100644
--- a/src/arbran.c
+++ b/src/arbran.c
@@ -23,8 +23,8 @@
/* Based on PureData by Miller Puckette and others. */
/* */
/* ---------------------------------------------------------------------------- */
-
-#include "m_pd.h"
+
+#include "m_pd.h"
#include <stdlib.h>
#include <time.h>
#include <math.h>
@@ -33,11 +33,11 @@
#ifndef M_PI
#define M_PI 3.1415927
#endif
-
+
static char *version = "arbran v0.1b, generates a random variable that conforms to the\n"
" piecewise probability density in two arrays\n"
" written by Olaf Matthes <olaf.matthes@gmx.de>";
-
+
/* -------------------------- rand_arbran ------------------------------ */
static t_class *rand_arbran_class;
@@ -58,7 +58,14 @@ static void rand_arbran_pdfscale(t_rand_arbran *x)
t_int k = 0;
t_float *tx, *tp;
t_int ix, ip;
- if (!garray_getfloatarray(bx, &ix, &tx))
+
+ if(!bx || !bp)
+ {
+ post("arbran: no arrays: pdfscale!");
+ return;
+ }
+
+ if (!garray_getfloatarray(bx, &ix, &tx))
{
post("arbran: couldn't read from array!");
return;
@@ -87,11 +94,19 @@ static void rand_arbran_bang(t_rand_arbran *x)
t_int k = 0;
t_float *tx, *tp;
t_int ix, ip;
- if (!garray_getfloatarray(bx, &ix, &tx))
+
+ if(!bx || !bp)
+ {
+ post("arbran: no arrays: bang!");
+ return;
+ }
+
+ if (!garray_getfloatarray(bx, &ix, &tx))
{
post("arbran: couldn't read from array!");
return;
}
+
if (!garray_getfloatarray(bp, &ip, &tp))
{
post("arbran: couldn't read from array!");
@@ -158,9 +173,10 @@ static void *rand_arbran_new(t_symbol *s1, t_symbol *s2)
t_rand_arbran *x = (t_rand_arbran *)pd_new(rand_arbran_class);
srand( (unsigned)time( NULL ) );
outlet_new(&x->x_obj, &s_float);
- x->x_x = s1;
- x->x_p = s2;
- rand_arbran_set(x);
+ rand_arbran_setarrays(x, s1, s2);
+ /* x->x_x = s1;
+ x->x_p = s2;
+ rand_arbran_set(x); */
return (x);
}