aboutsummaryrefslogtreecommitdiff
path: root/pd
diff options
context:
space:
mode:
Diffstat (limited to 'pd')
-rw-r--r--pd/doc/3.audio.examples/G09.pitchshift.pd64
-rw-r--r--pd/src/configure.in53
-rw-r--r--pd/src/d_ctl.c26
-rw-r--r--pd/src/d_soundfile.c6
-rw-r--r--pd/src/g_array.c15
-rw-r--r--pd/src/g_canvas.h2
-rw-r--r--pd/src/g_numbox.c9
-rw-r--r--pd/src/g_template.c175
-rw-r--r--pd/src/makefile.in16
-rw-r--r--pd/src/notes.txt5
-rw-r--r--pd/src/u_main.tk2
11 files changed, 232 insertions, 141 deletions
diff --git a/pd/doc/3.audio.examples/G09.pitchshift.pd b/pd/doc/3.audio.examples/G09.pitchshift.pd
index f0122b1b..7687dc66 100644
--- a/pd/doc/3.audio.examples/G09.pitchshift.pd
+++ b/pd/doc/3.audio.examples/G09.pitchshift.pd
@@ -26,7 +26,6 @@
#X obj 188 447 *~;
#X msg 492 56 \; transpose 0 \; window 100 \; delay 0;
#X obj 492 30 loadbang;
-#X obj 264 42 delwrite~ delay1 5000;
#X obj 146 216 t b f;
#X floatatom 19 285 6 0 0 0 - - -;
#X obj 106 290 +~ 0.5;
@@ -111,52 +110,53 @@ goes from one end to the other.;
#X text 55 265 rotation freq;
#X obj 82 410 vd~ G09-del;
#X obj 251 422 vd~ G09-del;
-#X connect 0 0 36 0;
+#X obj 264 42 delwrite~ G09-del 5000;
+#X connect 0 0 35 0;
#X connect 1 0 16 0;
#X connect 2 0 1 1;
#X connect 2 0 21 1;
-#X connect 3 0 55 0;
+#X connect 3 0 54 0;
#X connect 5 0 2 0;
#X connect 6 0 3 0;
#X connect 7 0 0 0;
#X connect 8 0 9 0;
-#X connect 9 0 35 0;
-#X connect 10 0 29 0;
-#X connect 11 0 28 0;
+#X connect 9 0 34 0;
+#X connect 10 0 28 0;
+#X connect 11 0 27 0;
#X connect 12 0 16 1;
#X connect 12 0 22 1;
#X connect 13 0 12 0;
-#X connect 14 0 52 0;
+#X connect 14 0 51 0;
#X connect 15 0 14 0;
-#X connect 16 0 57 0;
+#X connect 16 0 56 0;
#X connect 17 0 18 0;
#X connect 18 0 19 0;
-#X connect 19 0 49 0;
-#X connect 19 0 49 1;
+#X connect 19 0 48 0;
+#X connect 19 0 48 1;
#X connect 20 0 21 0;
-#X connect 20 0 33 0;
+#X connect 20 0 32 0;
#X connect 21 0 22 0;
-#X connect 22 0 58 0;
+#X connect 22 0 57 0;
#X connect 23 0 24 0;
#X connect 24 0 19 1;
#X connect 26 0 25 0;
-#X connect 28 0 10 0;
-#X connect 28 1 10 1;
-#X connect 29 0 50 0;
-#X connect 30 0 20 0;
-#X connect 31 0 32 0;
-#X connect 32 0 17 0;
-#X connect 33 0 34 0;
-#X connect 34 0 23 0;
-#X connect 35 0 37 0;
-#X connect 36 0 8 0;
-#X connect 37 0 10 0;
-#X connect 44 0 27 0;
-#X connect 50 0 1 0;
-#X connect 50 0 31 0;
-#X connect 50 0 30 0;
-#X connect 52 0 13 0;
-#X connect 55 0 11 0;
-#X connect 55 0 5 0;
-#X connect 57 0 18 1;
-#X connect 58 0 24 1;
+#X connect 27 0 10 0;
+#X connect 27 1 10 1;
+#X connect 28 0 49 0;
+#X connect 29 0 20 0;
+#X connect 30 0 31 0;
+#X connect 31 0 17 0;
+#X connect 32 0 33 0;
+#X connect 33 0 23 0;
+#X connect 34 0 36 0;
+#X connect 35 0 8 0;
+#X connect 36 0 10 0;
+#X connect 43 0 58 0;
+#X connect 49 0 1 0;
+#X connect 49 0 30 0;
+#X connect 49 0 29 0;
+#X connect 51 0 13 0;
+#X connect 54 0 11 0;
+#X connect 54 0 5 0;
+#X connect 56 0 18 1;
+#X connect 57 0 24 1;
diff --git a/pd/src/configure.in b/pd/src/configure.in
index 555c6f9c..5e0d6474 100644
--- a/pd/src/configure.in
+++ b/pd/src/configure.in
@@ -12,6 +12,7 @@ AC_SUBST(EXT)
AC_SUBST(OPT_CFLAGS)
AC_SUBST(USE_DEBUG_CFLAGS, no)
AC_SUBST(SYSSRC)
+AC_SUBST(TCLTK_FRAMEWORKS_PATH)
AC_SUBST(STRIPFLAG)
AC_SUBST(GUINAME)
AC_SUBST(GUIFLAGS)
@@ -173,6 +174,8 @@ dnl This should be fixed so Pd can use ALSA shared libraries where appropriate.
LDFLAGS=$LDFLAGS" -lasound"
fi
if test x$portaudio == "xyes";
+
+
then
MORECFLAGS="-DUSEAPI_PORTAUDIO -DPA19 "$MORECFLAGS
SYSSRC="s_audio_pa.c \
@@ -210,6 +213,24 @@ dnl This should be fixed so Pd can use ALSA shared libraries where appropriate.
fi
echo OPT_CFLAGS --------------- $OPT_CFLAGS
OSNUMBER=0
+
+ if test x$jack == "xyes";
+ then
+ LDFLAGS=$LDFLAGS" -lrt -ljack"
+ fi
+ if test x$jack == "xrun";
+ then
+ LDFLAGS=$LDFLAGS" -lrt -ljack"
+ fi
+ fi
+
+ if test x$jack == "xyes";
+ then
+ LDFLAGS=$LDFLAGS" -lrt -ljack"
+ fi
+ if test x$jack == "xrun";
+ then
+ LDFLAGS=$LDFLAGS" -lrt -ljack"
fi
if test `uname -s` = Darwin;
@@ -245,11 +266,25 @@ then
../portmidi/pm_common/portmidi.c \
../portmidi/porttime/ptmacosx_cf.c "
STRIPFLAG=""
- GUINAME="pdtcl"
- GUIFLAGS="-F../../Frameworks -framework Tcl -framework Tk \
- -I../../Frameworks/Tk.framework/Versions/Current/Headers \
- -I../../Frameworks/Tcl.framework/Versions/Current/Headers \
- -I../../Frameworks/Tcl.framework/Versions/8.4/PrivateHeaders"
+ GUINAME="libPdTcl.dylib"
+
+# find the Tcl/Tk Frameworks
+ if test -d "../../Frameworks";
+ then
+ # Miller's location
+ TCLTK_FRAMEWORKS_PATH="../../Frameworks"
+ elif test -d "/Library/Frameworks";
+ then
+ # get it from the default install location
+ TCLTK_FRAMEWORKS_PATH="/Library/Frameworks"
+ else
+ # Panther has Tcl here; Tiger has Tcl and Tk here
+ TCLTK_FRAMEWORKS_PATH="/System/Library/Frameworks"
+ fi
+ GUIFLAGS="-F$TCLTK_FRAMEWORKS_PATH -framework Tcl -framework Tk \
+ -I$TCLTK_FRAMEWORKS_PATH/Tk.framework/Versions/Current/Headers \
+ -I$TCLTK_FRAMEWORKS_PATH/Tcl.framework/Versions/Current/Headers \
+ -I$TCLTK_FRAMEWORKS_PATH/Tcl.framework/Versions/8.4/PrivateHeaders"
if test x$USE_DEBUG_CFLAGS == "xyes";
then
OPT_CFLAGS="-g"
@@ -261,8 +296,10 @@ then
if test x$jack == "xyes";
then
LDFLAGS=$LDFLAGS" -framework Jack"
- MORECFLAGS=$MORECFLAGS" -DUSEAPI_JACK"
- SYSSRC=$SYSSRC" s_audio_jack.c"
+ fi
+ if test x$jack == "xrun";
+ then
+ LDFLAGS=$LDFLAGS" -framework Jack"
fi
fi
@@ -272,13 +309,11 @@ if test x$jack == "xyes";
then
MORECFLAGS=$MORECFLAGS" -DUSEAPI_JACK"
SYSSRC=$SYSSRC" s_audio_jack.c"
- LDFLAGS=$LDFLAGS" -lrt -ljack"
fi
if test x$jack == "xrun";
then
MORECFLAGS=$MORECFLAGS" -DUSEAPI_JACK -DJACK_XRUN"
SYSSRC=$SYSSRC" s_audio_jack.c"
- LDFLAGS=$LDFLAGS" -lrt -ljack"
fi
# extra flags for alpha machines
diff --git a/pd/src/d_ctl.c b/pd/src/d_ctl.c
index 8dc2345f..a33647ce 100644
--- a/pd/src/d_ctl.c
+++ b/pd/src/d_ctl.c
@@ -552,8 +552,8 @@ static void vsnapshot_tilde_setup(void)
/* ---------------- env~ - simple envelope follower. ----------------- */
-#define MAXOVERLAP 10
-#define MAXVSTAKEN 64
+#define MAXOVERLAP 32
+#define INITVSTAKEN 64
typedef struct sigenv
{
@@ -568,6 +568,7 @@ typedef struct sigenv
float x_result; /* result to output */
float x_sumbuf[MAXOVERLAP]; /* summing buffer */
float x_f;
+ int x_allocforvs; /* extra buffer for DSP vector size */
} t_sigenv;
t_class *env_tilde_class;
@@ -585,7 +586,7 @@ static void *env_tilde_new(t_floatarg fnpoints, t_floatarg fperiod)
if (period < 1) period = npoints/2;
if (period < npoints / MAXOVERLAP + 1)
period = npoints / MAXOVERLAP + 1;
- if (!(buf = getbytes(sizeof(float) * (npoints + MAXVSTAKEN))))
+ if (!(buf = getbytes(sizeof(float) * (npoints + INITVSTAKEN))))
{
error("env: couldn't allocate buffer");
return (0);
@@ -598,10 +599,11 @@ static void *env_tilde_new(t_floatarg fnpoints, t_floatarg fperiod)
for (i = 0; i < MAXOVERLAP; i++) x->x_sumbuf[i] = 0;
for (i = 0; i < npoints; i++)
buf[i] = (1. - cos((2 * 3.14159 * i) / npoints))/npoints;
- for (; i < npoints+MAXVSTAKEN; i++) buf[i] = 0;
+ for (; i < npoints+INITVSTAKEN; i++) buf[i] = 0;
x->x_clock = clock_new(x, (t_method)env_tilde_tick);
x->x_outlet = outlet_new(&x->x_obj, gensym("float"));
x->x_f = 0;
+ x->x_allocforvs = INITVSTAKEN;
return (x);
}
@@ -648,8 +650,20 @@ static void env_tilde_dsp(t_sigenv *x, t_signal **sp)
if (x->x_period % sp[0]->s_n) x->x_realperiod =
x->x_period + sp[0]->s_n - (x->x_period % sp[0]->s_n);
else x->x_realperiod = x->x_period;
+ if (sp[0]->s_n > x->x_allocforvs)
+ {
+ void *xx = resizebytes(x->x_buf,
+ (x->x_npoints + x->x_allocforvs) * sizeof(float),
+ (x->x_npoints + sp[0]->s_n) * sizeof(float));
+ if (!xx)
+ {
+ post("env~: out of memory");
+ return;
+ }
+ x->x_buf = (t_float *)xx;
+ x->x_allocforvs = sp[0]->s_n;
+ }
dsp_add(env_tilde_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
- if (sp[0]->s_n > MAXVSTAKEN) bug("env_tilde_dsp");
}
static void env_tilde_tick(t_sigenv *x) /* callback function for the clock */
@@ -660,7 +674,7 @@ static void env_tilde_tick(t_sigenv *x) /* callback function for the clock */
static void env_tilde_ff(t_sigenv *x) /* cleanup on free */
{
clock_free(x->x_clock);
- freebytes(x->x_buf, (x->x_npoints + MAXVSTAKEN) * sizeof(float));
+ freebytes(x->x_buf, (x->x_npoints + x->x_allocforvs) * sizeof(float));
}
diff --git a/pd/src/d_soundfile.c b/pd/src/d_soundfile.c
index a87b014b..400c9de6 100644
--- a/pd/src/d_soundfile.c
+++ b/pd/src/d_soundfile.c
@@ -1710,6 +1710,12 @@ static t_int *readsf_perform(t_int *w)
#endif
sfread_cond_signal(&x->x_requestcondition);
sfread_cond_wait(&x->x_answercondition, &x->x_mutex);
+ /* resync local cariables -- bug fix thanks to Shahrokh */
+ vecsize = x->x_vecsize;
+ bytespersample = x->x_bytespersample;
+ sfchannels = x->x_sfchannels;
+ wantbytes = sfchannels * vecsize * bytespersample;
+ bigendian = x->x_bigendian;
#ifdef DEBUG_SOUNDFILE
pute("done\n");
#endif
diff --git a/pd/src/g_array.c b/pd/src/g_array.c
index 4d0aa225..14854f0a 100644
--- a/pd/src/g_array.c
+++ b/pd/src/g_array.c
@@ -80,7 +80,6 @@ void array_resize(t_array *x, int n)
{
char *cp = x->a_vec + elemsize * oldn;
int i = n - oldn;
- post("%d->%d", oldn, i);
for (; i--; cp += elemsize)
{
t_word *wp = (t_word *)cp;
@@ -730,7 +729,7 @@ static int array_doclick_element(t_array *array, t_glist *glist,
they can be static (look in g_canvas.h for candidates). */
int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
t_symbol *elemtemplatesym,
- float linewidth, float xloc, float xinc, float yloc,
+ float linewidth, float xloc, float xinc, float yloc, float scalarvis,
t_fielddesc *xfield, t_fielddesc *yfield, t_fielddesc *wfield,
int xpix, int ypix, int shift, int alt, int dbl, int doit)
{
@@ -777,10 +776,14 @@ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
}
}
if (best > 8)
- return (array_doclick_element(array, glist, sc, ap,
- elemtemplatesym, linewidth, xloc, xinc, yloc,
- xfield, yfield, wfield,
- xpix, ypix, shift, alt, dbl, doit));
+ {
+ if (scalarvis != 0)
+ return (array_doclick_element(array, glist, sc, ap,
+ elemtemplatesym, linewidth, xloc, xinc, yloc,
+ xfield, yfield, wfield,
+ xpix, ypix, shift, alt, dbl, doit));
+ else return (0);
+ }
best += 0.001; /* add truncation error margin */
for (i = 0; i < array->a_n; i += incr)
{
diff --git a/pd/src/g_canvas.h b/pd/src/g_canvas.h
index 6d4527b0..188117bc 100644
--- a/pd/src/g_canvas.h
+++ b/pd/src/g_canvas.h
@@ -556,7 +556,7 @@ EXTERN void scalar_getbasexy(t_scalar *x, float *basex, float *basey);
/* ------helper routines for "garrays" and "plots" -------------- */
EXTERN int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap,
t_symbol *elemtemplatesym,
- float linewidth, float xloc, float xinc, float yloc,
+ float linewidth, float xloc, float xinc, float yloc, float scalarvis,
t_fielddesc *xfield, t_fielddesc *yfield, t_fielddesc *wfield,
int xpix, int ypix, int shift, int alt, int dbl, int doit);
diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c
index 9418e3fd..79fd3e9d 100644
--- a/pd/src/g_numbox.c
+++ b/pd/src/g_numbox.c
@@ -36,10 +36,9 @@ static t_class *my_numbox_class;
static void my_numbox_tick_reset(t_my_numbox *x)
{
- if(x->x_gui.x_fsf.x_change)
+ if(x->x_gui.x_fsf.x_change && x->x_gui.x_glist)
{
x->x_gui.x_fsf.x_change = 0;
- glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
}
}
@@ -383,9 +382,7 @@ static void my_numbox_save(t_gobj *z, t_binbuf *b)
{
x->x_gui.x_fsf.x_change = 0;
clock_unset(x->x_clock_reset);
- glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
-
}
binbuf_addv(b, "ssiisiiffiisssiiiiiiifi", gensym("#X"),gensym("obj"),
(int)x->x_gui.x_obj.te_xpix, (int)x->x_gui.x_obj.te_ypix,
@@ -449,7 +446,6 @@ static void my_numbox_properties(t_gobj *z, t_glist *owner)
{
x->x_gui.x_fsf.x_change = 0;
clock_unset(x->x_clock_reset);
- glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0);
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
}
@@ -556,8 +552,6 @@ static int my_numbox_newclick(t_gobj *z, struct _glist *glist,
clock_delay(x->x_clock_wait, 50);
x->x_gui.x_fsf.x_change = 1;
clock_delay(x->x_clock_reset, 3000);
- /* glist_grab(x->x_gui.x_glist, &x->x_gui.x_obj.ob_g,
- 0, my_numbox_key, 0, 0); */
x->x_buf[0] = 0;
}
@@ -565,7 +559,6 @@ static int my_numbox_newclick(t_gobj *z, struct _glist *glist,
{
x->x_gui.x_fsf.x_change = 0;
clock_unset(x->x_clock_reset);
- glist_grab(x->x_gui.x_glist, 0, 0, 0, 0, 0);
x->x_buf[0] = 0;
(*x->x_gui.x_draw)(x, x->x_gui.x_glist, IEM_GUI_DRAW_MODE_UPDATE);
}
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index 4a20a49d..28b54395 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -1239,7 +1239,6 @@ t_class *plot_class;
typedef struct _plot
{
t_object x_obj;
- int x_vis;
t_canvas *x_canvas;
t_fielddesc x_outlinecolor;
t_fielddesc x_width;
@@ -1251,13 +1250,14 @@ typedef struct _plot
t_fielddesc x_xpoints;
t_fielddesc x_ypoints;
t_fielddesc x_wpoints;
+ t_fielddesc x_vis; /* visible */
+ t_fielddesc x_scalarvis; /* true if drawing the scalar at each point */
} t_plot;
static void *plot_new(t_symbol *classsym, t_int argc, t_atom *argv)
{
t_plot *x = (t_plot *)pd_new(plot_class);
- int defstyle = PLOTSTYLE_POLY;
- x->x_vis = 1;
+ int defstyle = PLOTSTYLE_POLY, vis = 1, scalarvis = 1;
x->x_canvas = canvas_getcurrent();
fielddesc_setfloat_var(&x->x_xpoints, gensym("x"));
@@ -1275,7 +1275,12 @@ static void *plot_new(t_symbol *classsym, t_int argc, t_atom *argv)
}
else if (!strcmp(firstarg->s_name, "-n"))
{
- x->x_vis = 0;
+ vis = 0;
+ argc--; argv++;
+ }
+ else if (!strcmp(firstarg->s_name, "-noscalar"))
+ {
+ scalarvis = 0;
argc--; argv++;
}
else if (!strcmp(firstarg->s_name, "-x") && argc > 1)
@@ -1309,15 +1314,26 @@ static void *plot_new(t_symbol *classsym, t_int argc, t_atom *argv)
else fielddesc_setfloat_const(&x->x_xinc, 1);
if (argc) fielddesc_setfloatarg(&x->x_style, argc--, argv++);
else fielddesc_setfloat_const(&x->x_style, defstyle);
+ if (argc) fielddesc_setfloatarg(&x->x_vis, argc--, argv++);
+ else fielddesc_setfloat_const(&x->x_vis, vis);
+ if (argc) fielddesc_setfloatarg(&x->x_scalarvis, argc--, argv++);
+ else fielddesc_setfloat_const(&x->x_scalarvis, 1);
return (x);
}
void plot_float(t_plot *x, t_floatarg f)
{
- if ((f != 0 && x->x_vis) || (f == 0 && !x->x_vis))
+ if (x->x_vis.fd_type != A_FLOAT || x->x_vis.fd_var)
+ {
+ pd_error(x, "global vis/invis for a template with variable visibility");
+ return;
+ }
+ int viswas = (x->x_vis.fd_un.fd_float != 0);
+
+ if ((f != 0 && viswas) || (f == 0 && !viswas))
return;
canvas_redrawallfortemplatecanvas(x->x_canvas, 2);
- x->x_vis = (f!= 0);
+ fielddesc_setfloat_const(&x->x_vis, (f != 0));
canvas_redrawallfortemplatecanvas(x->x_canvas, 1);
}
@@ -1330,6 +1346,7 @@ static int plot_readownertemplate(t_plot *x,
t_word *data, t_template *ownertemplate,
t_symbol **elemtemplatesymp, t_array **arrayp,
float *linewidthp, float *xlocp, float *xincp, float *ylocp, float *stylep,
+ float *visp, float *scalarvisp,
t_fielddesc **xfield, t_fielddesc **yfield, t_fielddesc **wfield)
{
int arrayonset, type;
@@ -1359,6 +1376,8 @@ static int plot_readownertemplate(t_plot *x,
*xincp = fielddesc_getfloat(&x->x_xinc, ownertemplate, data, 1);
*ylocp = fielddesc_getfloat(&x->x_yloc, ownertemplate, data, 1);
*stylep = fielddesc_getfloat(&x->x_style, ownertemplate, data, 1);
+ *visp = fielddesc_getfloat(&x->x_vis, ownertemplate, data, 1);
+ *scalarvisp = fielddesc_getfloat(&x->x_scalarvis, ownertemplate, data, 1);
*elemtemplatesymp = elemtemplatesym;
*arrayp = array;
*xfield = &x->x_xpoints;
@@ -1434,15 +1453,16 @@ static void plot_getrect(t_gobj *z, t_glist *glist,
t_canvas *elemtemplatecanvas;
t_template *elemtemplate;
t_symbol *elemtemplatesym;
- float linewidth, xloc, xinc, yloc, style, xsum, yval;
+ float linewidth, xloc, xinc, yloc, style, xsum, yval, vis, scalarvis;
t_array *array;
int x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff;
int i;
float xpix, ypix, wpix;
t_fielddesc *xfielddesc, *yfielddesc, *wfielddesc;
- if (x->x_vis && !plot_readownertemplate(x, data, template,
+ if (!plot_readownertemplate(x, data, template,
&elemtemplatesym, &array, &linewidth, &xloc, &xinc, &yloc, &style,
- &xfielddesc, &yfielddesc, &wfielddesc) &&
+ &vis, &scalarvis, &xfielddesc, &yfielddesc, &wfielddesc) &&
+ (vis != 0) &&
!array_getfields(elemtemplatesym, &elemtemplatecanvas,
&elemtemplate, &elemsize,
xfielddesc, yfielddesc, wfielddesc,
@@ -1465,34 +1485,37 @@ static void plot_getrect(t_gobj *z, t_glist *glist,
if (ypix + wpix > y2)
y2 = ypix + wpix;
- /* check also the drawing instructions for the scalar */
- if (xonset >= 0)
- usexloc = basex + xloc + fielddesc_cvttocoord(xfielddesc,
- *(float *)(((char *)(array->a_vec) + elemsize * i)
- + xonset));
- else usexloc = basex + xsum, xsum += xinc;
- if (yonset >= 0)
- yval = *(float *)(((char *)(array->a_vec) + elemsize * i)
- + yonset);
- else yval = 0;
- useyloc = basey + yloc + fielddesc_cvttocoord(yfielddesc, yval);
- for (y = elemtemplatecanvas->gl_list; y; y = y->g_next)
+ if (scalarvis != 0)
{
- int xx1, xx2, yy1, yy2;
- t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
- if (!wb) continue;
- (*wb->w_parentgetrectfn)(y, glist,
- (t_word *)((char *)(array->a_vec) + elemsize * i),
- elemtemplate, usexloc, useyloc,
- &xx1, &yy1, &xx2, &yy2);
- if (xx1 < x1)
- x1 = xx1;
- if (yy1 < y1)
- y1 = yy1;
- if (xx2 > x2)
- x2 = xx2;
- if (yy2 > y2)
- y2 = yy2;
+ /* check also the drawing instructions for the scalar */
+ if (xonset >= 0)
+ usexloc = basex + xloc + fielddesc_cvttocoord(xfielddesc,
+ *(float *)(((char *)(array->a_vec) + elemsize * i)
+ + xonset));
+ else usexloc = basex + xsum, xsum += xinc;
+ if (yonset >= 0)
+ yval = *(float *)(((char *)(array->a_vec) + elemsize * i)
+ + yonset);
+ else yval = 0;
+ useyloc = basey + yloc + fielddesc_cvttocoord(yfielddesc, yval);
+ for (y = elemtemplatecanvas->gl_list; y; y = y->g_next)
+ {
+ int xx1, xx2, yy1, yy2;
+ t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
+ if (!wb) continue;
+ (*wb->w_parentgetrectfn)(y, glist,
+ (t_word *)((char *)(array->a_vec) + elemsize * i),
+ elemtemplate, usexloc, useyloc,
+ &xx1, &yy1, &xx2, &yy2);
+ if (xx1 < x1)
+ x1 = xx1;
+ if (yy1 < y1)
+ y1 = yy1;
+ if (xx2 > x2)
+ x2 = xx2;
+ if (yy2 > y2)
+ y2 = yy2;
+ }
}
}
}
@@ -1526,24 +1549,24 @@ static void plot_activate(t_gobj *z, t_glist *glist,
static void plot_vis(t_gobj *z, t_glist *glist,
t_word *data, t_template *template, float basex, float basey,
- int vis)
+ int tovis)
{
t_plot *x = (t_plot *)z;
int elemsize, yonset, wonset, xonset, i;
t_canvas *elemtemplatecanvas;
t_template *elemtemplate;
t_symbol *elemtemplatesym;
- float linewidth, xloc, xinc, yloc, style, usexloc, xsum, yval;
+ float linewidth, xloc, xinc, yloc, style, usexloc, xsum, yval, vis,
+ scalarvis;
t_array *array;
int nelem;
char *elem;
t_fielddesc *xfielddesc, *yfielddesc, *wfielddesc;
- if (!x->x_vis)
- return;
if (plot_readownertemplate(x, data, template,
&elemtemplatesym, &array, &linewidth, &xloc, &xinc, &yloc, &style,
- &xfielddesc, &yfielddesc, &wfielddesc) ||
+ &vis, &scalarvis, &xfielddesc, &yfielddesc, &wfielddesc) ||
+ (vis == 0) ||
array_getfields(elemtemplatesym, &elemtemplatecanvas,
&elemtemplate, &elemsize, xfielddesc, yfielddesc, wfielddesc,
&xonset, &yonset, &wonset))
@@ -1551,7 +1574,7 @@ static void plot_vis(t_gobj *z, t_glist *glist,
nelem = array->a_n;
elem = (char *)array->a_vec;
- if (vis)
+ if (tovis)
{
if (style == PLOTSTYLE_POINTS)
{
@@ -1738,43 +1761,48 @@ static void plot_vis(t_gobj *z, t_glist *glist,
/* We're done with the outline; now draw all the points.
This code is inefficient since the template has to be
searched for drawing instructions for every last point. */
-
- for (xsum = xloc, i = 0; i < nelem; i++)
+ if (scalarvis != 0)
{
- float usexloc, useyloc;
- t_gobj *y;
- if (xonset >= 0)
- usexloc = basex + xloc +
- *(float *)((elem + elemsize * i) + xonset);
- else usexloc = basex + xsum, xsum += xinc;
- if (yonset >= 0)
- yval = *(float *)((elem + elemsize * i) + yonset);
- else yval = 0;
- useyloc = basey + fielddesc_cvttocoord(yfielddesc, yloc + yval);
- for (y = elemtemplatecanvas->gl_list; y; y = y->g_next)
+ for (xsum = xloc, i = 0; i < nelem; i++)
{
- t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
- if (!wb) continue;
- (*wb->w_parentvisfn)(y, glist,
- (t_word *)(elem + elemsize * i),
- elemtemplate, usexloc, useyloc, vis);
+ float usexloc, useyloc;
+ t_gobj *y;
+ if (xonset >= 0)
+ usexloc = basex + xloc +
+ *(float *)((elem + elemsize * i) + xonset);
+ else usexloc = basex + xsum, xsum += xinc;
+ if (yonset >= 0)
+ yval = *(float *)((elem + elemsize * i) + yonset);
+ else yval = 0;
+ useyloc = basey + fielddesc_cvttocoord(yfielddesc, yloc+yval);
+ for (y = elemtemplatecanvas->gl_list; y; y = y->g_next)
+ {
+ t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
+ if (!wb) continue;
+ (*wb->w_parentvisfn)(y, glist,
+ (t_word *)(elem + elemsize * i),
+ elemtemplate, usexloc, useyloc, tovis);
+ }
}
}
}
else
{
/* un-draw the individual points */
- int i;
- for (i = 0; i < nelem; i++)
+ if (scalarvis != 0)
{
- t_gobj *y;
- for (y = elemtemplatecanvas->gl_list; y; y = y->g_next)
+ int i;
+ for (i = 0; i < nelem; i++)
{
- t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
- if (!wb) continue;
- (*wb->w_parentvisfn)(y, glist,
- (t_word *)(elem + elemsize * i), elemtemplate,
- 0, 0, 0);
+ t_gobj *y;
+ for (y = elemtemplatecanvas->gl_list; y; y = y->g_next)
+ {
+ t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
+ if (!wb) continue;
+ (*wb->w_parentvisfn)(y, glist,
+ (t_word *)(elem + elemsize * i), elemtemplate,
+ 0, 0, 0);
+ }
}
}
/* and then the trace */
@@ -1790,17 +1818,18 @@ static int plot_click(t_gobj *z, t_glist *glist,
{
t_plot *x = (t_plot *)z;
t_symbol *elemtemplatesym;
- float linewidth, xloc, xinc, yloc, style;
+ float linewidth, xloc, xinc, yloc, style, vis, scalarvis;
t_array *array;
t_fielddesc *xfielddesc, *yfielddesc, *wfielddesc;
if (!plot_readownertemplate(x, data, template,
&elemtemplatesym, &array, &linewidth, &xloc, &xinc, &yloc, &style,
- &xfielddesc, &yfielddesc, &wfielddesc))
+ &vis, &scalarvis,
+ &xfielddesc, &yfielddesc, &wfielddesc) && (vis != 0))
{
return (array_doclick(array, glist, sc, ap,
elemtemplatesym,
- linewidth, basex + xloc, xinc, basey + yloc,
+ linewidth, basex + xloc, xinc, basey + yloc, scalarvis,
xfielddesc, yfielddesc, wfielddesc,
xpix, ypix, shift, alt, dbl, doit));
}
@@ -2031,7 +2060,7 @@ static int drawnumber_click(t_gobj *z, t_glist *glist,
data, template, basex, basey,
&x1, &y1, &x2, &y2);
if (xpix >= x1 && xpix <= x2 && ypix >= y1 && ypix <= y2
- && x->x_value.fd_var)
+ && x->x_value.fd_var && x->x_vis)
{
if (doit)
{
diff --git a/pd/src/makefile.in b/pd/src/makefile.in
index f525bae3..2851e66a 100644
--- a/pd/src/makefile.in
+++ b/pd/src/makefile.in
@@ -97,11 +97,17 @@ $(BIN_DIR)/pd.tk: u_main.tk
cp u_main.tk $(BIN_DIR)/pd.tk
#this is for Max OSX only...
-$(BIN_DIR)/pdtcl: $(GOBJ) $(GSRC)
- cd ../obj; libtool -dynamic -o $(BIN_DIR)/pdtcl $(GOBJ) \
- ../../Frameworks/Tk.framework/Versions/Current/Tk \
- ../../Frameworks/Tcl.framework/Versions/Current/Tcl \
- /usr/lib/libSystem.B.dylib
+$(BIN_DIR)/libPdTcl.dylib: $(GOBJ) $(GSRC)
+ cd ../obj && $(CC) -dynamiclib -read_only_relocs warning \
+ -o $(BIN_DIR)/libPdTcl.dylib $(GOBJ) \
+ -F@TCLTK_FRAMEWORKS_PATH@ \
+ -framework Tcl -framework Tk -framework System \
+ -Wl,-install_name,@executable_path/../Resources/bin/libPdTcl.dylib
+ install_name_tool -change @TCLTK_FRAMEWORKS_PATH@/Tcl.framework/Versions/8.4/Tcl\
+ @executable_path/../Frameworks/Tcl.framework/Versions/8.4/Tcl \
+ -change @TCLTK_FRAMEWORKS_PATH@/Tk.framework/Versions/8.4/Tk \
+ @executable_path/../Frameworks/Tk.framework/Versions/8.4/Tk \
+ ../bin/libPdTcl.dylib
externs:
cd ../extra/bonk~;make @EXTERNTARGET@
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index 40ca27b3..e3848d17 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -4,9 +4,13 @@ arrays are now first-class data
array elements can be clicked on, etc
fixed array onset bug
rfft bug fix
+bug fix in d_soundfile.c
+bugfix in number2
+plot drawing instructions turn on and off
check:
MIDI I/O for windows
+blechman patch for s_inter.c
At the source level, "regular" arrays and arrays withing data structures
are now the same thing. The main user-visible effect of this is that now
@@ -27,6 +31,7 @@ block resampling arguments
document tabwrite~_start
problems:
+patcher inlets don't deal with scalars (zbug.pd)
Macintosh .pd extension not added to filenames
need to optimize canvas_motion (get rid of box hit test??)
check if there's a problem loading libs on startup if superuser
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index 7e11b5f3..0a45dfd6 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -48,7 +48,7 @@ if {$pd_nt == 2} {
global pd_tearoff
set pd_gui2 [string range $argv0 0 [expr [string last / $argv0 ] - 1]]
set pd_guidir $pd_gui2/..
- load $pd_guidir/bin/pdtcl
+ load $pd_guidir/bin/libPdTcl.dylib
set pd_tearoff 0
# tk::mac::OpenDocument is called with the filenames put into the