aboutsummaryrefslogtreecommitdiff
path: root/pd/src
diff options
context:
space:
mode:
authorMiller Puckette <millerpuckette@users.sourceforge.net>2007-07-20 03:25:21 +0000
committerMiller Puckette <millerpuckette@users.sourceforge.net>2007-07-20 03:25:21 +0000
commit1e45c6bafc8419930958103cc1651ff86cf5d84d (patch)
tree260d94049e3302f7fc833abd7a8d3479f0631e49 /pd/src
parentdaa1933fed59113296b8e044fc370587b068aea9 (diff)
various bug fixes.
svn path=/trunk/; revision=8186
Diffstat (limited to 'pd/src')
-rw-r--r--pd/src/configure.in65
-rw-r--r--pd/src/d_math.c13
-rw-r--r--pd/src/d_soundfile.c17
-rw-r--r--pd/src/g_array.c2
-rw-r--r--pd/src/g_canvas.c8
-rw-r--r--pd/src/g_rtext.c5
-rw-r--r--pd/src/g_scalar.c59
-rw-r--r--pd/src/g_template.c20
-rw-r--r--pd/src/m_binbuf.c2
-rw-r--r--pd/src/m_sched.c2
-rw-r--r--pd/src/makefile.in13
-rw-r--r--pd/src/makefile.nt2
-rw-r--r--pd/src/notes.txt11
-rw-r--r--pd/src/s_audio_alsa.c20
-rw-r--r--pd/src/s_entry.c10
-rw-r--r--pd/src/s_inter.c11
-rw-r--r--pd/src/s_main.c9
-rw-r--r--pd/src/s_path.c7
-rw-r--r--pd/src/u_main.tk10
-rw-r--r--pd/src/x_list.c98
20 files changed, 284 insertions, 100 deletions
diff --git a/pd/src/configure.in b/pd/src/configure.in
index a94c70eb..fb757526 100644
--- a/pd/src/configure.in
+++ b/pd/src/configure.in
@@ -20,6 +20,7 @@ AC_SUBST(GUINAME)
AC_SUBST(GUIFLAGS)
AC_SUBST(OSNUMBER)
AC_SUBST(EXTERNTARGET)
+AC_SUBST(ASIOSRC)
dnl other defaults
@@ -80,7 +81,10 @@ AC_CHECK_LIB(m, sin,PDLIB="$PDLIB -lm",
dnl Checking for `pthread_create' function in -pthread
AC_CHECK_LIB(pthread, pthread_create,PDLIB="$PDLIB -lpthread",
- echo "pthreads required" || exit 1)
+ AC_CHECK_LIB(pthreadGC2, pthread_create, PDLIB="$PDLIB -lpthreadGC2",
+ AC_CHECK_LIB(pthreadGC1, pthread_create, PDLIB="$PDLIB -lpthreadGC1",
+ AC_CHECK_LIB(pthreadGC, pthread_create, PDLIB="$PDLIB -lpthreadGC",
+ echo "pthreads required"; exit 1))))
dnl Check for fftw package
if test x$fftw == "xyes";
@@ -118,6 +122,11 @@ then
fi
if test $foundit == "no";
then
+ AC_CHECK_HEADER(tcl8.4/tcl.h,
+ GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.4";foundit=yes,)
+fi
+if test $foundit == "no";
+then
AC_CHECK_HEADER(tcl8.3/tcl.h,
GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.3";foundit=yes,)
fi
@@ -129,27 +138,30 @@ fi
if test $foundit == "no";
then
echo no tcl header found
- exit -1
+ echo bolding trying without...
+# exit -1
fi
-AC_CHECK_LIB(tcl8.7, main,,
- AC_CHECK_LIB(tcl8.6, main,,
+AC_CHECK_LIB(tcl85, main,,
AC_CHECK_LIB(tcl8.5, main,,
+ AC_CHECK_LIB(tcl84, main,,
AC_CHECK_LIB(tcl8.4, main,,
AC_CHECK_LIB(tcl8.3, main,,
AC_CHECK_LIB(tcl8.2, main,,
- AC_CHECK_LIB(tcl8.0, main,,echo no tcl library found || exit 1)))))))
+ AC_CHECK_LIB(tcl8.0, main,,
+ echo no tcl library found; exit 1)))))))
-AC_CHECK_LIB(tk8.7, main,,
- AC_CHECK_LIB(tk8.6, main,,
+AC_CHECK_LIB(tk85, main,,
AC_CHECK_LIB(tk8.5, main,,
+ AC_CHECK_LIB(tk84, main,,
AC_CHECK_LIB(tk8.4, main,,
AC_CHECK_LIB(tk8.3, main,,
AC_CHECK_LIB(tk8.2, main,,
- AC_CHECK_LIB(tk8.0, main,,echo no tk library found || exit 1)))))))
+ AC_CHECK_LIB(tk8.0, main,,
+ echo no tk library found; exit 1)))))))
-if test `uname -s` = Linux;
+if test `uname -s` == Linux;
then
dnl Ckecking for ALSA
echo .................... alsa= $alsa
@@ -238,7 +250,7 @@ dnl This should be fixed so Pd can use ALSA shared libraries where appropriate.
fi
-if test `uname -s` = Darwin;
+if test `uname -s` == Darwin;
then
LDFLAGS="-Wl -framework CoreAudio \
-framework AudioUnit -framework AudioToolbox \
@@ -316,6 +328,39 @@ then
fi
fi
+# only Windows uses ASIO, for the rest, set to blank
+ASIOSRC=
+
+if test `uname -s` == MINGW32_NT-5.0;
+then
+ EXT=dll
+ MORECFLAGS="-DUSEAPI_PORTAUDIO -DPA19 -DMSW -DPA_NO_DS -DPD_INTERNAL \
+ -I../portaudio/pa_common -I../portaudio/pablio \
+ -mwindows -mms-bitfields "$MORECFLAGS
+ PDLIB=$PDLIB" -lwsock32 -lwinmm -lole32 -lstdc++"
+
+ SYSSRC="s_audio_pa.c s_audio_pablio.c s_audio_paring.c \
+ s_audio_mmio.c s_midi_mmio.c \
+ ../portaudio/pa_common/pa_allocation.c \
+ ../portaudio/pa_common/pa_converters.c \
+ ../portaudio/pa_common/pa_cpuload.c \
+ ../portaudio/pa_common/pa_dither.c \
+ ../portaudio/pa_common/pa_front.c \
+ ../portaudio/pa_common/pa_process.c \
+ ../portaudio/pa_common/pa_skeleton.c \
+ ../portaudio/pa_common/pa_stream.c \
+ ../portaudio/pa_common/pa_trace.c \
+ ../portaudio/pa_win/pa_win_util.c \
+ ../portaudio/pa_win/pa_win_hostapis.c \
+ ../portaudio/pa_win_wmme/pa_win_wmme.c"
+ ASIOSRC="../portaudio/pa_asio/iasiothiscallresolver.cpp \
+ ../portaudio/pa_asio/pa_asio.cpp ../asio/asio.cpp \
+ ../asio/asiodrivers.cpp ../asio/asiolist.cpp"
+ STRIPFLAG="--strip-unneeded"
+ GUINAME="pdtcl.dll"
+ GUIFLAGS=
+fi
+
# support for jack, on either linux or darwin:
if test x$jack == "xyes";
diff --git a/pd/src/d_math.c b/pd/src/d_math.c
index e04a6738..44f23e3d 100644
--- a/pd/src/d_math.c
+++ b/pd/src/d_math.c
@@ -67,6 +67,15 @@ static void clip_setup(void)
#define DUMTAB1SIZE 256
#define DUMTAB2SIZE 1024
+#ifdef MSW
+#define int32 long
+#endif
+
+#if defined(__unix__) || defined(__APPLE__)
+#include <sys/types.h>
+#define int32 int32_t
+#endif
+
static float rsqrt_exptab[DUMTAB1SIZE], rsqrt_mantissatab[DUMTAB2SIZE];
static void init_rsqrt(void)
@@ -75,8 +84,8 @@ static void init_rsqrt(void)
for (i = 0; i < DUMTAB1SIZE; i++)
{
float f;
- long l = (i ? (i == DUMTAB1SIZE-1 ? DUMTAB1SIZE-2 : i) : 1)<< 23;
- *(long *)(&f) = l;
+ int32 l = (i ? (i == DUMTAB1SIZE-1 ? DUMTAB1SIZE-2 : i) : 1)<< 23;
+ *(int32 *)(&f) = l;
rsqrt_exptab[i] = 1./sqrt(f);
}
for (i = 0; i < DUMTAB2SIZE; i++)
diff --git a/pd/src/d_soundfile.c b/pd/src/d_soundfile.c
index 56c89e07..93578e65 100644
--- a/pd/src/d_soundfile.c
+++ b/pd/src/d_soundfile.c
@@ -30,6 +30,10 @@ objects use Posix-like threads. */
#ifdef _LARGEFILE64_SOURCE
# define open open64
# define lseek lseek64
+#define off_t __off64_t
+#endif
+#ifdef MSW
+#define off_t long
#endif
/***************** soundfile header structures ************************/
@@ -369,7 +373,8 @@ int open_soundfile_via_fd(int fd, int headersize,
}
}
/* seek past header and any sample frames to skip */
- sysrtn = lseek(fd, nchannels * bytespersamp * skipframes + headersize, 0);
+ sysrtn = lseek(fd,
+ ((off_t)nchannels) * bytespersamp * skipframes + headersize, 0);
if (sysrtn != nchannels * bytespersamp * skipframes + headersize)
return (-1);
bytelimit -= nchannels * bytespersamp * skipframes;
@@ -958,7 +963,6 @@ static t_soundfiler *soundfiler_new(void)
usage: read [flags] filename table ...
flags:
-skip <frames> ... frames to skip in file
- -nframes <frames>
-onset <frames> ... onset in table to read into (NOT DONE YET)
-raw <headersize channels bytes endian>
-resize
@@ -970,7 +974,7 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s,
{
int headersize = -1, channels = 0, bytespersamp = 0, bigendian = 0,
resize = 0, i, j;
- long skipframes = 0, nframes = 0, finalsize = 0, itemsleft,
+ long skipframes = 0, finalsize = 0, itemsleft,
maxsize = DEFMAXSIZE, itemsread = 0, bytelimit = 0x7fffffff;
int fd = -1;
char endianness, *filename;
@@ -990,13 +994,6 @@ static void soundfiler_read(t_soundfiler *x, t_symbol *s,
goto usage;
argc -= 2; argv += 2;
}
- else if (!strcmp(flag, "nframes"))
- {
- if (argc < 2 || argv[1].a_type != A_FLOAT ||
- ((nframes = argv[1].a_w.w_float) < 0))
- goto usage;
- argc -= 2; argv += 2;
- }
else if (!strcmp(flag, "raw"))
{
if (argc < 5 ||
diff --git a/pd/src/g_array.c b/pd/src/g_array.c
index 1b44e548..543823f6 100644
--- a/pd/src/g_array.c
+++ b/pd/src/g_array.c
@@ -1051,7 +1051,7 @@ static void garray_save(t_gobj *z, t_binbuf *b)
chunk = ARRAYWRITECHUNKSIZE;
binbuf_addv(b, "si", gensym("#A"), n2);
for (i = 0; i < chunk; i++)
- binbuf_addv(b, "f", ((float *)(array->a_vec))[n2+i]);
+ binbuf_addv(b, "f", ((t_word *)(array->a_vec))[n2+i].w_float);
binbuf_addv(b, ";");
n2 += chunk;
}
diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index 5a52a07a..10f897c1 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -1048,12 +1048,12 @@ void canvas_loadbang(t_canvas *x)
or something. Anyway, we just add the 2 pixels back here; seems we
have to do this for linux but not MSW; not sure about MacOS. */
-#ifdef MSW
-#define HORIZBORDER 0
-#define VERTBORDER 0
-#else
+#ifdef __unix__
#define HORIZBORDER 2
#define VERTBORDER 2
+#else
+#define HORIZBORDER 4
+#define VERTBORDER 4
#endif
static void canvas_relocate(t_canvas *x, t_symbol *canvasgeom,
diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c
index d65038c1..28becbdb 100644
--- a/pd/src/g_rtext.c
+++ b/pd/src/g_rtext.c
@@ -439,7 +439,10 @@ void rtext_key(t_rtext *x, int keynum, t_symbol *keysym)
x->x_buf = resizebytes(x->x_buf, x->x_bufsize, newsize);
x->x_bufsize = newsize;
- if (n == '\n' || isprint(n))
+/* at Guenter's suggestion, use 'n>31' to test wither a character might
+be printable in whatever 8-bit character set we find ourselves. */
+
+ if (n == '\n' || n > 31)
{
newsize = x->x_bufsize+1;
x->x_buf = resizebytes(x->x_buf, x->x_bufsize, newsize);
diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c
index b6788988..76d54007 100644
--- a/pd/src/g_scalar.c
+++ b/pd/src/g_scalar.c
@@ -195,45 +195,50 @@ static void scalar_getrect(t_gobj *z, t_glist *owner,
*yp2 = y2;
}
-static void scalar_select(t_gobj *z, t_glist *owner, int state)
+static void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state)
{
- t_scalar *x = (t_scalar *)z;
- t_symbol *templatesym = x->sc_template;
- t_template *tmpl;
- t_atom at;
- t_gpointer gp;
- gpointer_init(&gp);
- gpointer_setglist(&gp, owner, x);
- SETPOINTER(&at, &gp);
if (state)
{
int x1, y1, x2, y2;
- if (tmpl = template_findbyname(templatesym))
- template_notify(tmpl, gensym("select"), 1, &at);
- gpointer_unset(&gp);
-
- scalar_getrect(z, owner, &x1, &y1, &x2, &y2);
+
+ scalar_getrect(&x->sc_gobj, glist, &x1, &y1, &x2, &y2);
x1--; x2++; y1--; y2++;
sys_vgui(".x%lx.c create line %d %d %d %d %d %d %d %d %d %d \
-width 0 -fill blue -tags select%lx\n",
- glist_getcanvas(owner), x1, y1, x1, y2, x2, y2, x2, y1, x1, y1,
+ glist_getcanvas(glist), x1, y1, x1, y2, x2, y2, x2, y1, x1, y1,
x);
}
else
{
- sys_vgui(".x%lx.c delete select%lx\n", glist_getcanvas(owner), x);
- if (tmpl = template_findbyname(templatesym))
- template_notify(tmpl, gensym("deselect"), 1, &at);
-
+ sys_vgui(".x%lx.c delete select%lx\n", glist_getcanvas(glist), x);
}
}
+static void scalar_select(t_gobj *z, t_glist *owner, int state)
+{
+ t_scalar *x = (t_scalar *)z;
+ t_template *tmpl;
+ t_symbol *templatesym = x->sc_template;
+ t_atom at;
+ t_gpointer gp;
+ gpointer_init(&gp);
+ gpointer_setglist(&gp, owner, x);
+ SETPOINTER(&at, &gp);
+ if (tmpl = template_findbyname(templatesym))
+ template_notify(tmpl, (state ? gensym("select") : gensym("deselect")),
+ 1, &at);
+ gpointer_unset(&gp);
+ scalar_drawselectrect(x, owner, state);
+}
+
static void scalar_displace(t_gobj *z, t_glist *glist, int dx, int dy)
{
t_scalar *x = (t_scalar *)z;
t_symbol *templatesym = x->sc_template;
t_template *template = template_findbyname(templatesym);
t_symbol *zz;
+ t_atom at[3];
+ t_gpointer gp;
int xonset, yonset, xtype, ytype, gotx, goty;
if (!template)
{
@@ -252,12 +257,13 @@ static void scalar_displace(t_gobj *z, t_glist *glist, int dx, int dy)
if (goty)
*(t_float *)(((char *)(x->sc_vec)) + yonset) +=
dy * (glist_pixelstoy(glist, 1) - glist_pixelstoy(glist, 0));
+ gpointer_init(&gp);
+ gpointer_setglist(&gp, glist, x);
+ SETPOINTER(&at[0], &gp);
+ SETFLOAT(&at[1], (float)dx);
+ SETFLOAT(&at[2], (float)dy);
+ template_notify(template, gensym("displace"), 2, at);
scalar_redraw(x, glist);
- if (glist_isselected(glist, z))
- {
- scalar_select(z, glist, 0);
- scalar_select(z, glist, 1);
- }
}
static void scalar_activate(t_gobj *z, t_glist *owner, int state)
@@ -299,6 +305,11 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis)
if (!wb) continue;
(*wb->w_parentvisfn)(y, owner, x->sc_vec, template, basex, basey, vis);
}
+ if (glist_isselected(owner, &x->sc_gobj))
+ {
+ scalar_drawselectrect(x, owner, 0);
+ scalar_drawselectrect(x, owner, 1);
+ }
sys_unqueuegui(x);
}
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index 3d00b5dd..f5519e65 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -1129,7 +1129,8 @@ static void curve_vis(t_gobj *z, t_glist *glist,
int i, n = x->x_npoints;
t_fielddesc *f = x->x_vec;
- if (!fielddesc_getfloat(&x->x_vis, template, data, 0))
+ /* see comment in plot_vis() */
+ if (vis && !fielddesc_getfloat(&x->x_vis, template, data, 0))
return;
if (vis)
{
@@ -1269,7 +1270,7 @@ static int curve_click(t_gobj *z, t_glist *glist,
bestn = i;
}
}
- if (besterror > 10)
+ if (besterror > 6)
return (0);
if (doit)
{
@@ -1656,11 +1657,19 @@ static void plot_vis(t_gobj *z, t_glist *glist,
int nelem;
char *elem;
t_fielddesc *xfielddesc, *yfielddesc, *wfielddesc;
-
+ /* even if the array is "invisible", if its visibility is
+ set by an instance variable you have to explicitly erase it,
+ because the flag could earlier have been on when we were getting
+ drawn. Rather than look to try to find out whether we're
+ visible we just do the erasure. At the TK level this should
+ cause no action because the tag matches nobody. LATER we
+ might want to optimize this somehow. Ditto the "vis()" routines
+ for other drawing instructions. */
+
if (plot_readownertemplate(x, data, template,
&elemtemplatesym, &array, &linewidth, &xloc, &xinc, &yloc, &style,
&vis, &scalarvis, &xfielddesc, &yfielddesc, &wfielddesc) ||
- ((vis == 0) && tovis) /* FIXME - why is 'tovis' flag necessary? */
+ ((vis == 0) && tovis) /* see above for 'tovis' */
|| array_getfields(elemtemplatesym, &elemtemplatecanvas,
&elemtemplate, &elemsize, xfielddesc, yfielddesc, wfielddesc,
&xonset, &yonset, &wonset))
@@ -2108,7 +2117,8 @@ static void drawnumber_vis(t_gobj *z, t_glist *glist,
{
t_drawnumber *x = (t_drawnumber *)z;
- if (!fielddesc_getfloat(&x->x_vis, template, data, 0))
+ /* see comment in plot_vis() */
+ if (vis && !fielddesc_getfloat(&x->x_vis, template, data, 0))
return;
if (vis)
{
diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c
index e12bad5f..69580741 100644
--- a/pd/src/m_binbuf.c
+++ b/pd/src/m_binbuf.c
@@ -388,7 +388,7 @@ void binbuf_restore(t_binbuf *x, int argc, t_atom *argv)
}
-#define MSTACKSIZE 2048
+#define MSTACKSIZE 10000 /* FIXME -- make this grow as needed */
void binbuf_print(t_binbuf *x)
{
diff --git a/pd/src/m_sched.c b/pd/src/m_sched.c
index 82c4c5d7..bce50cd5 100644
--- a/pd/src/m_sched.c
+++ b/pd/src/m_sched.c
@@ -396,7 +396,7 @@ int m_scheduler( void)
#endif
sys_clearhist();
- if (sys_sleepgrain < 1000)
+ if (sys_sleepgrain < 100)
sys_sleepgrain = sys_schedadvance/4;
if (sys_sleepgrain < 100)
sys_sleepgrain = 100;
diff --git a/pd/src/makefile.in b/pd/src/makefile.in
index 8b41c5bf..33ac2b99 100644
--- a/pd/src/makefile.in
+++ b/pd/src/makefile.in
@@ -38,6 +38,10 @@ CFLAGS = @CFLAGS@ $(ARCH_CFLAGS) $(WARN_CFLAGS) $(CPPFLAGS) $(MORECFLAGS)
SYSSRC += @SYSSRC@
+ASIOSRC = @ASIOSRC@
+
+ASIOOBJ = $(ASIOSRC:.cpp=.o)
+
SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
g_scalar.c g_traversal.c g_guiconnect.c g_readwrite.c g_editor.c \
g_all_guis.c g_bang.c g_hdial.c g_hslider.c g_mycanvas.c g_numbox.c \
@@ -91,6 +95,9 @@ $(OBJ) : %.o : %.c
$(GOBJ) : %.o : %.c
$(CC) $(CFLAGS) $(GFLAGS) $(GINCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
+$(ASIOOBJ): %.o : %.cpp
+ $(CXX) $(CFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.cpp
+
pd: $(PDEXEC)
gui: $(BIN_DIR)/$(GUINAME)
@@ -132,6 +139,12 @@ $(BIN_DIR)/libPdTcl.dylib: $(GOBJ) $(GSRC)
@executable_path/../Frameworks/Tk.framework/Versions/8.4/Tk \
../bin/libPdTcl.dylib
+# this is for Windows/MinGW (only?)
+$(BIN_DIR)/pdtcl.dll: $(GOBJ)
+ cd $(BIN_DIR); dllwrap --export-all-symbols --output-def pdtcl.def \
+ --output-lib=pdtcl.a --dllname=$(GUINAME) $(OBJ_DIR)/t_tkcmd.o $(LIB) $(GLIB)
+ strip --strip-unneeded $(BIN_DIR)/pdtcl.dll
+
externs:
cd ../extra/bonk~;make @EXTERNTARGET@
cd ../extra/choice;make @EXTERNTARGET@
diff --git a/pd/src/makefile.nt b/pd/src/makefile.nt
index fcc70aaa..fc624896 100644
--- a/pd/src/makefile.nt
+++ b/pd/src/makefile.nt
@@ -119,7 +119,7 @@ gui: ..\bin\pdtcl.dll
s_entry_com.obj: s_entry.c
copy s_entry.c s_entry_com.c
- cl /c s_entry_com.c
+ cl /c -DCOMMANDVERSION s_entry_com.c
del s_entry_com.c
..\bin\pd.com: s_entry_com.obj ..\bin\pd.lib
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index 266b2939..cc709392 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -17,6 +17,10 @@ turn on paMacCore_ChangeDeviceParameters for mac (pa_mac_core.h)
Gnome: why don't windows pop up when clicked on?
problems:
+fix declare to update current patch when changed
+objects on GOP don't erase if you edit the GOP while they're showing
+MSTACKSIZE limitation in m_binbuf.c
+add -stack option to make 'regular' stack larger
TK menu on Windows says "wish"
activating windows in Gnome?
help browser broke on Panurge
@@ -51,6 +55,7 @@ real-time spectrum grapher
document ||, |, etc, better
features:
+clickles connection (hit 'c' key or something)
messages to suppress menus&accelerators, and invisibilize Pd window
machine-independent fonts
callback scheduling on Mac
@@ -96,13 +101,14 @@ editing:
(also, a way to make multiple connections?)
data:
+make a 2-pass proecss for finding hot spot closes to any given click
+replace list element with binbuf??
hooks for table mousing, other changes (scalars?)
data to save as succession of "list" messages that textfile can store, etc.
implement list field (GOP or subwindow, perhaps GOP could suppress bounds rect?)
-fix blue selection rectangle to update if selected datum is redrawn
data copy/paste doesn't check templates aren't changed
arrays of non-existent templates crash
-vget, vset traversal objects
+vget, vset traversal objects, pointer == and select equivalents
cursor to show (x, y) location
improve typing at drawnumbers
sublists should display on parent if desired? (new drawing instruction)
@@ -112,6 +118,7 @@ append doesn't do symbols yet.
more features:
+clean out IRIX stuff
"-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.
diff --git a/pd/src/s_audio_alsa.c b/pd/src/s_audio_alsa.c
index 83530de9..6733182d 100644
--- a/pd/src/s_audio_alsa.c
+++ b/pd/src/s_audio_alsa.c
@@ -145,7 +145,7 @@ static int alsaio_setup(t_alsa_dev *dev, int out, int *channels, int *rate,
hw_params, &tmp_uint);
check_error(err, "snd_pcm_hw_params_set_channels");
if (tmp_uint != (unsigned)*channels)
- post("ALSA: set input channels to %d", tmp_uint);
+ post("ALSA: set %s channels to %d", (out?"output":"input"), tmp_uint);
*channels = tmp_uint;
dev->a_channels = *channels;
@@ -158,10 +158,8 @@ static int alsaio_setup(t_alsa_dev *dev, int out, int *channels, int *rate,
post("input sample rate %d", err);
#endif
- /* set the period - ie frag size */
- /* LATER try this to get a recommended period size...
- right now, it trips an assertion failure in ALSA lib */
-
+ /* post("frag size %d, nfrags %d", frag_size, nfrags); */
+ /* set "period size" */
#ifdef ALSAAPI9
err = snd_pcm_hw_params_set_period_size_near(dev->a_handle,
hw_params, (snd_pcm_uframes_t)frag_size, 0);
@@ -171,17 +169,6 @@ static int alsaio_setup(t_alsa_dev *dev, int out, int *channels, int *rate,
hw_params, &tmp_snd_pcm_uframes, 0);
#endif
check_error(err, "snd_pcm_hw_params_set_period_size_near (input)");
-
- /* set the number of periods - ie numfrags */
-#ifdef ALSAAPI9
- err = snd_pcm_hw_params_set_periods_near(dev->a_handle,
- hw_params, nfrags, 0);
-#else
- tmp_uint = nfrags;
- err = snd_pcm_hw_params_set_periods_near(dev->a_handle,
- hw_params, &tmp_uint, 0);
-#endif
- check_error(err, "snd_pcm_hw_params_set_periods_near (input)");
/* set the buffer size */
#ifdef ALSAAPI9
@@ -429,7 +416,6 @@ int alsa_send_dacs(void)
if (snd_pcm_status_get_avail(alsa_status) < transfersize)
return SENDDACS_NO;
}
-
/* do output */
for (iodev = 0, fp1 = sys_soundout, ch = 0; iodev < alsa_noutdev; iodev++)
{
diff --git a/pd/src/s_entry.c b/pd/src/s_entry.c
index eb49cfc1..5cef73cc 100644
--- a/pd/src/s_entry.c
+++ b/pd/src/s_entry.c
@@ -3,7 +3,11 @@ that externs can link back to functions defined in pd. */
int sys_main(int argc, char **argv);
-#ifdef MSW
+/*
+ * gcc does not support the __try stuff, only MSVC. Also, MinGW allows you to
+ * use main() instead of WinMain(). <hans@at.or.at>
+ */
+#if defined(_MSC_VER) && !defined(COMMANDVERSION)
#include <windows.h>
#include <stdio.h>
@@ -21,11 +25,11 @@ int WINAPI WinMain(HINSTANCE hInstance,
}
}
-#else /* not MSW */
+#else /* not _MSC_VER ... */
int main(int argc, char **argv)
{
return (sys_main(argc, argv));
}
-#endif
+#endif /* _MSC_VER */
diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c
index 4b73e8d1..e6c69bf6 100644
--- a/pd/src/s_inter.c
+++ b/pd/src/s_inter.c
@@ -23,16 +23,19 @@ that didn't really belong anywhere. */
#ifdef HAVE_BSTRING_H
#include <bstring.h>
#endif
-#ifdef MSW
+#ifdef _WIN32
#include <io.h>
#include <fcntl.h>
#include <process.h>
#include <winsock.h>
#include <windows.h>
+# ifdef _MSC_VER
typedef int pid_t;
+# endif
typedef int socklen_t;
#define EADDRINUSE WSAEADDRINUSE
#endif
+
#include <stdarg.h>
#include <signal.h>
#include <fcntl.h>
@@ -150,13 +153,15 @@ double sys_getrealtime(void)
#endif
}
+extern int sys_nosleep;
+
static int sys_domicrosleep(int microsec, int pollem)
{
struct timeval timout;
int i, didsomething = 0;
t_fdpoll *fp;
timout.tv_sec = 0;
- timout.tv_usec = microsec;
+ timout.tv_usec = (sys_nosleep ? 0 : microsec);
if (pollem)
{
fd_set readset, writeset, exceptset;
@@ -1153,8 +1158,8 @@ int sys_startgui(const char *guidir)
to make it timeshare with the rest of the system. (Version
0.33P2 : if there's no GUI, the watchdog pinging is done
from the scheduler idle routine in this process instead.) */
-
int pipe9[2], watchpid;
+
if (pipe(pipe9) < 0)
{
seteuid(getuid()); /* lose setuid priveliges */
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index ebaa661b..c170aec5 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -81,6 +81,7 @@ static int sys_nchout = -1;
static int sys_chinlist[MAXAUDIOINDEV];
static int sys_choutlist[MAXAUDIOOUTDEV];
+int sys_nosleep = 0; /* skip all "sleep" calls and spin instead */
t_sample* get_sys_soundout() { return sys_soundout; }
t_sample* get_sys_soundin() { return sys_soundin; }
int* get_sys_main_advance() { return &sys_main_advance; }
@@ -397,6 +398,7 @@ static char *(usagemessage[]) = {
"-rt or -realtime -- use real-time priority\n",
"-nrt -- don't use real-time priority\n",
#endif
+"-nosleep -- spin, don't sleep (may lower latency on multi-CPUs)\n",
};
static void sys_parsedevlist(int *np, int *vecp, int max, char *str)
@@ -585,7 +587,7 @@ int sys_argparse(int argc, char **argv)
}
else if (!strcmp(*argv, "-sleepgrain") && (argc > 1))
{
- sys_sleepgrain = 1000 * atoi(argv[1]);
+ sys_sleepgrain = 1000 * atof(argv[1]);
argc -= 2; argv += 2;
}
else if (!strcmp(*argv, "-nodac"))
@@ -829,6 +831,11 @@ int sys_argparse(int argc, char **argv)
argc--; argv++;
}
#endif
+ else if (!strcmp(*argv, "-nosleep"))
+ {
+ sys_nosleep = 1;
+ argc--; argv++;
+ }
else if (!strcmp(*argv, "-soundindev") ||
!strcmp(*argv, "-audioindev"))
{
diff --git a/pd/src/s_path.c b/pd/src/s_path.c
index 14620eac..97591d4c 100644
--- a/pd/src/s_path.c
+++ b/pd/src/s_path.c
@@ -30,6 +30,13 @@
#include <fcntl.h>
#include <ctype.h>
+#ifdef _LARGEFILE64_SOURCE
+# define open open64
+# define lseek lseek64
+# define fstat fstat64
+# define stat stat64
+#endif
+
t_namelist *sys_externlist;
t_namelist *sys_searchpath;
t_namelist *sys_helppath;
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index a05d145f..8c43905b 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -212,6 +212,7 @@ set untitled_number 1
set untitled_directory [pwd]
set saveas_client doggy
set pd_opendir $untitled_directory
+set pd_savedir $untitled_directory
set pd_undoaction no
set pd_redoaction no
set pd_undocanvas no
@@ -3414,8 +3415,7 @@ proc pdtk_openpanel {target localdir} {
if {$localdir == ""} {
set localdir $pd_opendir
}
- set filename [tk_getOpenFile \
- -initialdir $localdir]
+ set filename [tk_getOpenFile -initialdir $localdir]
if {$filename != ""} {
set directory [string range $filename 0 \
[expr [string last / $filename ] - 1]]
@@ -3426,11 +3426,11 @@ proc pdtk_openpanel {target localdir} {
}
proc pdtk_savepanel {target localdir} {
+ global pd_savedir
if {$localdir == ""} {
- set filename [tk_getSaveFile]
- } else {
- set filename [tk_getSaveFile -initialdir $localdir]
+ set localdir $pd_savedir
}
+ set filename [tk_getSaveFile -initialdir $localdir]
if {$filename != ""} {
pd [concat $target callback [pdtk_enquote $filename] \;]
}
diff --git a/pd/src/x_list.c b/pd/src/x_list.c
index 23989585..8156704a 100644
--- a/pd/src/x_list.c
+++ b/pd/src/x_list.c
@@ -50,6 +50,7 @@ typedef struct _alist
{
t_pd l_pd; /* object to point inlets to */
int l_n; /* number of items */
+ int l_npointer; /* number of pointers */
t_listelem *l_vec; /* pointer to items */
} t_alist;
@@ -95,7 +96,7 @@ t_class *alist_class;
static void alist_init(t_alist *x)
{
x->l_pd = alist_class;
- x->l_n = 0;
+ x->l_n = x->l_npointer = 0;
x->l_vec = 0;
}
@@ -122,11 +123,16 @@ static void alist_list(t_alist *x, t_symbol *s, int argc, t_atom *argv)
return;
}
x->l_n = argc;
+ x->l_npointer = 0;
for (i = 0; i < argc; i++)
{
x->l_vec[i].l_a = argv[i];
if (x->l_vec[i].l_a.a_type == A_POINTER)
+ {
+ x->l_npointer++;
gpointer_copy(x->l_vec[i].l_a.a_w.w_gpointer, &x->l_vec[i].l_p);
+ x->l_vec[i].l_a.a_w.w_gpointer = &x->l_vec[i].l_p;
+ }
}
}
@@ -141,12 +147,17 @@ static void alist_anything(t_alist *x, t_symbol *s, int argc, t_atom *argv)
return;
}
x->l_n = argc+1;
+ x->l_npointer = 0;
SETSYMBOL(&x->l_vec[0].l_a, s);
for (i = 0; i < argc; i++)
{
x->l_vec[i+1].l_a = argv[i];
if (x->l_vec[i+1].l_a.a_type == A_POINTER)
+ {
+ x->l_npointer++;
gpointer_copy(x->l_vec[i+1].l_a.a_w.w_gpointer, &x->l_vec[i+1].l_p);
+ x->l_vec[i].l_a.a_w.w_gpointer = &x->l_vec[i].l_p;
+ }
}
}
@@ -157,6 +168,29 @@ static void alist_toatoms(t_alist *x, t_atom *to)
to[i] = x->l_vec[i].l_a;
}
+
+static void alist_clone(t_alist *x, t_alist *y)
+{
+ int i;
+ y->l_pd = alist_class;
+ y->l_n = x->l_n;
+ y->l_npointer = x->l_npointer;
+ if (!(y->l_vec = (t_listelem *)getbytes(y->l_n * sizeof(*y->l_vec))))
+ {
+ y->l_n = 0;
+ error("list_alloc: out of memory");
+ }
+ else for (i = 0; i < x->l_n; i++)
+ {
+ y->l_vec[i].l_a = x->l_vec[i].l_a;
+ if (y->l_vec[i].l_a.a_type == A_POINTER)
+ {
+ gpointer_copy(y->l_vec[i].l_a.a_w.w_gpointer, &y->l_vec[i].l_p);
+ y->l_vec[i].l_a.a_w.w_gpointer = &y->l_vec[i].l_p;
+ }
+ }
+}
+
static void alist_setup(void)
{
alist_class = class_new(gensym("list inlet"),
@@ -192,8 +226,19 @@ static void list_append_list(t_list_append *x, t_symbol *s,
int n, outc = x->x_alist.l_n + argc;
ATOMS_ALLOCA(outv, outc);
atoms_copy(argc, argv, outv);
- alist_toatoms(&x->x_alist, outv+argc);
- outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
+ if (x->x_alist.l_npointer)
+ {
+ t_alist y;
+ alist_clone(&x->x_alist, &y);
+ alist_toatoms(&y, outv+argc);
+ outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
+ alist_clear(&y);
+ }
+ else
+ {
+ alist_toatoms(&x->x_alist, outv+argc);
+ outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
+ }
ATOMS_FREEA(outv, outc);
}
@@ -205,8 +250,19 @@ static void list_append_anything(t_list_append *x, t_symbol *s,
ATOMS_ALLOCA(outv, outc);
SETSYMBOL(outv, s);
atoms_copy(argc, argv, outv + 1);
- alist_toatoms(&x->x_alist, outv + 1 + argc);
- outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
+ if (x->x_alist.l_npointer)
+ {
+ t_alist y;
+ alist_clone(&x->x_alist, &y);
+ alist_toatoms(&y, outv + 1 + argc);
+ outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
+ alist_clear(&y);
+ }
+ else
+ {
+ alist_toatoms(&x->x_alist, outv + 1 + argc);
+ outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
+ }
ATOMS_FREEA(outv, outc);
}
@@ -251,22 +307,46 @@ static void list_prepend_list(t_list_prepend *x, t_symbol *s,
t_atom *outv;
int n, outc = x->x_alist.l_n + argc;
ATOMS_ALLOCA(outv, outc);
- alist_toatoms(&x->x_alist, outv);
atoms_copy(argc, argv, outv + x->x_alist.l_n);
- outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
+ if (x->x_alist.l_npointer)
+ {
+ t_alist y;
+ alist_clone(&x->x_alist, &y);
+ alist_toatoms(&y, outv);
+ outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
+ alist_clear(&y);
+ }
+ else
+ {
+ alist_toatoms(&x->x_alist, outv);
+ outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
+ }
ATOMS_FREEA(outv, outc);
}
+
+
static void list_prepend_anything(t_list_prepend *x, t_symbol *s,
int argc, t_atom *argv)
{
t_atom *outv;
int n, outc = x->x_alist.l_n + argc + 1;
ATOMS_ALLOCA(outv, outc);
- alist_toatoms(&x->x_alist, outv);
SETSYMBOL(outv + x->x_alist.l_n, s);
atoms_copy(argc, argv, outv + x->x_alist.l_n + 1);
- outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
+ if (x->x_alist.l_npointer)
+ {
+ t_alist y;
+ alist_clone(&x->x_alist, &y);
+ alist_toatoms(&y, outv);
+ outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
+ alist_clear(&y);
+ }
+ else
+ {
+ alist_toatoms(&x->x_alist, outv);
+ outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv);
+ }
ATOMS_FREEA(outv, outc);
}