aboutsummaryrefslogtreecommitdiff
path: root/pd/src
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2006-06-03 19:13:08 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2006-06-03 19:13:08 +0000
commitbeb2211b63b4b80ee07a807e5ffdd441aeea6354 (patch)
tree876eb052d5cec7755053328a470c75e0638b6b94 /pd/src
parenteb976fa09171036cbaeaabf920708b2d39c49acc (diff)
FFT package selection
Zmoelnig's multi-'$' patch big-soundfile support Patch to set open directories (openpanel, savepanel) patch to allow funny characters in extern names fixed makefile.in to support intel mac svn path=/trunk/; revision=5164
Diffstat (limited to 'pd/src')
-rw-r--r--pd/src/configure.in59
-rw-r--r--pd/src/d_fft.c9
-rw-r--r--pd/src/d_soundfile.c1
-rw-r--r--pd/src/g_array.c28
-rw-r--r--pd/src/g_canvas.c2
-rw-r--r--pd/src/g_editor.c7
-rw-r--r--pd/src/g_graph.c14
-rw-r--r--pd/src/g_template.c10
-rw-r--r--pd/src/g_traversal.c7
-rw-r--r--pd/src/m_atom.c8
-rw-r--r--pd/src/m_binbuf.c120
-rw-r--r--pd/src/makefile.in7
-rw-r--r--pd/src/makefile.nt14
-rw-r--r--pd/src/notes.txt25
-rw-r--r--pd/src/s_audio.c2
-rw-r--r--pd/src/s_audio_pa.c8
-rw-r--r--pd/src/s_audio_pablio.c30
-rw-r--r--pd/src/s_audio_pablio.h8
-rw-r--r--pd/src/s_audio_paring.c40
-rw-r--r--pd/src/s_audio_paring.h32
-rw-r--r--pd/src/s_inter.c2
-rw-r--r--pd/src/s_loader.c45
-rw-r--r--pd/src/s_main.c58
-rw-r--r--pd/src/u_main.tk118
-rw-r--r--pd/src/x_gui.c33
25 files changed, 425 insertions, 262 deletions
diff --git a/pd/src/configure.in b/pd/src/configure.in
index 5e43a990..6656f493 100644
--- a/pd/src/configure.in
+++ b/pd/src/configure.in
@@ -6,6 +6,7 @@ AC_SUBST(jack, no)
AC_SUBST(portaudio, no)
AC_SUBST(portmidi, no)
AC_SUBST(binarymode, -m755)
+AC_SUBST(fftw, no)
AC_SUBST(PDLIB)
AC_SUBST(MORECFLAGS)
AC_SUBST(EXT)
@@ -38,7 +39,9 @@ AC_ARG_ENABLE(static, [ --enable-static link statically],
static=$enableval)
AC_ARG_ENABLE(setuid, [ --enable-setuid install as setuid (linux)],
setuid=$enableval)
-
+AC_ARG_ENABLE(fftw, [ --enable-fftw use FFTW package],
+ fftw=$enableval)
+
dnl Checks for programs.
AC_PROG_CC
AC_PROG_INSTALL
@@ -79,6 +82,13 @@ dnl Checking for `pthread_create' function in -pthread
AC_CHECK_LIB(pthread, pthread_create,PDLIB="$PDLIB -lpthread",
echo "pthreads required" || exit 1)
+dnl Check for fftw package
+if test x$fftw == "xyes";
+then
+AC_CHECK_LIB(fftw, fftw_one,PDLIB="$PDLIB -lfftw",
+ echo "fftw package not found - using built-in FFT"; fftw=no)
+fi
+
dnl look for tcl 8.x... do I really have to go through all this!?
foundit=no
@@ -161,7 +171,7 @@ dnl This should be fixed so Pd can use ALSA shared libraries where appropriate.
LDFLAGS="$LDFLAGS -static"
fi
EXT=pd_linux
- MORECFLAGS="-DDL_OPEN -DPA_USE_OSS -DPA_LITTLE_ENDIAN -DUNIX -DUNISTD\
+ MORECFLAGS="-DDL_OPEN -DPA_USE_OSS -DUNIX -DUNISTD\
-DUSEAPI_OSS \
-I../portaudio/pa_common -I../portaudio/pablio \
-I../portmidi/pm_common \
@@ -213,17 +223,7 @@ dnl This should be fixed so Pd can use ALSA shared libraries where appropriate.
OPT_CFLAGS="-g"
else
OPT_CFLAGS="-O6 -funroll-loops -fomit-frame-pointer"
-
- 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"
@@ -232,26 +232,10 @@ dnl This should be fixed so Pd can use ALSA shared libraries where appropriate.
then
LDFLAGS=$LDFLAGS" -lrt -ljack"
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;
@@ -265,7 +249,7 @@ then
-I../portmidi/pm_common -I../portmidi/pm_mac \
-I../portmidi/porttime \
-Wno-error \
- -DUSEAPI_PORTAUDIO -DPA_BIG_ENDIAN -DPA19 -DPA_USE_COREAUDIO"
+ -DUSEAPI_PORTAUDIO -DPA19 -DPA_USE_COREAUDIO"
SYSSRC="s_midi_pm.c s_audio_pa.c \
s_audio_pablio.c \
s_audio_paring.c \
@@ -313,7 +297,12 @@ then
OPT_CFLAGS="-O2"
fi
OSNUMBER=2
- EXTERNTARGET=pd_darwin
+ if test `uname -m` = i386;
+ then
+ EXTERNTARGET=pd_imac
+ else
+ EXTERNTARGET=pd_darwin
+ fi
if test x$jack == "xyes";
then
LDFLAGS=$LDFLAGS" -weak_framework Jack"
@@ -337,6 +326,14 @@ then
SYSSRC=$SYSSRC" s_audio_jack.c"
fi
+if test x$fftw == "xyes";
+then
+ SYSSRC=$SYSSRC" d_fft_fftw.c d_fftroutine.c"
+ LDFLAGS=$LDFLAGS" -lfftw"
+else
+ SYSSRC=$SYSSRC" d_fft_mayer.c d_fftroutine.c"
+fi
+
# extra flags for alpha machines
if test `uname -m | awk '{print $1}'` = alpha;
then
diff --git a/pd/src/d_fft.c b/pd/src/d_fft.c
index fa2590ea..006a985a 100644
--- a/pd/src/d_fft.c
+++ b/pd/src/d_fft.c
@@ -1,9 +1,16 @@
-/* Copyright (c) 1997-1999 Miller Puckette and others.
+/* Copyright (c) 1997- Miller Puckette and others.
* For information on usage and redistribution, and for a DISCLAIMER OF ALL
* WARRANTIES, see the file, "LICENSE.txt," in this distribution. */
#include "m_pd.h"
+/* This file interfaces to one of the Mayer, Ooura, or fftw FFT packages
+to implement the "fft~", etc, Pd objects. If using Mayer, also compile
+d_fft_mayer.c; if ooura, use d_fft_fftsg.c instead; if fftw, use d_fft_fftw.c
+and also link in the fftw library. You can only have one of these three
+linked in. The configure script can be used to select which one.
+*/
+
/* ---------------- utility functions for DSP chains ---------------------- */
/* swap two arrays */
diff --git a/pd/src/d_soundfile.c b/pd/src/d_soundfile.c
index f0216126..562979f8 100644
--- a/pd/src/d_soundfile.c
+++ b/pd/src/d_soundfile.c
@@ -1790,7 +1790,6 @@ static t_int *readsf_perform(t_int *w)
}
else
{
- idle:
for (i = 0; i < noutlets; i++)
for (j = vecsize, fp = x->x_outvec[i]; j--; )
*fp++ = 0;
diff --git a/pd/src/g_array.c b/pd/src/g_array.c
index cf577010..fdbb6416 100644
--- a/pd/src/g_array.c
+++ b/pd/src/g_array.c
@@ -133,6 +133,7 @@ struct _garray
char x_usedindsp; /* true if some DSP routine is using this */
char x_saveit; /* true if we should save this with parent */
char x_listviewing; /* true if list view window is open */
+ char x_hidename; /* don't print name above graph */
};
static t_pd *garray_arraytemplatecanvas;
@@ -245,10 +246,11 @@ static t_array *garray_getarray_floatonly(t_garray *x,
return (a);
}
- /* get the array's name */
-t_symbol *garray_getname(t_garray *x)
+ /* get the array's name. Return nonzero if it should be hidden */
+int garray_getname(t_garray *x, t_symbol **namep)
{
- return (x->x_name);
+ *namep = x->x_name;
+ return (x->x_hidename);
}
/* if there is one garray in a graph, reset the graph's coordinates
@@ -320,6 +322,7 @@ t_garray *graph_array(t_glist *gl, t_symbol *s, t_symbol *templateargsym,
}
saveit = ((flags & 1) != 0);
x = graph_scalar(gl, s, templatesym, saveit);
+ x->x_hidename = ((flags & 8) >> 3);
if (n <= 0)
n = 100;
@@ -486,14 +489,16 @@ void garray_arrayviewlist_new(t_garray *x)
}
void garray_arrayviewlist_fillpage(t_garray *x,
- t_float page)
+ t_float page,
+ t_float fTopItem)
{
- int i, xonset=0, yonset=0, type=0, elemsize=0;
+ int i, xonset=0, yonset=0, type=0, elemsize=0, topItem;
float yval;
char cmdbuf[200];
t_symbol *arraytype;
t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize);
-
+
+ topItem = (int)fTopItem;
if (!a)
{
/* FIXME */
@@ -527,6 +532,9 @@ void garray_arrayviewlist_fillpage(t_garray *x,
i,
yval);
}
+ sys_vgui(".%sArrayWindow.lb yview %d\n",
+ x->x_realname->s_name,
+ topItem);
}
void garray_arrayviewlist_close(t_garray *x)
@@ -540,8 +548,9 @@ void garray_arrayviewlist_close(t_garray *x)
static void garray_free(t_garray *x)
{
t_pd *x2;
+ sys_unqueuegui(&x->x_gobj);
/* jsarlo { */
- if (x->x_listviewing)
+ if (x->x_listviewing)
{
garray_arrayviewlist_close(x);
}
@@ -1028,7 +1037,8 @@ static void garray_save(t_gobj *z, t_binbuf *b)
filestyle = (style == PLOTSTYLE_POINTS ? 1 :
(style == PLOTSTYLE_POLY ? 0 : style));
binbuf_addv(b, "sssisi;", gensym("#X"), gensym("array"),
- x->x_name, array->a_n, &s_float, x->x_saveit + 2 * filestyle);
+ x->x_name, array->a_n, &s_float,
+ x->x_saveit + 2 * filestyle + 8*x->x_hidename);
if (x->x_saveit)
{
int n = array->a_n, n2 = 0;
@@ -1494,7 +1504,7 @@ void g_array_setup(void)
class_addmethod(garray_class, (t_method)garray_arrayviewlist_new,
gensym("arrayviewlistnew"), A_NULL);
class_addmethod(garray_class, (t_method)garray_arrayviewlist_fillpage,
- gensym("arrayviewlistfillpage"), A_FLOAT, A_NULL);
+ gensym("arrayviewlistfillpage"), A_FLOAT, A_DEFFLOAT, A_NULL);
class_addmethod(garray_class, (t_method)garray_arrayviewlist_close,
gensym("arrayviewclose"), A_NULL);
/* } jsarlo */
diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index 15acc44b..edc387a4 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -1494,7 +1494,7 @@ void g_canvas_setup(void)
class_addmethod(canvas_class, (t_method)glist_scalar,
gensym("scalar"), A_GIMME, A_NULL);
- /* -------------- Thomas Musil's GUI objects ------------ */
+/* -------------- IEMGUI: button, toggle, slider, etc. ------------ */
class_addmethod(canvas_class, (t_method)canvas_bng, gensym("bng"),
A_GIMME, A_NULL);
class_addmethod(canvas_class, (t_method)canvas_toggle, gensym("toggle"),
diff --git a/pd/src/g_editor.c b/pd/src/g_editor.c
index 0db0c140..77eaf156 100644
--- a/pd/src/g_editor.c
+++ b/pd/src/g_editor.c
@@ -785,10 +785,13 @@ static t_gobj *canvas_findhitbox(t_canvas *x, int xpos, int ypos,
int *x1p, int *y1p, int *x2p, int *y2p)
{
t_gobj *y, *rval = 0;
+ int x1, y1, x2, y2;
+ *x1p = -0x7fffffff;
for (y = x->gl_list; y; y = y->g_next)
{
- if (canvas_hitbox(x, y, xpos, ypos, x1p, y1p, x2p, y2p))
- rval = y;
+ if (canvas_hitbox(x, y, xpos, ypos, &x1, &y1, &x2, &y2)
+ && (x1 > *x1p))
+ *x1p = x1, *y1p = y1, *x2p = x2, *y2p = y2, rval = y;
}
return (rval);
}
diff --git a/pd/src/g_graph.c b/pd/src/g_graph.c
index 305da6aa..97fe71e7 100644
--- a/pd/src/g_graph.c
+++ b/pd/src/g_graph.c
@@ -672,7 +672,7 @@ void glist_redraw(t_glist *x)
/* --------------------------- widget behavior ------------------- */
extern t_widgetbehavior text_widgetbehavior;
-t_symbol *garray_getname(t_garray *x);
+int garray_getname(t_garray *x, t_symbol **namep);
/* Note that some code in here would also be useful for drawing
@@ -726,6 +726,7 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
float f;
t_gobj *g;
t_symbol *arrayname;
+ t_garray *ga;
/* draw a rectangle around the graph */
sys_vgui(".x%lx.c create line\
%d %d %d %d %d %d %d %d %d %d -tags %s\n",
@@ -734,13 +735,14 @@ static void graph_vis(t_gobj *gr, t_glist *parent_glist, int vis)
/* if there's just one "garray" in the graph, write its name
along the top */
- if ((g = x->gl_list) && !g->g_next && (g->g_pd == garray_class))
+ for (i = (y1 < y2 ? y1 : y2)-1, g = x->gl_list; g; g = g->g_next)
+ if (g->g_pd == garray_class &&
+ !garray_getname((t_garray *)g, &arrayname))
{
- int ymin = (y1 < y2 ? y1 : y2);
- t_symbol *s = garray_getname((t_garray *)g);
- sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor sw\
+ i -= sys_fontheight(glist_getfont(x));
+ sys_vgui(".x%lx.c create text %d %d -text {%s} -anchor nw\
-font -*-courier-bold--normal--%d-* -tags %s\n",
- (long)glist_getcanvas(x), x1, ymin, s->s_name,
+ (long)glist_getcanvas(x), x1, i, arrayname->s_name,
sys_hostfontsize(glist_getfont(x)), tag);
}
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index 05cede66..b2b359d3 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -1082,6 +1082,7 @@ static void curve_activate(t_gobj *z, t_glist *glist,
/* fill in later */
}
+#if 0
static int rangecolor(int n) /* 0 to 9 in 5 steps */
{
int n2 = n/2; /* 0 to 4 */
@@ -1089,6 +1090,15 @@ static int rangecolor(int n) /* 0 to 9 in 5 steps */
if (ret > 255) ret = 255;
return (ret);
}
+#endif
+
+static int rangecolor(int n) /* 0 to 9 in 5 steps */
+{
+ int n2 = (n == 9 ? 8 : n); /* 0 to 8 */
+ int ret = (n2 << 5); /* 0 to 256 in 9 steps */
+ if (ret > 255) ret = 255;
+ return (ret);
+}
static void numbertocolor(int n, char *s)
{
diff --git a/pd/src/g_traversal.c b/pd/src/g_traversal.c
index 375b5123..9ec8ca90 100644
--- a/pd/src/g_traversal.c
+++ b/pd/src/g_traversal.c
@@ -1036,8 +1036,6 @@ static void append_float(t_append *x, t_float f)
sc->sc_gobj.g_next = glist->gl_list;
glist->gl_list = &sc->sc_gobj;
}
- if (glist_isvisible(glist_getcanvas(glist)))
- gobj_vis(&sc->sc_gobj, glist, 1);
gp->gp_un.gp_scalar = sc;
vec = sc->sc_vec;
@@ -1046,7 +1044,10 @@ static void append_float(t_append *x, t_float f)
template_setfloat(template, vp->gv_sym, vec, vp->gv_f, 1);
}
- scalar_redraw(sc, glist);
+ if (glist_isvisible(glist_getcanvas(glist)))
+ gobj_vis(&sc->sc_gobj, glist, 1);
+ /* scalar_redraw(sc, glist); ... have to do 'vis' instead here because
+ redraw assumes we're already visible??? ... */
outlet_pointer(x->x_obj.ob_outlet, gp);
}
diff --git a/pd/src/m_atom.c b/pd/src/m_atom.c
index 8ba13131..95e2216c 100644
--- a/pd/src/m_atom.c
+++ b/pd/src/m_atom.c
@@ -88,8 +88,7 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize)
int quote;
for (sp = a->a_w.w_symbol->s_name, len = 0, quote = 0; *sp; sp++, len++)
if (*sp == ';' || *sp == ',' || *sp == '\\' ||
- (*sp == '$' && sp == a->a_w.w_symbol->s_name && sp[1] >= '0'
- && sp[1] <= '9'))
+ (*sp == '$' && sp[1] >= '0' && sp[1] <= '9'))
quote = 1;
if (quote)
{
@@ -98,7 +97,7 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize)
while (bp < ep && *sp)
{
if (*sp == ';' || *sp == ',' || *sp == '\\' ||
- (*sp == '$' && bp == buf && sp[1] >= '0' && sp[1] <= '9'))
+ (*sp == '$' && sp[1] >= '0' && sp[1] <= '9'))
*bp++ = '\\';
*bp++ = *sp++;
}
@@ -121,7 +120,8 @@ void atom_string(t_atom *a, char *buf, unsigned int bufsize)
sprintf(buf, "$%d", a->a_w.w_index);
break;
case A_DOLLSYM:
- sprintf(buf, "$%s", a->a_w.w_symbol->s_name);
+ snprintf(buf, bufsize-1, "%s", a->a_w.w_symbol->s_name);
+ buf[bufsize-1] = 0;
break;
default:
bug("atom_string");
diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c
index 37362360..6afbb931 100644
--- a/pd/src/m_binbuf.c
+++ b/pd/src/m_binbuf.c
@@ -149,14 +149,14 @@ void binbuf_text(t_binbuf *x, char *text, size_t size)
&& *textp != '\t' &&*textp != ',' && *textp != ';')));
*bufp = 0;
#if 0
- post("buf %s", buf);
+ post("binbuf_text: buf %s", buf);
#endif
if (*buf == '$' && buf[1] >= '0' && buf[1] <= '9' && !firstslash)
{
for (bufp = buf+2; *bufp; bufp++)
if (*bufp < '0' || *bufp > '9')
{
- SETDOLLSYM(ap, gensym(buf+1));
+ SETDOLLSYM(ap, gensym(buf));
goto didit;
}
SETDOLLAR(ap, atoi(buf+1));
@@ -307,7 +307,7 @@ void binbuf_addbinbuf(t_binbuf *x, t_binbuf *y)
SETSYMBOL(ap, gensym(tbuf));
break;
case A_DOLLSYM:
- sprintf(tbuf, "$%s", ap->a_w.w_symbol->s_name);
+ atom_string(ap, tbuf, MAXPDSTRING);
SETSYMBOL(ap, gensym(tbuf));
break;
case A_SYMBOL:
@@ -363,7 +363,7 @@ void binbuf_restore(t_binbuf *x, int argc, t_atom *argv)
if (*str2 < '0' || *str2 > '9')
dollsym = 1;
if (dollsym)
- SETDOLLSYM(ap, gensym(str + 1));
+ SETDOLLSYM(ap, gensym(str));
else
{
int dollar = 0;
@@ -413,26 +413,106 @@ t_atom *binbuf_getvec(t_binbuf *x)
int canvas_getdollarzero( void);
+/* JMZ:
+ * s points to the first character after the $
+ * (e.g. if the org.symbol is "$1-bla", then s will point to "1-bla")
+ * (e.g. org.symbol="hu-$1mu", s="1mu")
+ * LATER: think about more complex $args, like ${$1+3}
+ *
+ * the return value holds the length of the $arg (in most cases: 1)
+ * buf holds the expanded $arg
+ *
+ * if some error occured, "-1" is returned
+ *
+ * e.g. "$1-bla" with list "10 20 30"
+ * s="1-bla"
+ * buf="10"
+ * return value = 1; (s+1=="-bla")
+ */
+int binbuf_expanddollsym(char*s, char*buf,t_atom dollar0, int ac, t_atom *av, int tonew)
+{
+ int argno=atol(s);
+ int arglen=0;
+ char*cs=s;
+ char c=*cs;
+ *buf=0;
+
+ while(c&&(c>='0')&&(c<='9')){
+ c=*cs++;
+ arglen++;
+ }
+
+ if (cs==s) { /* invalid $-expansion (like "$bla") */
+ sprintf(buf, "$");
+ return 0;
+ }
+ else if (argno < 0 || argno > ac) /* undefined argument */
+ {
+ if(!tonew)return 0;
+ sprintf(buf, "$%d", argno);
+ }
+ else if (argno == 0){ /* $0 */
+ atom_string(&dollar0, buf, MAXPDSTRING/2-1);
+ }
+ else{ /* fine! */
+ atom_string(av+(argno-1), buf, MAXPDSTRING/2-1);
+ }
+ return (arglen-1);
+}
+
/* LATER remove the dependence on the current canvas for $0; should be another
argument. */
t_symbol *binbuf_realizedollsym(t_symbol *s, int ac, t_atom *av, int tonew)
{
- int argno = atol(s->s_name), lastnum;
- char buf[MAXPDSTRING], c, *sp;
- for (lastnum = 0, sp = s->s_name; ((c = *sp) && c >= '0' && c <= '9');
- sp++, lastnum++)
- if (!c || argno < 0 || argno > ac)
- {
- if (!tonew)
- return (0);
- else sprintf(buf, "$%d", argno);
+ char buf[MAXPDSTRING];
+ char buf2[MAXPDSTRING];
+ char*str=s->s_name;
+ char*substr;
+ int next=0, i=MAXPDSTRING;
+ t_atom dollarnull;
+ SETFLOAT(&dollarnull, canvas_getdollarzero());
+ while(i--)buf2[i]=0;
+
+#if 1
+ /* JMZ: currently, a symbol is detected to be A_DOLLSYM if it starts with '$'
+ * the leading $ is stripped and the rest stored in "s"
+ * i would suggest to NOT strip the leading $
+ * and make everything a A_DOLLSYM that contains(!) a $
+ *
+ * whenever this happened, enable this code
+ */
+ substr=strchr(str, '$');
+ if(substr){
+ strncat(buf2, str, (substr-str));
+ str=substr+1;
}
- else if (argno == 0)
- sprintf(buf, "%d", canvas_getdollarzero());
- else
- atom_string(av+(argno-1), buf, MAXPDSTRING/2-1);
- strncat(buf, sp, MAXPDSTRING/2-1);
- return (gensym(buf));
+#endif
+
+ while((next=binbuf_expanddollsym(str, buf, dollarnull, ac, av, tonew))>=0)
+ {
+ /*
+ * JMZ: i am not sure what this means, so i might have broken it
+ * it seems like that if "tonew" is set and the $arg cannot be expanded (or the dollarsym is in reality a A_DOLLAR)
+ * 0 is returned from binbuf_realizedollsym
+ * this happens, when expanding in a message-box, but does not happen when the A_DOLLSYM is the name of a subpatch
+ */
+ if(!tonew&&(0==next)&&(0==*buf)){
+ return 0; /* JMZ: this should mimick the original behaviour */
+ }
+
+ strncat(buf2, buf, MAXPDSTRING/2-1);
+ str+=next;
+ substr=strchr(str, '$');
+ if(substr){
+ strncat(buf2, str, (substr-str));
+ str=substr+1;
+ } else {
+ strcat(buf2, str);
+
+ return gensym(buf2);
+ }
+ }
+ return (gensym(buf2));
}
void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv)
@@ -817,7 +897,7 @@ static t_binbuf *binbuf_convert(t_binbuf *oldb, int maxtopd)
else if (nextmess[i].a_type == A_DOLLSYM)
{
char buf[100];
- sprintf(buf, "$%s", nextmess[i].a_w.w_symbol->s_name);
+ sprintf(buf, "%s", nextmess[i].a_w.w_symbol->s_name);
SETSYMBOL(nextmess+i, gensym(buf));
}
}
diff --git a/pd/src/makefile.in b/pd/src/makefile.in
index b28b844a..6f644237 100644
--- a/pd/src/makefile.in
+++ b/pd/src/makefile.in
@@ -49,13 +49,12 @@ SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
s_main.c s_inter.c s_file.c s_print.c \
s_loader.c s_path.c s_entry.c s_audio.c s_midi.c \
d_ugen.c d_ctl.c d_arithmetic.c d_osc.c d_filter.c d_dac.c d_misc.c \
- d_math.c d_fft.c d_mayer_fft.c d_fftroutine.c d_array.c d_global.c \
+ d_math.c d_fft.c d_array.c d_global.c \
d_delay.c d_resample.c \
x_arithmetic.c x_connective.c x_interface.c x_midi.c x_misc.c \
x_time.c x_acoustics.c x_net.c x_qlist.c x_gui.c x_list.c d_soundfile.c \
$(SYSSRC)
-
OBJ = $(SRC:.c=.o)
GSRC = t_main.c t_tkcmd.c
@@ -165,7 +164,7 @@ install: all
local-clean:
-rm -f ../obj/* $(BIN_DIR)/pd $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
$(BIN_DIR)/pdreceive $(BIN_DIR)/pd-watchdog m_stamp.c
- -rm -f `find ../portaudio ../portaudio_v18 -name "*.o"`
+ -rm -f `find ../portaudio -name "*.o"`
-rm -f *~
-(cd ../doc/6.externs; rm -f *.pd_linux)
-rm -f makefile.dependencies
@@ -179,7 +178,7 @@ extra-clean:
clean: extra-clean local-clean
distclean: clean
- -rm -f config.cache config.log config.status makefile configure tags \
+ -rm -f config.cache config.log config.status makefile tags \
autom4te.cache/output.* autom4te.cache/traces.* autom4te.cache/requests
-rmdir autom4te.cache
-rm -rf autom4te-*.cache
diff --git a/pd/src/makefile.nt b/pd/src/makefile.nt
index e696e751..56b94a0a 100644
--- a/pd/src/makefile.nt
+++ b/pd/src/makefile.nt
@@ -4,7 +4,7 @@ all: pd gui ..\bin\pd.tk ..\bin\pdsend.exe ..\bin\pdreceive.exe
VC = "C:\Program Files\Microsoft Visual Studio\VC98"
#VC="\Program Files\DevStudio\Vc"
-INCLUDE = -I.\ -I..\Tcl\include -I$(VC)\include
+INCLUDE = -I.\ -I..\Tcl\include -I\DXSDK\include -I$(VC)\include
LDIR = $(VC)\lib
@@ -12,7 +12,7 @@ LIB = /NODEFAULTLIB:libc /NODEFAULTLIB:oldnames /NODEFAULTLIB:kernel \
/NODEFAULTLIB:uuid \
$(LDIR)\libc.lib $(LDIR)\oldnames.lib $(LDIR)\kernel32.lib \
$(LDIR)\wsock32.lib $(LDIR)\winmm.lib $(LDIR)\advapi32.lib \
- ..\bin\pthreadVC.lib
+ $(LDIR)\setupapi.lib ..\bin\pthreadVC.lib
GLIB = $(LIB) ..\bin\tcl84.lib ..\bin\tk84.lib
CFLAGS = /nologo /W3 /DMSW /DNT /DPD /DPD_INTERNAL /DWIN32 /DWINDOWS /Ox \
@@ -50,7 +50,8 @@ SRCPA = $(PADIR)/pa_common/pa_stream.c \
$(PADIR)/pa_common/pa_allocation.c \
$(PADIR)/pa_win/pa_win_util.c \
$(PADIR)/pa_win/pa_win_hostapis.c \
- $(PADIR)/pa_win_wmme/pa_win_wmme.c
+ $(PADIR)/pa_win_wmme/pa_win_wmme.c
+# $(PADIR)/pa_win_wdmks/pa_win_wdmks.c
SRCASIO = $(PADIR)/pa_asio/pa_asio.cpp
@@ -63,7 +64,8 @@ $(LDIR)\odbc32.lib $(LDIR)\odbccp32.lib ..\lib\asio\asiolib.lib
PAOBJ = pa_stream.obj pa_trace.obj pa_skeleton.obj pa_process.obj \
pa_front.obj pa_dither.obj pa_cpuload.obj pa_converters.obj \
pa_allocation.obj pa_win_util.obj pa_win_hostapis.obj pa_asio.obj \
- pa_win_wmme.obj
+ pa_win_wmme.obj
+# pa_win_wdmks.obj
PMDIR = ..\portmidi
INCPM = -I$(PMDIR)\pm_common -I$(PMDIR)\pm_win -I$(PMDIR)\porttime
@@ -150,6 +152,10 @@ pa_win_hostapis.obj: $(PADIR)\pa_win\pa_win_hostapis.c
cl /c $(ALLCF) $(PADIR)\pa_win\pa_win_hostapis.c
pa_win_wmme.obj: $(PADIR)\pa_win_wmme\pa_win_wmme.c
cl /c $(ALLCF) $(PADIR)\pa_win_wmme\pa_win_wmme.c
+pa_win_wdmks.obj: $(PADIR)\pa_win_wdmks\pa_win_wdmks.c
+ cl /c $(ALLCF) \
+ -DWINVER=0x400 -DKSAUDIO_SPEAKER_DIRECTOUT \
+ $(PADIR)\pa_win_wdmks\pa_win_wdmks.c
pa_asio.obj: $(PADIR)\pa_asio\pa_asio.cpp
cl /c $(ALLCF) $(PADIR)\pa_asio\pa_asio.cpp
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index 034849a5..4c3b1997 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -7,6 +7,14 @@ windows:
check the right-click-on-empty-canvas
MIDI I/O (inc. sysex)
what does OSX do when jack is compiled into Pd but not installed??
+turn on paMacCore_ChangeDeviceParameters for mac (pa_mac_core.h)
+
+done:
+openpanel directory
+big-soundfile support
+escaping filenames for wierdly named externs
+infrastructure for adding externs in non-ascii languages
+'$' patch (multiple dollar-sign expansion)
doc:
object list
@@ -15,8 +23,17 @@ vibrato example
block resampling arguments
document tabwrite~_start
"list" to signal inlet (e.g., "*~") or float inlet (f) complains.
+$-expansion changed
problems:
+crashed Pd putting vec and template in wrong order in array element of struct
+z.pd - list to numbox misbehaves (inlet and object but object is noinlet)
+floor, ciel functions in expr misdeclared
+graphics updates in data sometimes don't happen?
+graph names don't appear until graph moved? (invis/vis on new array/rename)
+flag to defeat .pdsettings
+'{' bug
+"-audiodev" with no args in registry can't start up in MSW
"save as" with spaces in filename still messes up
don't filter locked click() through getrect
better scalar hit detection (getrect is too greedy)
@@ -43,9 +60,12 @@ check if _vsnprintf with zero argument in windows works any better...
detect adc~ and dac~ reblocking
features:
+sprout inlet for "route", "sel" if one arg; also send
+list length and nth functions
+poly inlet to turn stealing on/off
.dll to .msw32 or .pd_msw (then offer .pd_msw64, .pd_lnx64, etc.)
integrate video into tilde objects
-flag to suppress printing array name above graph
+graph "hide name" flag controllable from dialog
flag to suppress scrollbars in canvases
fix copyright notices
pixel font sizes
@@ -97,6 +117,9 @@ append doesn't do symbols yet.
more features:
+"-march=pentium4 -O2 -mfpmath=sse -msse -msse2 -mmmx" ?
+try to improve for AMD - try "-march=athlon-xp -msse2"
+search for -mcpu=cpu-type in man gcc.
-Wno-unused to -Wno-unused-paramter and clean up unused automatic variables
security module system in 2.6 - see the kernel module replacing jackstart
signal inlets to sense signals; fix +~ etc, vcf~, biquad~, other filters
diff --git a/pd/src/s_audio.c b/pd/src/s_audio.c
index cbfd6f0c..8d4683f8 100644
--- a/pd/src/s_audio.c
+++ b/pd/src/s_audio.c
@@ -608,7 +608,7 @@ static void sys_listaudiodevs(void )
{
post("input devices:");
for (i = 0; i < nindevs; i++)
- post("%d. %s", i+1, indevlist + i * DEVDESCSIZE);
+ post("%d. %s", i + DEVONSET, indevlist + i * DEVDESCSIZE);
}
if (!noutdevs)
post("no audio output devices found");
diff --git a/pd/src/s_audio_pa.c b/pd/src/s_audio_pa.c
index 15699556..627b0015 100644
--- a/pd/src/s_audio_pa.c
+++ b/pd/src/s_audio_pa.c
@@ -274,12 +274,16 @@ void pa_getdevs(char *indevlist, int *nindevs,
const PaDeviceInfo *pdi = Pa_GetDeviceInfo(i);
if (pdi->maxInputChannels > 0 && nin < maxndev)
{
- strcpy(indevlist + nin * devdescsize, pdi->name);
+ sprintf(indevlist + nin * devdescsize, "(%d)%s",
+ pdi->hostApi,pdi->name);
+ /* strcpy(indevlist + nin * devdescsize, pdi->name); */
nin++;
}
if (pdi->maxOutputChannels > 0 && nout < maxndev)
{
- strcpy(outdevlist + nout * devdescsize, pdi->name);
+ sprintf(outdevlist + nout * devdescsize, "(%d)%s",
+ pdi->hostApi,pdi->name);
+ /* strcpy(outdevlist + nout * devdescsize, pdi->name); */
nout++;
}
}
diff --git a/pd/src/s_audio_pablio.c b/pd/src/s_audio_pablio.c
index 3bd626ee..a7d1a4fe 100644
--- a/pd/src/s_audio_pablio.c
+++ b/pd/src/s_audio_pablio.c
@@ -69,8 +69,8 @@ static int blockingIOCallback( void *inputBuffer, void *outputBuffer,
unsigned long framesPerBuffer,
PaTimestamp outTime, void *userData );
#endif
-static PaError PABLIO_InitFIFO( RingBuffer *rbuf, long numFrames, long bytesPerFrame );
-static PaError PABLIO_TermFIFO( RingBuffer *rbuf );
+static PaError PABLIO_InitFIFO( sys_ringbuf *rbuf, long numFrames, long bytesPerFrame );
+static PaError PABLIO_TermFIFO( sys_ringbuf *rbuf );
/************************************************************************/
/******** Functions *****************************************************/
@@ -97,14 +97,14 @@ static int blockingIOCallback( void *inputBuffer, void *outputBuffer,
/* This may get called with NULL inputBuffer during initial setup. */
if( inputBuffer != NULL )
{
- RingBuffer_Write( &data->inFIFO, inputBuffer,
+ sys_ringbuf_Write( &data->inFIFO, inputBuffer,
data->inbytesPerFrame * framesPerBuffer );
}
if( outputBuffer != NULL )
{
int i;
int numBytes = data->outbytesPerFrame * framesPerBuffer;
- int numRead = RingBuffer_Read( &data->outFIFO, outputBuffer,
+ int numRead = sys_ringbuf_Read( &data->outFIFO, outputBuffer,
numBytes);
/* Zero out remainder of buffer if we run out of data. */
for( i=numRead; i<numBytes; i++ )
@@ -117,17 +117,17 @@ static int blockingIOCallback( void *inputBuffer, void *outputBuffer,
}
/* Allocate buffer. */
-static PaError PABLIO_InitFIFO( RingBuffer *rbuf, long numFrames, long bytesPerFrame )
+static PaError PABLIO_InitFIFO( sys_ringbuf *rbuf, long numFrames, long bytesPerFrame )
{
long numBytes = numFrames * bytesPerFrame;
char *buffer = (char *) malloc( numBytes );
if( buffer == NULL ) return paInsufficientMemory;
memset( buffer, 0, numBytes );
- return (PaError) RingBuffer_Init( rbuf, numBytes, buffer );
+ return (PaError) sys_ringbuf_Init( rbuf, numBytes, buffer );
}
/* Free buffer. */
-static PaError PABLIO_TermFIFO( RingBuffer *rbuf )
+static PaError PABLIO_TermFIFO( sys_ringbuf *rbuf )
{
if( rbuf->buffer ) free( rbuf->buffer );
rbuf->buffer = NULL;
@@ -145,7 +145,7 @@ long WriteAudioStream( PABLIO_Stream *aStream, void *data, long numFrames )
long numBytes = aStream->outbytesPerFrame * numFrames;
while( numBytes > 0)
{
- bytesWritten = RingBuffer_Write( &aStream->outFIFO, p, numBytes );
+ bytesWritten = sys_ringbuf_Write( &aStream->outFIFO, p, numBytes );
numBytes -= bytesWritten;
p += bytesWritten;
if( numBytes > 0) NPa_Sleep(10); /* MSP */
@@ -164,7 +164,7 @@ long ReadAudioStream( PABLIO_Stream *aStream, void *data, long numFrames )
long numBytes = aStream->inbytesPerFrame * numFrames;
while( numBytes > 0)
{
- bytesRead = RingBuffer_Read( &aStream->inFIFO, p, numBytes );
+ bytesRead = sys_ringbuf_Read( &aStream->inFIFO, p, numBytes );
numBytes -= bytesRead;
p += bytesRead;
if( numBytes > 0) NPa_Sleep(10); /* MSP */
@@ -178,7 +178,7 @@ long ReadAudioStream( PABLIO_Stream *aStream, void *data, long numFrames )
*/
long GetAudioStreamWriteable( PABLIO_Stream *aStream )
{
- int bytesEmpty = RingBuffer_GetWriteAvailable( &aStream->outFIFO );
+ int bytesEmpty = sys_ringbuf_GetWriteAvailable( &aStream->outFIFO );
return bytesEmpty / aStream->outbytesPerFrame;
}
@@ -188,7 +188,7 @@ long GetAudioStreamWriteable( PABLIO_Stream *aStream )
*/
long GetAudioStreamReadable( PABLIO_Stream *aStream )
{
- int bytesFull = RingBuffer_GetReadAvailable( &aStream->inFIFO );
+ int bytesFull = sys_ringbuf_GetReadAvailable( &aStream->inFIFO );
return bytesFull / aStream->inbytesPerFrame;
}
@@ -320,8 +320,8 @@ PaError OpenAudioStream( PABLIO_Stream **rwblPtr, double sampleRate,
aStream->outbytesPerFrame );
if( err != paNoError ) goto error;
/* Make Write FIFO appear full initially. */
- numBytes = RingBuffer_GetWriteAvailable( &aStream->outFIFO );
- RingBuffer_AdvanceWriteIndex( &aStream->outFIFO, numBytes );
+ numBytes = sys_ringbuf_GetWriteAvailable( &aStream->outFIFO );
+ sys_ringbuf_AdvanceWriteIndex( &aStream->outFIFO, numBytes );
}
/* Open a PortAudio stream that we will use to communicate with the underlying
@@ -382,11 +382,11 @@ PaError CloseAudioStream( PABLIO_Stream *aStream )
/* If we are writing data, make sure we play everything written. */
if( byteSize > 0 )
{
- bytesEmpty = RingBuffer_GetWriteAvailable( &aStream->outFIFO );
+ bytesEmpty = sys_ringbuf_GetWriteAvailable( &aStream->outFIFO );
while( bytesEmpty < byteSize )
{
NPa_Sleep( 10 ); /* MSP */
- bytesEmpty = RingBuffer_GetWriteAvailable( &aStream->outFIFO );
+ bytesEmpty = sys_ringbuf_GetWriteAvailable( &aStream->outFIFO );
}
}
diff --git a/pd/src/s_audio_pablio.h b/pd/src/s_audio_pablio.h
index 052ffedb..43e9a4b9 100644
--- a/pd/src/s_audio_pablio.h
+++ b/pd/src/s_audio_pablio.h
@@ -7,7 +7,7 @@ extern "C"
#endif /* __cplusplus */
/*
- * $Id: s_audio_pablio.h,v 1.1 2004-09-06 20:20:35 millerpuckette Exp $
+ * $Id: s_audio_pablio.h,v 1.2 2006-06-03 19:13:07 millerpuckette Exp $
* PABLIO.h
* Portable Audio Blocking read/write utility.
*
@@ -46,13 +46,13 @@ extern "C"
#include <stdlib.h>
#include <math.h>
#include "portaudio.h"
-#include "ringbuffer.h"
+#include "s_audio_paring.h"
#include <string.h>
typedef struct
{
- RingBuffer inFIFO;
- RingBuffer outFIFO;
+ sys_ringbuf inFIFO;
+ sys_ringbuf outFIFO;
PaStream *stream;
int inbytesPerFrame;
int insamplesPerFrame;
diff --git a/pd/src/s_audio_paring.c b/pd/src/s_audio_paring.c
index cbb999e8..ca1a60a5 100644
--- a/pd/src/s_audio_paring.c
+++ b/pd/src/s_audio_paring.c
@@ -1,5 +1,5 @@
/*
- * $Id: s_audio_paring.c,v 1.1 2004-09-06 20:20:35 millerpuckette Exp $
+ * $Id: s_audio_paring.c,v 1.2 2006-06-03 19:13:07 millerpuckette Exp $
* ringbuffer.c
* Ring Buffer utility..
*
@@ -47,35 +47,35 @@
/***************************************************************************
* Initialize FIFO.
*/
-long RingBuffer_Init( RingBuffer *rbuf, long numBytes, void *dataPtr )
+long sys_ringbuf_Init( sys_ringbuf *rbuf, long numBytes, void *dataPtr )
{
rbuf->bufferSize = numBytes;
rbuf->buffer = (char *)dataPtr;
- RingBuffer_Flush( rbuf );
+ sys_ringbuf_Flush( rbuf );
return 0;
}
/***************************************************************************
** Return number of bytes available for reading. */
-long RingBuffer_GetReadAvailable( RingBuffer *rbuf )
+long sys_ringbuf_GetReadAvailable( sys_ringbuf *rbuf )
{
long ret = rbuf->writeIndex - rbuf->readIndex;
if (ret < 0)
ret += 2 * rbuf->bufferSize;
if (ret < 0 || ret > rbuf->bufferSize)
fprintf(stderr,
- "consistency check failed: RingBuffer_GetReadAvailable\n");
+ "consistency check failed: sys_ringbuf_GetReadAvailable\n");
return ( ret );
}
/***************************************************************************
** Return number of bytes available for writing. */
-long RingBuffer_GetWriteAvailable( RingBuffer *rbuf )
+long sys_ringbuf_GetWriteAvailable( sys_ringbuf *rbuf )
{
- return ( rbuf->bufferSize - RingBuffer_GetReadAvailable(rbuf));
+ return ( rbuf->bufferSize - sys_ringbuf_GetReadAvailable(rbuf));
}
/***************************************************************************
** Clear buffer. Should only be called when buffer is NOT being read. */
-void RingBuffer_Flush( RingBuffer *rbuf )
+void sys_ringbuf_Flush( sys_ringbuf *rbuf )
{
rbuf->writeIndex = rbuf->readIndex = 0;
}
@@ -86,12 +86,12 @@ void RingBuffer_Flush( RingBuffer *rbuf )
** If non-contiguous, size2 will be the size of second region.
** Returns room available to be written or numBytes, whichever is smaller.
*/
-long RingBuffer_GetWriteRegions( RingBuffer *rbuf, long numBytes,
+long sys_ringbuf_GetWriteRegions( sys_ringbuf *rbuf, long numBytes,
void **dataPtr1, long *sizePtr1,
void **dataPtr2, long *sizePtr2 )
{
long index;
- long available = RingBuffer_GetWriteAvailable( rbuf );
+ long available = sys_ringbuf_GetWriteAvailable( rbuf );
if( numBytes > available ) numBytes = available;
/* Check to see if write is not contiguous. */
index = rbuf->writeIndex;
@@ -119,7 +119,7 @@ long RingBuffer_GetWriteRegions( RingBuffer *rbuf, long numBytes,
/***************************************************************************
*/
-long RingBuffer_AdvanceWriteIndex( RingBuffer *rbuf, long numBytes )
+long sys_ringbuf_AdvanceWriteIndex( sys_ringbuf *rbuf, long numBytes )
{
long ret = (rbuf->writeIndex + numBytes);
if ( ret >= 2 * rbuf->bufferSize)
@@ -133,12 +133,12 @@ long RingBuffer_AdvanceWriteIndex( RingBuffer *rbuf, long numBytes )
** If non-contiguous, size2 will be the size of second region.
** Returns room available to be written or numBytes, whichever is smaller.
*/
-long RingBuffer_GetReadRegions( RingBuffer *rbuf, long numBytes,
+long sys_ringbuf_GetReadRegions( sys_ringbuf *rbuf, long numBytes,
void **dataPtr1, long *sizePtr1,
void **dataPtr2, long *sizePtr2 )
{
long index;
- long available = RingBuffer_GetReadAvailable( rbuf );
+ long available = sys_ringbuf_GetReadAvailable( rbuf );
if( numBytes > available ) numBytes = available;
/* Check to see if read is not contiguous. */
index = rbuf->readIndex;
@@ -165,7 +165,7 @@ long RingBuffer_GetReadRegions( RingBuffer *rbuf, long numBytes,
}
/***************************************************************************
*/
-long RingBuffer_AdvanceReadIndex( RingBuffer *rbuf, long numBytes )
+long sys_ringbuf_AdvanceReadIndex( sys_ringbuf *rbuf, long numBytes )
{
long ret = (rbuf->readIndex + numBytes);
if( ret >= 2 * rbuf->bufferSize)
@@ -175,11 +175,11 @@ long RingBuffer_AdvanceReadIndex( RingBuffer *rbuf, long numBytes )
/***************************************************************************
** Return bytes written. */
-long RingBuffer_Write( RingBuffer *rbuf, const void *data, long numBytes )
+long sys_ringbuf_Write( sys_ringbuf *rbuf, const void *data, long numBytes )
{
long size1, size2, numWritten;
void *data1, *data2;
- numWritten = RingBuffer_GetWriteRegions( rbuf, numBytes, &data1, &size1, &data2, &size2 );
+ numWritten = sys_ringbuf_GetWriteRegions( rbuf, numBytes, &data1, &size1, &data2, &size2 );
if( size2 > 0 )
{
@@ -191,17 +191,17 @@ long RingBuffer_Write( RingBuffer *rbuf, const void *data, long numBytes )
{
memcpy( data1, data, size1 );
}
- RingBuffer_AdvanceWriteIndex( rbuf, numWritten );
+ sys_ringbuf_AdvanceWriteIndex( rbuf, numWritten );
return numWritten;
}
/***************************************************************************
** Return bytes read. */
-long RingBuffer_Read( RingBuffer *rbuf, void *data, long numBytes )
+long sys_ringbuf_Read( sys_ringbuf *rbuf, void *data, long numBytes )
{
long size1, size2, numRead;
void *data1, *data2;
- numRead = RingBuffer_GetReadRegions( rbuf, numBytes, &data1, &size1, &data2, &size2 );
+ numRead = sys_ringbuf_GetReadRegions( rbuf, numBytes, &data1, &size1, &data2, &size2 );
if( size2 > 0 )
{
memcpy( data, data1, size1 );
@@ -212,6 +212,6 @@ long RingBuffer_Read( RingBuffer *rbuf, void *data, long numBytes )
{
memcpy( data, data1, size1 );
}
- RingBuffer_AdvanceReadIndex( rbuf, numRead );
+ sys_ringbuf_AdvanceReadIndex( rbuf, numRead );
return numRead;
}
diff --git a/pd/src/s_audio_paring.h b/pd/src/s_audio_paring.h
index 9eca10b1..27edb01f 100644
--- a/pd/src/s_audio_paring.h
+++ b/pd/src/s_audio_paring.h
@@ -6,7 +6,7 @@ extern "C"
#endif /* __cplusplus */
/*
- * $Id: s_audio_paring.h,v 1.1 2004-09-06 20:20:35 millerpuckette Exp $
+ * $Id: s_audio_paring.h,v 1.2 2006-06-03 19:13:07 millerpuckette Exp $
* ringbuffer.h
* Ring Buffer utility..
*
@@ -43,58 +43,58 @@ extern "C"
#include <stdio.h>
#include <stdlib.h>
#include <math.h>
-#include "ringbuffer.h"
+#include "s_audio_paring.h"
#include <string.h>
typedef struct
{
- long bufferSize; /* Number of bytes in FIFO. Power of 2. Set by RingBuffer_Init. */
+ long bufferSize; /* Number of bytes in FIFO. Power of 2. Set by sys_ringbuf_Init. */
/* These are declared volatile because they are written by a different thread than the reader. */
- volatile long writeIndex; /* Index of next writable byte. Set by RingBuffer_AdvanceWriteIndex. */
- volatile long readIndex; /* Index of next readable byte. Set by RingBuffer_AdvanceReadIndex. */
+ volatile long writeIndex; /* Index of next writable byte. Set by sys_ringbuf_AdvanceWriteIndex. */
+ volatile long readIndex; /* Index of next readable byte. Set by sys_ringbuf_AdvanceReadIndex. */
long bigMask; /* Used for wrapping indices with extra bit to distinguish full/empty. */
long smallMask; /* Used for fitting indices to buffer. */
char *buffer;
}
-RingBuffer;
+sys_ringbuf;
/*
* Initialize Ring Buffer.
* numBytes must be power of 2, returns -1 if not.
*/
-long RingBuffer_Init( RingBuffer *rbuf, long numBytes, void *dataPtr );
+long sys_ringbuf_Init( sys_ringbuf *rbuf, long numBytes, void *dataPtr );
/* Clear buffer. Should only be called when buffer is NOT being read. */
-void RingBuffer_Flush( RingBuffer *rbuf );
+void sys_ringbuf_Flush( sys_ringbuf *rbuf );
/* Return number of bytes available for writing. */
-long RingBuffer_GetWriteAvailable( RingBuffer *rbuf );
+long sys_ringbuf_GetWriteAvailable( sys_ringbuf *rbuf );
/* Return number of bytes available for read. */
-long RingBuffer_GetReadAvailable( RingBuffer *rbuf );
+long sys_ringbuf_GetReadAvailable( sys_ringbuf *rbuf );
/* Return bytes written. */
-long RingBuffer_Write( RingBuffer *rbuf, const void *data, long numBytes );
+long sys_ringbuf_Write( sys_ringbuf *rbuf, const void *data, long numBytes );
/* Return bytes read. */
-long RingBuffer_Read( RingBuffer *rbuf, void *data, long numBytes );
+long sys_ringbuf_Read( sys_ringbuf *rbuf, void *data, long numBytes );
/* Get address of region(s) to which we can write data.
** If the region is contiguous, size2 will be zero.
** If non-contiguous, size2 will be the size of second region.
** Returns room available to be written or numBytes, whichever is smaller.
*/
-long RingBuffer_GetWriteRegions( RingBuffer *rbuf, long numBytes,
+long sys_ringbuf_GetWriteRegions( sys_ringbuf *rbuf, long numBytes,
void **dataPtr1, long *sizePtr1,
void **dataPtr2, long *sizePtr2 );
-long RingBuffer_AdvanceWriteIndex( RingBuffer *rbuf, long numBytes );
+long sys_ringbuf_AdvanceWriteIndex( sys_ringbuf *rbuf, long numBytes );
/* Get address of region(s) from which we can read data.
** If the region is contiguous, size2 will be zero.
** If non-contiguous, size2 will be the size of second region.
** Returns room available to be read or numBytes, whichever is smaller.
*/
-long RingBuffer_GetReadRegions( RingBuffer *rbuf, long numBytes,
+long sys_ringbuf_GetReadRegions( sys_ringbuf *rbuf, long numBytes,
void **dataPtr1, long *sizePtr1,
void **dataPtr2, long *sizePtr2 );
-long RingBuffer_AdvanceReadIndex( RingBuffer *rbuf, long numBytes );
+long sys_ringbuf_AdvanceReadIndex( sys_ringbuf *rbuf, long numBytes );
#ifdef __cplusplus
}
diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c
index 90623df6..520ae882 100644
--- a/pd/src/s_inter.c
+++ b/pd/src/s_inter.c
@@ -788,6 +788,8 @@ void sys_queuegui(void *client, t_glist *glist, t_guicallbackfn f)
for (gq = sys_guiqueuehead; gq->gq_next; gq = gq->gq_next)
if (gq->gq_client == client)
return;
+ if (gq->gq_client == client)
+ return;
gqnextptr = &gq->gq_next;
}
gq = t_getbytes(sizeof(*gq));
diff --git a/pd/src/s_loader.c b/pd/src/s_loader.c
index 89646a48..d985af05 100644
--- a/pd/src/s_loader.c
+++ b/pd/src/s_loader.c
@@ -38,8 +38,12 @@ static char sys_dllextent[] =
".pd_linux";
#endif
#ifdef MACOSX
+#ifdef __i386
+ ".pd_imac";
+#else
".pd_darwin";
#endif
+#endif
#ifdef MSW
".dll";
#endif
@@ -73,30 +77,30 @@ static int sys_load_lib_alt(char *dirname, char *classname, char *altname)
if ((fd = open_via_path(dirname, classname2, sys_dllextent,
dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
{
- /* next try (alternative_classname).(sys_dllextent) */
- if(altname)
+ /* next try (alternative_classname).(sys_dllextent) */
+ if (altname)
{
- if ((fd = open_via_path(dirname, altname, sys_dllextent,
- dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
-
- /* next try (alternative_classname)/(alternative_classname).(sys_dllextent) ... */
- strncpy(classname2, altname, MAXPDSTRING);
- filename[MAXPDSTRING-2] = 0;
- strcat(classname2, "/");
- strncat(classname2, altname, MAXPDSTRING-strlen(classname2));
- filename[MAXPDSTRING-1] = 0;
- if ((fd = open_via_path(dirname, classname2, sys_dllextent,
- dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
+ if ((fd = open_via_path(dirname, altname, sys_dllextent,
+ dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
{
- return 0;
- }
+ /* next try
+ (alt_classname)/(alt_classname).(sys_dllextent) */
+ strncpy(classname2, altname, MAXPDSTRING);
+ filename[MAXPDSTRING-2] = 0;
+ strcat(classname2, "/");
+ strncat(classname2, altname,
+ MAXPDSTRING-strlen(classname2));
+ filename[MAXPDSTRING-1] = 0;
+ if ((fd = open_via_path(dirname, classname2,
+ sys_dllextent, dirbuf, &nameptr, MAXPDSTRING, 1)) < 0)
+ {
+ return 0;
+ }
+ }
}
- else
- return (0);
+ else return (0);
}
}
-
-
close(fd);
class_set_extern_dir(gensym(dirbuf));
@@ -110,7 +114,7 @@ static int sys_load_lib_alt(char *dirname, char *classname, char *altname)
if (lastdot = strrchr(nameptr, '.'))
*lastdot = 0;
-#ifdef MACOSX
+#ifdef DIDFORMACOSX /* no longer correct on macosx??? */
strcpy(symname, "_");
strcat(symname, nameptr);
if(altname)
@@ -134,6 +138,7 @@ static int sys_load_lib_alt(char *dirname, char *classname, char *altname)
strcat(symname, "_setup");
#ifdef DL_OPEN
dlobj = dlopen(filename, RTLD_NOW | RTLD_GLOBAL);
+ post("opened %x", dlobj);
if (!dlobj)
{
post("%s: %s", filename, dlerror());
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index 98301ac8..a8baa8c4 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -103,7 +103,7 @@ typedef struct _fontinfo
in the six fonts. */
static t_fontinfo sys_fontlist[] = {
- {8, 5, 9, 0, 0, 0}, {10, 7, 13, 0, 0, 0}, {12, 9, 16, 0, 0, 0},
+ {8, 6, 10, 0, 0, 0}, {10, 7, 13, 0, 0, 0}, {12, 9, 16, 0, 0, 0},
{16, 10, 20, 0, 0, 0}, {24, 15, 25, 0, 0, 0}, {36, 25, 45, 0, 0, 0}};
#define NFONT (sizeof(sys_fontlist)/sizeof(*sys_fontlist))
@@ -175,8 +175,6 @@ static void openit(const char *dirname, const char *filename)
error("%s: can't open", filename);
}
-#define NHOSTFONT 7
-
/* this is called from the gui process. The first argument is the cwd, and
succeeding args give the widths and heights of known fonts. We wait until
these are known to open files and send messages specified on the command line.
@@ -189,25 +187,33 @@ void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv)
{
char *cwd = atom_getsymbolarg(0, argc, argv)->s_name;
t_namelist *nl;
- unsigned int i, j;
- if (argc != 2 + 3 * NHOSTFONT) bug("glob_initfromgui");
+ unsigned int i;
+ int j;
+ int nhostfont = (argc-2)/3;
+ sys_oldtclversion = atom_getfloatarg(1, argc, argv);
+ if (argc != 2 + 3 * nhostfont) bug("glob_initfromgui");
for (i = 0; i < NFONT; i++)
{
+ int best = 0;
int wantheight = sys_fontlist[i].fi_maxheight;
- for (j = 0; j < NHOSTFONT-1; j++)
- {
- if (atom_getintarg(3 * (j + 1) + 3, argc, argv) > wantheight)
- break;
- }
- /* j is now the "real" font index for the desired font index i. */
- sys_fontlist[i].fi_hostfontsize = atom_getintarg(3 * j + 1, argc, argv);
- sys_fontlist[i].fi_width = atom_getintarg(3 * j + 2, argc, argv);
- sys_fontlist[i].fi_height = atom_getintarg(3 * j + 3, argc, argv);
+ int wantwidth = sys_fontlist[i].fi_maxwidth;
+ for (j = 1; j < nhostfont; j++)
+ {
+ if (atom_getintarg(3 * j + 4, argc, argv) <= wantheight &&
+ atom_getintarg(3 * j + 3, argc, argv) <= wantwidth)
+ best = j;
+ }
+ /* best is now the host font index for the desired font index i. */
+ sys_fontlist[i].fi_hostfontsize =
+ atom_getintarg(3 * best + 2, argc, argv);
+ sys_fontlist[i].fi_width = atom_getintarg(3 * best + 3, argc, argv);
+ sys_fontlist[i].fi_height = atom_getintarg(3 * best + 4, argc, argv);
}
#if 0
for (i = 0; i < 6; i++)
- fprintf(stderr, "font %d %d %d %d %d\n",
+ fprintf(stderr, "font (%d %d %d) -> (%d %d %d)\n",
sys_fontlist[i].fi_fontsize,
+ sys_fontlist[i].fi_maxwidth,
sys_fontlist[i].fi_maxheight,
sys_fontlist[i].fi_hostfontsize,
sys_fontlist[i].fi_width,
@@ -232,7 +238,6 @@ void glob_initfromgui(void *dummy, t_symbol *s, int argc, t_atom *argv)
}
namelist_free(sys_messagelist);
sys_messagelist = 0;
- sys_oldtclversion = atom_getfloatarg(1 + 3 * NHOSTFONT, argc, argv);
}
static void sys_afterargparse(void);
@@ -517,7 +522,7 @@ int sys_argparse(int argc, char **argv)
argc -= 2;
argv += 2;
}
- else if (!strcmp(*argv, "-inchannels"))
+ else if (!strcmp(*argv, "-inchannels") && (argc > 1))
{
sys_parsedevlist(&sys_nchin,
sys_chinlist, MAXAUDIOINDEV, argv[1]);
@@ -527,7 +532,7 @@ int sys_argparse(int argc, char **argv)
argc -= 2; argv += 2;
}
- else if (!strcmp(*argv, "-outchannels"))
+ else if (!strcmp(*argv, "-outchannels") && (argc > 1))
{
sys_parsedevlist(&sys_nchout, sys_choutlist,
MAXAUDIOOUTDEV, argv[1]);
@@ -537,7 +542,7 @@ int sys_argparse(int argc, char **argv)
argc -= 2; argv += 2;
}
- else if (!strcmp(*argv, "-channels"))
+ else if (!strcmp(*argv, "-channels") && (argc > 1))
{
sys_parsedevlist(&sys_nchin, sys_chinlist,MAXAUDIOINDEV,
argv[1]);
@@ -549,7 +554,7 @@ int sys_argparse(int argc, char **argv)
argc -= 2; argv += 2;
}
- else if (!strcmp(*argv, "-soundbuf") || !strcmp(*argv, "-audiobuf"))
+ else if (!strcmp(*argv, "-soundbuf") || !strcmp(*argv, "-audiobuf") && (argc > 1))
{
sys_main_advance = atoi(argv[1]);
argc -= 2; argv += 2;
@@ -559,7 +564,7 @@ int sys_argparse(int argc, char **argv)
sys_setblocksize(atoi(argv[1]));
argc -= 2; argv += 2;
}
- else if (!strcmp(*argv, "-sleepgrain"))
+ else if (!strcmp(*argv, "-sleepgrain") && (argc > 1))
{
sys_sleepgrain = 1000 * atoi(argv[1]);
argc -= 2; argv += 2;
@@ -601,7 +606,7 @@ int sys_argparse(int argc, char **argv)
sys_set_audio_api(API_ALSA);
argc--; argv++;
}
- else if (!strcmp(*argv, "-alsaadd"))
+ else if (!strcmp(*argv, "-alsaadd") && (argc > 1))
{
if (argc > 1)
alsa_adddev(argv[1]);
@@ -664,7 +669,7 @@ int sys_argparse(int argc, char **argv)
goto usage;
argc -= 2; argv += 2;
}
- else if (!strcmp(*argv, "-midioutdev"))
+ else if (!strcmp(*argv, "-midioutdev") && (argc > 1))
{
sys_parsedevlist(&sys_nmidiout, sys_midioutdevlist, MAXMIDIOUTDEV,
argv[1]);
@@ -672,7 +677,7 @@ int sys_argparse(int argc, char **argv)
goto usage;
argc -= 2; argv += 2;
}
- else if (!strcmp(*argv, "-mididev"))
+ else if (!strcmp(*argv, "-mididev") && (argc > 1))
{
sys_parsedevlist(&sys_nmidiin, sys_midiindevlist, MAXMIDIINDEV,
argv[1]);
@@ -682,7 +687,7 @@ int sys_argparse(int argc, char **argv)
goto usage;
argc -= 2; argv += 2;
}
- else if (!strcmp(*argv, "-path"))
+ else if (!strcmp(*argv, "-path") && (argc > 1))
{
sys_searchpath = namelist_append_files(sys_searchpath, argv[1]);
argc -= 2; argv += 2;
@@ -822,7 +827,8 @@ int sys_argparse(int argc, char **argv)
goto usage;
argc -= 2; argv += 2;
}
- else if (!strcmp(*argv, "-sounddev") || !strcmp(*argv, "-audiodev"))
+ else if ((!strcmp(*argv, "-sounddev") || !strcmp(*argv, "-audiodev"))
+ && (argc > 1))
{
sys_parsedevlist(&sys_nsoundin, sys_soundindevlist,
MAXAUDIOINDEV, argv[1]);
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index 82544ac4..62ddf836 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -89,6 +89,8 @@ if {$pd_nt == 0} {
}
}
+set pd_deffont {courier 12 bold}
+
set help_top_directory $pd_guidir/doc
# it's unfortunate but we seem to have to turn off global bindings
@@ -354,7 +356,6 @@ proc menu_opentext {filename} {
global doc_number
global pd_guidir
global pd_myversion
-# global pd_font3
set name [format ".help%d" $doc_number]
toplevel $name
text $name.text -relief raised -bd 2 -font -*-times-regular--normal--14-* \
@@ -573,7 +574,7 @@ proc menu_print {name} {
-filetypes { {{postscript} {.ps}} }]
if {$filename != ""} {
- $name.c postscript -file $filename
+ $name.c postscript -file $filename
}
}
@@ -1229,10 +1230,15 @@ proc pdtk_array_listview_fillpage {arrayName} {
global pd_array_listview_page
global pd_array_listview_id
set windowName [format ".%sArrayWindow" $arrayName]
+ set topItem [expr [lindex [$windowName.lb yview] 0] * \
+ [$windowName.lb size]]
+
if {[winfo exists $windowName]} {
set cmd "$pd_array_listview_id($arrayName) \
arrayviewlistfillpage \
- $pd_array_listview_page($arrayName)"
+ $pd_array_listview_page($arrayName) \
+ $topItem"
+
pd [concat $cmd \;]
}
}
@@ -1260,7 +1266,7 @@ proc pdtk_array_listview_new {id arrayName page} {
set $windowName.lb.sb [scrollbar $windowName.lb.sb \
-command "$windowName.lb yview" -orient vertical]
place configure $windowName.lb.sb -relheight 1 -relx 0.9 -relwidth 0.1
- pack $windowName.lb
+ pack $windowName.lb -expand 1 -fill both
bind $windowName.lb <Double-ButtonPress-1> \
"pdtk_array_listview_edit $arrayName $page $font"
# handle copy/paste
@@ -1277,8 +1283,8 @@ proc pdtk_array_listview_new {id arrayName page} {
-command "pdtk_array_listview_changepage $arrayName -1"]
set $windowName.nextBtn [button $windowName.nextBtn -text "->" \
-command "pdtk_array_listview_changepage $arrayName 1"]
- pack $windowName.prevBtn -side left -ipadx 20 -pady 10
- pack $windowName.nextBtn -side right -ipadx 20 -pady 10
+ pack $windowName.prevBtn -side left -ipadx 20 -pady 10 -anchor s
+ pack $windowName.nextBtn -side right -ipadx 20 -pady 10 -anchor s
focus $windowName
}
@@ -3144,7 +3150,7 @@ proc dodata_ok {name} {
}
proc pdtk_data_dialog {name stuff} {
- global pd_font3
+ global pd_deffont
toplevel $name
wm title $name {Atom}
wm protocol $name WM_DELETE_WINDOW [concat dodata_cancel $name]
@@ -3159,7 +3165,7 @@ proc pdtk_data_dialog {name stuff} {
pack $name.buttonframe.ok -side left -expand 1
text $name.text -relief raised -bd 2 -height 40 -width 60 \
- -yscrollcommand "$name.scroll set" -font $pd_font3
+ -yscrollcommand "$name.scroll set" -font $pd_deffont
scrollbar $name.scroll -command "$name.text yview"
pack $name.scroll -side right -fill y
pack $name.text -side left -fill both -expand 1
@@ -3185,15 +3191,18 @@ proc pdtk_text_new {canvasname myname x y text font color} {
# if {$font < 13} {set fontname [format -*-courier-bold----%d-* $font]}
# if {$font >= 13} {set fontname [format -*-courier-----%d-* $font]}
- global pd_font1 pd_font2 pd_font3 pd_font4 pd_font5 pd_font6 pd_font7
+ global pd_fontlist
switch -- $font {
- 8 { set typeface $pd_font1 }
- 10 { set typeface $pd_font2 }
- 12 { set typeface $pd_font3 }
- 14 { set typeface $pd_font4 }
- 16 { set typeface $pd_font5 }
- 24 { set typeface $pd_font6 }
- 36 { set typeface $pd_font7 }
+ 8 { set typeface [lindex $pd_fontlist 0] }
+ 9 { set typeface [lindex $pd_fontlist 1] }
+ 10 { set typeface [lindex $pd_fontlist 2] }
+ 12 { set typeface [lindex $pd_fontlist 3] }
+ 14 { set typeface [lindex $pd_fontlist 4] }
+ 16 { set typeface [lindex $pd_fontlist 5] }
+ 18 { set typeface [lindex $pd_fontlist 6] }
+ 24 { set typeface [lindex $pd_fontlist 7] }
+ 30 { set typeface [lindex $pd_fontlist 8] }
+ 36 { set typeface [lindex $pd_fontlist 9] }
}
$canvasname create text $x $y \
@@ -3226,7 +3235,7 @@ proc pdtk_pd_ctrlkey {name key shift} {
######### startup function. ##############
# Tell pd the current directory; this is used in case the command line
# asked pd to open something. Also, get character width and height for
-# font sizes 8, 10, 12, 14, 16, and 24.
+# seven "useful" font sizes.
# tb: user defined typefaces
proc pdtk_pd_startup {version apilist midiapilist fontname} {
@@ -3235,49 +3244,29 @@ proc pdtk_pd_startup {version apilist midiapilist fontname} {
set pd_myversion $version
set pd_apilist $apilist
set pd_midiapilist $midiapilist
- global pd_font1 pd_font2 pd_font3 pd_font4 pd_font5 pd_font6 pd_font7
-
- set pd_font1 [format -*-%s-bold--normal--8-* $fontname]
- set pd_font2 [format -*-%s-bold--normal--10-* $fontname]
- set pd_font3 [format -*-%s-bold--normal--12-* $fontname]
- set pd_font4 [format -*-%s-bold--normal--14-* $fontname]
- set pd_font5 [format -*-%s-bold--normal--16-* $fontname]
- set pd_font6 [format -*-%s-bold--normal--24-* $fontname]
- set pd_font7 [format -*-%s-bold--normal--36-* $fontname]
-
- set width1 [font measure $pd_font1 x]
- set height1 [lindex [font metrics $pd_font1] 5]
- set width2 [font measure $pd_font2 x]
- set height2 [lindex [font metrics $pd_font2] 5]
- set width3 [font measure $pd_font3 x]
- set height3 [lindex [font metrics $pd_font3] 5]
- set width4 [font measure $pd_font4 x]
- set height4 [lindex [font metrics $pd_font4] 5]
- set width5 [font measure $pd_font5 x]
- set height5 [lindex [font metrics $pd_font5] 5]
- set width6 [font measure $pd_font6 x]
- set height6 [lindex [font metrics $pd_font6] 5]
- set width7 [font measure $pd_font7 x]
- set height7 [lindex [font metrics $pd_font7] 5]
+ global pd_fontlist
+ set pd_fontlist {}
+
+ set fontlist ""
+ foreach i {8 9 10 12 14 16 18 24 30 36} {
+ set font [concat $fontname -$i bold]
+ set pd_fontlist [linsert $pd_fontlist 100000 $font]
+ set width0 [font measure $font x]
+ set height0 [lindex [font metrics $font] 5]
+ set fontlist [concat $fontlist $i [font measure $font x] \
+ [lindex [font metrics $font] 5]]
+ }
set tclpatch [info patchlevel]
if {$tclpatch == "8.3.0" || \
- $tclpatch == "8.3.1" || \
- $tclpatch == "8.3.2" || \
- $tclpatch == "8.3.3" } {
- set oldtclversion 1
+ $tclpatch == "8.3.1" || \
+ $tclpatch == "8.3.2" || \
+ $tclpatch == "8.3.3" } {
+ set oldtclversion 1
} else {
- set oldtclversion 0
+ set oldtclversion 0
}
- pd [concat pd init [pdtk_enquote [pwd]] \
- 8 $width1 $height1 \
- 10 $width2 $height2 \
- 12 $width3 $height3 \
- 14 $width4 $height4 \
- 16 $width5 $height5 \
- 24 $width6 $height6 \
- 36 $width7 $height7 \
- $oldtclversion \;];
+ pd [concat pd init [pdtk_enquote [pwd]] $oldtclversion $fontlist \;];
# add the audio and help menus to the Pd window. We delayed this
# so that we'd know the value of "apilist".
@@ -3352,7 +3341,7 @@ proc texteditor_ok {name} {
proc pdtk_pd_texteditor {stuff} {
- global edit_number pd_font3
+ global edit_number pd_deffont
set name [format ".text%d" $edit_number]
set edit_number [expr $edit_number + 1]
@@ -3369,7 +3358,7 @@ proc pdtk_pd_texteditor {stuff} {
pack $name.buttons.ok -side left -expand 1
text $name.text -relief raised -bd 2 -height 12 -width 60 \
- -yscrollcommand "$name.scroll set" -font $pd_font3
+ -yscrollcommand "$name.scroll set" -font $pd_deffont
scrollbar $name.scroll -command "$name.text yview"
pack $name.scroll -side right -fill y
pack $name.text -side left -fill both -expand 1
@@ -3394,23 +3383,26 @@ proc pdtk_pastetext {} {
############# open and save dialogs for objects in Pd ##########
-proc pdtk_openpanel {target} {
+proc pdtk_openpanel {target localdir} {
global pd_opendir
+ if {$localdir == ""} {
+ set localdir $pd_opendir
+ }
set filename [tk_getOpenFile \
- -initialdir $pd_opendir]
+ -initialdir $localdir]
if {$filename != ""} {
set directory [string range $filename 0 \
[expr [string last / $filename ] - 1]]
set pd_opendir $directory
- pd [concat $target symbol [pdtk_enquote $filename] \;]
+ pd [concat $target callback [pdtk_enquote $filename] \;]
}
}
-proc pdtk_savepanel {target} {
- set filename [tk_getSaveFile]
+proc pdtk_savepanel {target localdir} {
+ set filename [tk_getSaveFile -initialdir $localdir]
if {$filename != ""} {
- pd [concat $target symbol [pdtk_enquote $filename] \;]
+ pd [concat $target callback [pdtk_enquote $filename] \;]
}
}
diff --git a/pd/src/x_gui.c b/pd/src/x_gui.c
index d2d47ae1..bcc6ec8b 100644
--- a/pd/src/x_gui.c
+++ b/pd/src/x_gui.c
@@ -182,7 +182,7 @@ typedef struct _openpanel
t_symbol *x_s;
} t_openpanel;
-static void *openpanel_new(void)
+static void *openpanel_new( void)
{
char buf[50];
t_openpanel *x = (t_openpanel *)pd_new(openpanel_class);
@@ -193,16 +193,23 @@ static void *openpanel_new(void)
return (x);
}
+static void openpanel_symbol(t_openpanel *x, t_symbol *s)
+{
+ char *path = (s && s->s_name) ? s->s_name : "\"\"";
+ sys_vgui("pdtk_openpanel {%s} {%s}\n", x->x_s->s_name, path);
+}
+
static void openpanel_bang(t_openpanel *x)
{
- sys_vgui("pdtk_openpanel %s\n", x->x_s->s_name);
+ openpanel_symbol(x, &s_);
}
-static void openpanel_symbol(t_openpanel *x, t_symbol *s)
+static void openpanel_callback(t_openpanel *x, t_symbol *s)
{
outlet_symbol(x->x_obj.ob_outlet, s);
}
+
static void openpanel_free(t_openpanel *x)
{
pd_unbind(&x->x_obj.ob_pd, x->x_s);
@@ -212,9 +219,11 @@ static void openpanel_setup(void)
{
openpanel_class = class_new(gensym("openpanel"),
(t_newmethod)openpanel_new, (t_method)openpanel_free,
- sizeof(t_openpanel), 0, A_DEFFLOAT, 0);
+ sizeof(t_openpanel), 0, 0);
class_addbang(openpanel_class, openpanel_bang);
class_addsymbol(openpanel_class, openpanel_symbol);
+ class_addmethod(openpanel_class, (t_method)openpanel_callback,
+ gensym("callback"), A_SYMBOL, 0);
}
/* -------------------------- savepanel ------------------------------ */
@@ -227,7 +236,7 @@ typedef struct _savepanel
t_symbol *x_s;
} t_savepanel;
-static void *savepanel_new(void)
+static void *savepanel_new( void)
{
char buf[50];
t_savepanel *x = (t_savepanel *)pd_new(savepanel_class);
@@ -238,12 +247,18 @@ static void *savepanel_new(void)
return (x);
}
+static void savepanel_symbol(t_savepanel *x, t_symbol *s)
+{
+ char *path = (s && s->s_name) ? s->s_name : "\"\"";
+ sys_vgui("pdtk_savepanel {%s} {%s}\n", x->x_s->s_name, path);
+}
+
static void savepanel_bang(t_savepanel *x)
{
- sys_vgui("pdtk_savepanel %s\n", x->x_s->s_name);
+ savepanel_symbol(x, &s_);
}
-static void savepanel_symbol(t_savepanel *x, t_symbol *s)
+static void savepanel_callback(t_savepanel *x, t_symbol *s)
{
outlet_symbol(x->x_obj.ob_outlet, s);
}
@@ -257,9 +272,11 @@ static void savepanel_setup(void)
{
savepanel_class = class_new(gensym("savepanel"),
(t_newmethod)savepanel_new, (t_method)savepanel_free,
- sizeof(t_savepanel), 0, A_DEFFLOAT, 0);
+ sizeof(t_savepanel), 0, 0);
class_addbang(savepanel_class, savepanel_bang);
class_addsymbol(savepanel_class, savepanel_symbol);
+ class_addmethod(savepanel_class, (t_method)savepanel_callback,
+ gensym("callback"), A_SYMBOL, 0);
}
/* ---------------------- key and its relatives ------------------ */