aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGuenter Geiger <ggeiger@users.sourceforge.net>2004-02-22 16:00:02 +0000
committerGuenter Geiger <ggeiger@users.sourceforge.net>2004-02-22 16:00:02 +0000
commit4af95e6d1963e319ed6bb1681a332ad654bdd1ef (patch)
tree63d42c0e25f0ad84963a0a0c264a93251cbea7a8
parent74e28b058aaf629d94ad7d44a9add3062e89441d (diff)
merged in version 0.37-1test6
svn path=/trunk/; revision=1329
-rw-r--r--pd/src/configure.in230
-rw-r--r--pd/src/g_all_guis.c462
-rw-r--r--pd/src/g_all_guis.h14
-rw-r--r--pd/src/g_bang.c41
-rw-r--r--pd/src/g_canvas.c9
-rw-r--r--pd/src/g_hdial.c41
-rw-r--r--pd/src/g_hslider.c41
-rw-r--r--pd/src/g_mycanvas.c42
-rw-r--r--pd/src/g_numbox.c46
-rw-r--r--pd/src/g_rtext.c13
-rw-r--r--pd/src/g_scalar.c57
-rw-r--r--pd/src/g_template.c4
-rw-r--r--pd/src/g_toggle.c41
-rw-r--r--pd/src/g_vdial.c43
-rw-r--r--pd/src/g_vslider.c42
-rw-r--r--pd/src/g_vumeter.c37
-rw-r--r--pd/src/m_binbuf.c1
-rw-r--r--pd/src/m_pd.h7
-rw-r--r--pd/src/m_sched.c4
-rw-r--r--pd/src/makefile225
-rw-r--r--pd/src/makefile.in74
-rw-r--r--pd/src/notes.txt17
-rw-r--r--pd/src/s_audio.c6
-rw-r--r--pd/src/s_audio_alsa.c228
-rw-r--r--pd/src/s_audio_jack.c155
-rw-r--r--pd/src/s_audio_oss.c39
-rw-r--r--pd/src/s_audio_pa.c1
-rw-r--r--pd/src/s_inter.c24
-rw-r--r--pd/src/s_loader.c2
-rw-r--r--pd/src/s_main.c6
-rw-r--r--pd/src/s_midi.c150
-rw-r--r--pd/src/s_midi_mmio.c40
-rw-r--r--pd/src/s_midi_pm.c86
-rw-r--r--pd/src/s_stuff.h4
-rw-r--r--pd/src/u_main.tk20
35 files changed, 906 insertions, 1346 deletions
diff --git a/pd/src/configure.in b/pd/src/configure.in
index 1a73c3da..7d0346bf 100644
--- a/pd/src/configure.in
+++ b/pd/src/configure.in
@@ -1,14 +1,14 @@
dnl Process this file with autoconf to produce a configure script.
AC_INIT(d_arithmetic.c)
-AC_SUBST(alsa)
-AC_SUBST(jack)
+AC_SUBST(alsa, yes)
+AC_SUBST(jack, no)
+AC_SUBST(portaudio, no)
AC_SUBST(PDLIB)
-AC_SUBST(DEFINES)
AC_SUBST(MORECFLAGS)
AC_SUBST(EXT)
AC_SUBST(OPT_CFLAGS)
-AC_SUBST(USE_OPT_CFLAGS)
+AC_SUBST(USE_OPT_CFLAGS, yes)
AC_SUBST(SYSSRC)
AC_SUBST(STRIPFLAG)
AC_SUBST(GUINAME)
@@ -24,8 +24,12 @@ AC_ARG_ENABLE(alsa, [ --disable-alsa disable ALSA],
alsa="no")
AC_ARG_ENABLE(jack, [ --enable-jack jack audio server],
jack="yes")
+AC_ARG_ENABLE(portaudio, [ --enable-portaudio portaudio],
+ portaudio="yes")
AC_ARG_ENABLE(debug, [ --enable-debug debugging support],
- USE_OPT_CFLAGS="NO", USE_OPT_CFLAGS="YES")
+ USE_OPT_CFLAGS="no")
+AC_ARG_ENABLE(static, [ --enable-static link statically],
+ static=yes)
dnl Checks for programs.
AC_PROG_CC
@@ -67,10 +71,6 @@ dnl Checking for `pthread_create' function in -pthread
AC_CHECK_LIB(pthread, pthread_create,PDLIB="$PDLIB -lpthread",
echo "pthreads required" || exit 1)
-dnl This should be fixed so Pd can use ALSA shared libraries where appropriate.
-if test "$alsa" != no; then
- AC_CHECK_LIB(asound,snd_pcm_info,PDLIB="$PDLIB -lasound" ; alsa="yes",alsa="")
-fi
dnl Find paths to includes and libraries for X11
AC_PATH_X
@@ -80,17 +80,11 @@ AC_CHECK_LIB(X11, XCreateWindow, LIBS="$LIBS -lX11 -L$x_libraries",
dnl look for tcl 8.x... do I really have to go through all this!?
-#AC_CHECK_HEADER(tcl.h,, echo "no tcl/tk header found" || exit 1)
-
-# FreeBSD has lots of libs there ...
-LIBS="$LIBS -L/usr/local/lib"
-
foundit=no
if test $foundit == "no";
then
AC_CHECK_HEADER(tcl.h,foundit=yes,)
fi
-
if test $foundit == "no";
then
AC_CHECK_HEADER(tcl8.7/tcl.h,
@@ -98,121 +92,89 @@ then
fi
if test $foundit == "no";
then
- AC_CHECK_HEADER(/usr/local/include/tcl8.7/tcl.h,
- GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.7 -I/usr/local/include/tk8.7";foundit=yes,)
-fi
-if test $foundit == "no";
-then
AC_CHECK_HEADER(tcl8.6/tcl.h,
GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.6";foundit=yes,)
fi
if test $foundit == "no";
then
- AC_CHECK_HEADER(/usr/local/include/tcl8.6/tcl.h,
- GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.6 -I/usr/local/include/tk8.6";foundit=yes,)
-fi
-
-if test $foundit == "no";
-then
AC_CHECK_HEADER(tcl8.5/tcl.h,
GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.5";foundit=yes,)
fi
if test $foundit == "no";
then
- AC_CHECK_HEADER(/usr/local/include/tcl8.5/tcl.h,
- GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.5 -I/usr/local/include/tk8.5";foundit=yes,)
-fi
-
-if test $foundit == "no";
-then
AC_CHECK_HEADER(tcl8.4/tcl.h,
GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.4";foundit=yes,)
fi
if test $foundit == "no";
then
- AC_CHECK_HEADER(/usr/local/include/tcl8.4/tcl.h,
- GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.4 -I/usr/local/include/tk8.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
if test $foundit == "no";
then
- AC_CHECK_HEADER(/usr/local/include/tcl8.3/tcl.h,
- GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.3 -I/usr/local/include/tk8.3";foundit=yes,)
-fi
-
-if test $foundit == "no";
-then
AC_CHECK_HEADER(tcl8.2/tcl.h,
GUIFLAGS="$GUIFLAGS -I/usr/include/tcl8.2";foundit=yes,)
fi
if test $foundit == "no";
then
- AC_CHECK_HEADER(/usr/local/include/tcl8.2/tcl.h,
- GUIFLAGS="$GUIFLAGS -I/usr/local/include/tcl8.2 -I/usr/local/include/tk8.2";foundit=yes,)
-fi
-
-if test $foundit == "no";
-then
echo no tcl header found
exit -1
fi
-
-
AC_CHECK_LIB(tcl8.7, main,,
-AC_CHECK_LIB(tcl87, main,LIBS="$LIBS -ltcl87",
AC_CHECK_LIB(tcl8.6, main,,
- AC_CHECK_LIB(tcl86, main,LIBS="$LIBS -ltcl86",
- AC_CHECK_LIB(tcl8.5, main,,
- AC_CHECK_LIB(tcl85, main,LIBS="$LIBS -ltcl85",
- AC_CHECK_LIB(tcl8.4, main,,
- AC_CHECK_LIB(tcl84, main,LIBS="$LIBS -ltcl84",
- AC_CHECK_LIB(tcl8.3, main,,
- AC_CHECK_LIB(tcl83, main,LIBS="$LIBS -ltcl83",
- AC_CHECK_LIB(tcl8.2, main,,
- AC_CHECK_LIB(tcl82, main,LIBS="$LIBS -ltcl82",
- AC_CHECK_LIB(tcl81, main,,
- AC_CHECK_LIB(tcl81, main,LIBS="$LIBS -ltcl81",
- AC_CHECK_LIB(tcl80, main,LIBS="$LIBS -ltcl80",
- AC_CHECK_LIB(tcl8.0, main))))))))))))))))
-
+ AC_CHECK_LIB(tcl8.5, 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(tk8.7, main,,
-AC_CHECK_LIB(tk87, main,LIBS="$LIBS -ltk87",
AC_CHECK_LIB(tk8.6, main,,
- AC_CHECK_LIB(tk86, main,LIBS="$LIBS -ltk86",
- AC_CHECK_LIB(tk8.5, main,,
- AC_CHECK_LIB(tk85, main,LIBS="$LIBS -ltk85",
- AC_CHECK_LIB(tk8.4, main,,
- AC_CHECK_LIB(tk84, main,LIBS="$LIBS -ltk84",
- AC_CHECK_LIB(tk8.3, main,,
- AC_CHECK_LIB(tk83, main,LIBS="$LIBS -ltk83",
- AC_CHECK_LIB(tk8.2, main,,
- AC_CHECK_LIB(tk82, main,LIBS="$LIBS -ltk82",
- AC_CHECK_LIB(tk81, main,,
- AC_CHECK_LIB(tk81, main,LIBS="$LIBS -ltk81",
- AC_CHECK_LIB(tk80, main,LIBS="$LIBS -ltk80",
- AC_CHECK_LIB(tk8.0, main))))))))))))))))
-
+ AC_CHECK_LIB(tk8.5, 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)))))))
-dnl Checking for tk.h or tkstep.h - not used at the moment
-dnl AC_CHECK_HEADER(tk.h,DEFINES="$DEFINES -DTKINC=\\\"tk.h\\\"")
-dnl AC_CHECK_HEADER(tkstep.h,DEFINES="$DEFINES -DTKINC=\\\"tkstep.h\\\"")
if test `uname -s` = Linux;
then
+ dnl Ckecking for ALSA
+
+dnl This should be fixed so Pd can use ALSA shared libraries where appropriate.
+ if test x$alsa == xyes; then
+ echo yes ... alsa is... $alsa
+ AC_CHECK_LIB(asound,snd_pcm_info,PDLIB="$PDLIB -lasound" ; alsa="yes",alsa="no")
+ fi
+
+ dnl Checking for JACK
+
+ AC_CHECK_LIB(rt,shm_open,LIBS="$LIBS -lrt")
+ AC_CHECK_LIB(jack,jack_set_xrun_callback,LIBS="$LIBS -ljack";jack=xrun,jack=no)
+ AC_CHECK_LIB(jack,jack_set_error_function,LIBS="$LIBS -ljack";jack=yes,jack=no)
+
LDFLAGS="-Wl,-export-dynamic"
+ if test "$static" = "yes"; then
+ LDFLAGS="$LDFLAGS -static"
+ fi
EXT=pd_linux
- MORECFLAGS="-DDL_OPEN -DUSEAPI_PORTAUDIO -DPA_USE_OSS -DPA_LITTLE_ENDIAN \
+ MORECFLAGS="-DDL_OPEN -DPA_USE_OSS -DPA_LITTLE_ENDIAN \
-DUSEAPI_OSS \
-I../portaudio/pa_common \
- -I../portaudio/pablio -I../portaudio/portmidi-macosx -Werror"
- SYSSRC="s_midi_oss.c s_audio_pa.c s_audio_oss.c \
+ -I../portaudio/pablio -I../portaudio/portmidi-macosx \
+ -fno-strict-aliasing"
+ SYSSRC="s_midi_oss.c s_audio_oss.c"
+ if test x$alsa == "xyes";
+ then
+ SYSSRC=$SYSSRC" s_audio_alsa.c"
+ MORECFLAGS=$MORECFLAGS" -DPA_USE_ALSA -DUSEAPI_ALSA"
+ LDFLAGS=$LDFLAGS" -lasound"
+ fi
+ if test x$portaudio == "xyes";
+ then
+ MORECFLAGS="-DUSEAPI_PORTAUDIO "$MORECFLAGS
+ SYSSRC="s_audio_pa.c \
../portaudio/pa_common/pa_allocation.c \
../portaudio/pa_common/pa_converters.c \
../portaudio/pa_common/pa_cpuload.c \
@@ -226,62 +188,24 @@ then
../portaudio/pablio/ringbuffer_pd.c \
../portaudio/pa_unix/pa_unix_hostapis.c \
../portaudio/pa_unix/pa_unix_util.c \
- ../portaudio/pa_unix_oss/pa_unix_oss.c "
- STRIPFLAG=-s
- GUINAME="pd-gui"
- if test $USE_OPT_CFLAGS == "YES";
- then
- OPT_CFLAGS="-O6 -funroll-loops -fomit-frame-pointer"
- else
- OPT_CFLAGS="-g"
+ ../portaudio/pa_unix_oss/pa_unix_oss.c "$SYSSRC
+ if test x$alsa == "xyes";
+ then
+ SYSSRC=$SYSSRC" \
+ ../portaudio/pa_linux_alsa/callback_thread.c \
+ ../portaudio/pa_linux_alsa/pa_linux_alsa.c \
+ ../portaudio/pa_linux_alsa/blocking_calls.c "
+ fi
fi
- OSNUMBER=0
-fi
-
-dnl FreeBSD hack
-if test `uname -s` = FreeBSD;
-then
- LDFLAGS="-Wl,-export-dynamic -L/usr/local/lib/pth -lpthread"
- EXT=pd_linux
- MORECFLAGS="-DDL_OPEN -DUSEAPI_OSS"
- CFLAGS="$CFLAGS -I/usr/local/include"
- SYSSRC="s_midi_oss.c s_audio_oss.c "
STRIPFLAG=-s
GUINAME="pd-gui"
- GUIFLAGS="$GUIFLAGS -I/usr/X11R6/include -I/usr/local/include"
- if test $USE_OPT_CFLAGS == "YES";
+ if test x$USE_OPT_CFLAGS == "xyes";
then
OPT_CFLAGS="-O6 -funroll-loops -fomit-frame-pointer"
else
OPT_CFLAGS="-g"
fi
- OSNUMBER=0
-fi
-
-
-dnl **** note -- SGI/IRIX code is broken here!!! ***
-
-if test `uname -s` = IRIX64;
-then
- LDFLAGS="-n32 -DUNIX -DIRIX -DN32 -woff 1080,1064,1185 \
- -OPT:roundoff=3 -OPT:IEEE_arithmetic=3 -OPT:cray_ivdep=true \
- -shared -rdata_shared"
- EXT=pd_irix6
- MORECFLAGS=-DDL_OPEN
- SYSSRC=s_sgi.c
- STRIPFLAG=-s
- GUINAME="pd-gui"
- OSNUMBER=0
-fi
-
-if test `uname -s` = IRIX32;
-then
- LDFLAGS="-o32 -DUNIX -DIRIX -O2 -shared -rdata_shared"
- EXT=pd_irix5
- MORECFLAGS=-DDL_OPEN
- SYSSRC=s_sgi.c
- STRIPFLAG=-s
- GUINAME="pd-gui"
+ echo OPT_CFLAGS --------------- $OPT_CFLAGS
OSNUMBER=0
fi
@@ -315,7 +239,7 @@ then
-I/Library/Frameworks/Tk.framework/Versions/Current/Headers \
-I/Library/Frameworks/Tcl.framework/Versions/Current/Headers \
-I/Library/Frameworks/Tcl.framework/Versions/8.4/PrivateHeaders"
- if test $USE_OPT_CFLAGS == "YES";
+ if test x$USE_OPT_CFLAGS == "xyes";
then
OPT_CFLAGS="-O2"
else
@@ -323,6 +247,38 @@ then
fi
OSNUMBER=2
EXTERNTARGET=pd_darwin
+ if test x$jack == "xyes";
+ then
+ LDFLAGS=$LDFLAGS" -framework Jack"
+ MORECFLAGS=$MORECFLAGS" -DUSEAPI_JACK"
+ SYSSRC=$SYSSRC" s_audio_jack.c"
+ fi
+fi
+
+# support for jack, on either linux or darwin:
+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
+if test `uname -m | awk '{print $1}'` = alpha;
+then
+ MORECFLAGS=$MORECFLAGS" -mieee -mcpu=ev56"
+fi
+
+# test for compaq compiler---not sure what this does or how to test it.
+if test x$CC == xccc;
+then
+ MORECFLAGS=$MORECFLAGS" -g3 -D__COMPAQC__ -arch host"
fi
AC_OUTPUT(makefile)
diff --git a/pd/src/g_all_guis.c b/pd/src/g_all_guis.c
index 606a6cf2..08a07f74 100644
--- a/pd/src/g_all_guis.c
+++ b/pd/src/g_all_guis.c
@@ -173,287 +173,95 @@ t_symbol *iemgui_dollar2raute(t_symbol *s)
else return (s);
}
-t_symbol *iemgui_unique2dollarzero(t_symbol *s, int unique_num, int and_unique_flag)
+void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui)
{
- if(and_unique_flag)
+ iemgui->x_fsf.x_put_in2out = 1;
+ if(iemgui->x_fsf.x_snd_able && iemgui->x_fsf.x_rcv_able)
{
- int l=0;
- char *b, str[144];
-
- sprintf(str, "%d", unique_num);
- while(str[l])
- {
- if(s->s_name[l] != str[l])
- return(s);
- else
- l++;
- }
- str[0] = '$';
- str[1] = '0';
- str[2] = 0;
- b = s->s_name + l;
- if(strlen(b) >= IEM_MAX_SYM_LEN)
- strncat(str, b, IEM_MAX_SYM_LEN-1);
- else
- strcat(str, b);
- return(gensym(str));
+ if(!strcmp(iemgui->x_snd->s_name, iemgui->x_rcv->s_name))
+ iemgui->x_fsf.x_put_in2out = 0;
}
- else
- return(s);
}
-t_symbol *iemgui_sym2dollararg(t_symbol *s, int nth_arg, int tail_len)
+t_symbol *iemgui_new_dogetname(t_iemgui *iemgui, int indx, t_atom *argv)
{
- if(nth_arg)
+ if (IS_A_SYMBOL(argv, indx))
+ return (atom_getsymbolarg(indx, 100000, argv));
+ else if (IS_A_FLOAT(argv, indx))
{
- char *b, str[144];
- int i=(int)strlen(s->s_name) - tail_len;
-
- sprintf(str, "_%d", nth_arg);
- str[0] = '$';
- if(i < 0) i = 0;
- b = s->s_name + i;
- strcat(str, b);
- return(gensym(str));
+ char str[80];
+ sprintf(str, "%d", (int)atom_getintarg(indx, 100000, argv));
+ return (gensym(str));
}
- else
- return(s);
-}
-
-t_symbol *iemgui_dollarzero2unique(t_symbol *s, int unique_num)
-{
- int l;
- char *b, str[144];
-
- sprintf(str, "%d", unique_num);
- l = (int)strlen(s->s_name);
- b = s->s_name + 2;
- if(l < 2)
- strcat(str, "shorty");
- else if(l >= IEM_MAX_SYM_LEN)
- strncat(str, b, IEM_MAX_SYM_LEN-1);
- else
- strcat(str, b);
- return(gensym(str));
+ else return (gensym("empty"));
}
-t_symbol *iemgui_dollararg2sym(t_symbol *s, int nth_arg, int tail_len, int pargc, t_atom *pargv)
+void iemgui_new_getnames(t_iemgui *iemgui, int indx, t_atom *argv)
{
- int l=(int)strlen(s->s_name);
- char *b, str[288]="0";
- t_symbol *s2;
-
- if(pargc <= 0){}
- else if(nth_arg < 1){}
- else if(nth_arg > pargc){}
- else if(IS_A_FLOAT(pargv, nth_arg-1))
- sprintf(str, "%d", atom_getintarg(nth_arg-1, pargc, pargv));
- else if(IS_A_SYMBOL(pargv, nth_arg-1))
+ if (argv)
{
- s2 = atom_getsymbolarg(nth_arg-1, pargc, pargv);
- strcpy(str, s2->s_name);
+ iemgui->x_snd = iemgui_new_dogetname(iemgui, indx, argv);
+ iemgui->x_rcv = iemgui_new_dogetname(iemgui, indx+1, argv);
+ iemgui->x_lab = iemgui_new_dogetname(iemgui, indx+2, argv);
}
- b = s->s_name + (l - tail_len);
- if(l <= tail_len)
- strcat(str, "shorty");
- else if(l >= IEM_MAX_SYM_LEN)
- strncat(str, b, IEM_MAX_SYM_LEN-1);
- else
- strcat(str, b);
- return(gensym(str));
+ else iemgui->x_snd = iemgui->x_rcv = iemgui->x_lab = gensym("empty");
+ iemgui->x_snd_unexpanded = iemgui->x_rcv_unexpanded =
+ iemgui->x_lab_unexpanded = 0;
+ iemgui->x_binbufindex = indx;
+ iemgui->x_labelbindex = indx + 3;
}
-int iemgui_is_dollarzero(t_symbol *s)
+ /* convert symbols in "$" form to the expanded symbols */
+void iemgui_all_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym)
{
- char *name=s->s_name;
-
- if((int)strlen(name) >= 2)
- {
- if((name[0] == '$') && (name[1] == '0') && ((name[2] < '0') || (name[2] > '9')))
- return(1);
- }
- return(0);
+ /* save unexpanded ones for later */
+ iemgui->x_snd_unexpanded = srlsym[0];
+ iemgui->x_rcv_unexpanded = srlsym[1];
+ iemgui->x_lab_unexpanded = srlsym[2];
+ srlsym[0] = canvas_realizedollar(iemgui->x_glist, srlsym[0]);
+ srlsym[1] = canvas_realizedollar(iemgui->x_glist, srlsym[1]);
+ srlsym[2] = canvas_realizedollar(iemgui->x_glist, srlsym[2]);
}
-int iemgui_is_dollararg(t_symbol *s, int *tail_len)
+ /* initialize a single symbol in unexpanded form. We reach into the
+ binbuf to grab them; if there's nothing there, set it to the
+ fallback; if still nothing, set to "empty". */
+static void iemgui_init_sym2dollararg(t_iemgui *iemgui, t_symbol **symp,
+ int indx, t_symbol *fallback)
{
- char *name=s->s_name;
-
- *tail_len = (int)strlen(name);
- if(*tail_len >= 2)
+ if (!*symp)
{
- if((name[0] == '$') && (name[1] >= '1') && (name[1] <= '9'))
+ t_binbuf *b = iemgui->x_obj.ob_binbuf;
+ if (binbuf_getnatom(b) > indx)
{
- int i=2, arg=(int)(name[1]-'0');
-
- (*tail_len) -= 2;
- while(name[i] && (name[i] >= '0') && (name[i] <= '9'))
- {
- arg *= 10;
- arg += (int)(name[i]-'0');
- i++;
- (*tail_len)--;
- }
- return(arg);
+ char buf[80];
+ atom_string(binbuf_getvec(b) + indx, buf, 80);
+ *symp = gensym(buf);
}
+ else if (fallback)
+ *symp = fallback;
+ else *symp = gensym("empty");
}
- return(0);
-}
-
-void iemgui_fetch_unique(t_iemgui *iemgui)
-{
- if(!iemgui->x_unique_num)
- {
- pd_bind(&iemgui->x_glist->gl_gobj.g_pd, gensym("#X"));
- iemgui->x_unique_num = canvas_getdollarzero();
- pd_unbind(&iemgui->x_glist->gl_gobj.g_pd, gensym("#X"));
- }
-}
-
-void iemgui_fetch_parent_args(t_iemgui *iemgui, int *pargc, t_atom **pargv)
-{
- t_canvas *canvas=glist_getcanvas(iemgui->x_glist);
-
- canvas_setcurrent(canvas);
- canvas_getargs(pargc, pargv);
- canvas_unsetcurrent(canvas);
-}
-
-void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui)
-{
- iemgui->x_fsf.x_put_in2out = 1;
- if(iemgui->x_fsf.x_snd_able && iemgui->x_fsf.x_rcv_able)
- {
- if(!strcmp(iemgui->x_snd->s_name, iemgui->x_rcv->s_name))
- iemgui->x_fsf.x_put_in2out = 0;
- }
-}
-
-void iemgui_all_unique2dollarzero(t_iemgui *iemgui, t_symbol **srlsym)
-{
- iemgui_fetch_unique(iemgui);
- srlsym[0] = iemgui_unique2dollarzero(srlsym[0], iemgui->x_unique_num,
- iemgui->x_fsf.x_snd_is_unique);
- srlsym[1] = iemgui_unique2dollarzero(srlsym[1], iemgui->x_unique_num,
- iemgui->x_fsf.x_rcv_is_unique);
- srlsym[2] = iemgui_unique2dollarzero(srlsym[2], iemgui->x_unique_num,
- iemgui->x_fsf.x_lab_is_unique);
}
+ /* get the unexpanded versions of the symbols; initialize them if
+ necessary. */
void iemgui_all_sym2dollararg(t_iemgui *iemgui, t_symbol **srlsym)
{
- srlsym[0] = iemgui_sym2dollararg(srlsym[0], iemgui->x_isa.x_snd_is_arg_num,
- iemgui->x_isa.x_snd_arg_tail_len);
- srlsym[1] = iemgui_sym2dollararg(srlsym[1], iemgui->x_isa.x_rcv_is_arg_num,
- iemgui->x_isa.x_rcv_arg_tail_len);
- srlsym[2] = iemgui_sym2dollararg(srlsym[2], iemgui->x_fsf.x_lab_is_arg_num,
- iemgui->x_fsf.x_lab_arg_tail_len);
-}
-
-void iemgui_all_dollarzero2unique(t_iemgui *iemgui, t_symbol **srlsym)
-{
- iemgui_fetch_unique(iemgui);
- if(iemgui_is_dollarzero(srlsym[0]))
- {
- iemgui->x_fsf.x_snd_is_unique = 1;
- iemgui->x_isa.x_snd_is_arg_num = 0;
- iemgui->x_isa.x_snd_arg_tail_len = 0;
- srlsym[0] = iemgui_dollarzero2unique(srlsym[0], iemgui->x_unique_num);
- }
- else
- iemgui->x_fsf.x_snd_is_unique = 0;
- if(iemgui_is_dollarzero(srlsym[1]))
- {
- iemgui->x_fsf.x_rcv_is_unique = 1;
- iemgui->x_isa.x_rcv_is_arg_num = 0;
- iemgui->x_isa.x_rcv_arg_tail_len = 0;
- srlsym[1] = iemgui_dollarzero2unique(srlsym[1], iemgui->x_unique_num);
- }
- else
- iemgui->x_fsf.x_rcv_is_unique = 0;
- if(iemgui_is_dollarzero(srlsym[2]))
- {
- iemgui->x_fsf.x_lab_is_unique = 1;
- iemgui->x_fsf.x_lab_is_arg_num = 0;
- iemgui->x_fsf.x_lab_arg_tail_len = 0;
- srlsym[2] = iemgui_dollarzero2unique(srlsym[2], iemgui->x_unique_num);
- }
- else
- iemgui->x_fsf.x_lab_is_unique = 0;
-}
-
-void iemgui_all_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym)
-{
- int pargc, tail_len, nth_arg;
- t_atom *pargv;
-
- iemgui_fetch_parent_args(iemgui, &pargc, &pargv);
- if(nth_arg = iemgui_is_dollararg(srlsym[0], &tail_len))
- {
- iemgui->x_isa.x_snd_is_arg_num = nth_arg;
- iemgui->x_isa.x_snd_arg_tail_len = tail_len;
- iemgui->x_fsf.x_snd_is_unique = 0;
- srlsym[0] = iemgui_dollararg2sym(srlsym[0], nth_arg, tail_len, pargc, pargv);
- }
- else
- {
- iemgui->x_isa.x_snd_is_arg_num = 0;
- iemgui->x_isa.x_snd_arg_tail_len = 0;
- }
- if(nth_arg = iemgui_is_dollararg(srlsym[1], &tail_len))
- {
- iemgui->x_isa.x_rcv_is_arg_num = nth_arg;
- iemgui->x_isa.x_rcv_arg_tail_len = tail_len;
- iemgui->x_fsf.x_rcv_is_unique = 0;
- srlsym[1] = iemgui_dollararg2sym(srlsym[1], nth_arg, tail_len, pargc, pargv);
- }
- else
- {
- iemgui->x_isa.x_rcv_is_arg_num = 0;
- iemgui->x_isa.x_rcv_arg_tail_len = 0;
- }
- if(nth_arg = iemgui_is_dollararg(srlsym[2], &tail_len))
- {
- iemgui->x_fsf.x_lab_is_arg_num = nth_arg;
- iemgui->x_fsf.x_lab_arg_tail_len = tail_len;
- iemgui->x_fsf.x_lab_is_unique = 0;
- srlsym[2] = iemgui_dollararg2sym(srlsym[2], nth_arg, tail_len, pargc, pargv);
- }
- else
- {
- iemgui->x_fsf.x_lab_is_arg_num = 0;
- iemgui->x_fsf.x_lab_arg_tail_len = 0;
- }
+ iemgui_init_sym2dollararg(iemgui, &iemgui->x_snd_unexpanded,
+ iemgui->x_binbufindex+1, iemgui->x_snd);
+ iemgui_init_sym2dollararg(iemgui, &iemgui->x_rcv_unexpanded,
+ iemgui->x_binbufindex+2, iemgui->x_rcv);
+ iemgui_init_sym2dollararg(iemgui, &iemgui->x_lab_unexpanded,
+ iemgui->x_labelbindex, iemgui->x_lab);
+ srlsym[0] = iemgui->x_snd_unexpanded;
+ srlsym[1] = iemgui->x_rcv_unexpanded;
+ srlsym[2] = iemgui->x_lab_unexpanded;
}
void iemgui_first_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym)
{
- int pargc=0, tail_len, nth_arg;
- t_atom pargv;
- char *name;
-
- SETFLOAT(&pargv, 0.0);
- name = srlsym[0]->s_name;
- if(iemgui->x_isa.x_snd_is_arg_num && (name[0] == '$')
- && (name[1] >= '1') && (name[1] <= '9'))
- {
- srlsym[0] = iemgui_dollararg2sym(srlsym[0], iemgui->x_isa.x_snd_is_arg_num,
- iemgui->x_isa.x_snd_arg_tail_len, pargc, &pargv);
- }
- name = srlsym[1]->s_name;
- if(iemgui->x_isa.x_rcv_is_arg_num && (name[0] == '$')
- && (name[1] >= '1') && (name[1] <= '9'))
- {
- srlsym[1] = iemgui_dollararg2sym(srlsym[1], iemgui->x_isa.x_rcv_is_arg_num,
- iemgui->x_isa.x_rcv_arg_tail_len, pargc, &pargv);
- }
- name = srlsym[2]->s_name;
- if(iemgui->x_fsf.x_lab_is_arg_num && (name[0] == '$')
- && (name[1] >= '1') && (name[1] <= '9'))
- {
- srlsym[2] = iemgui_dollararg2sym(srlsym[2], iemgui->x_fsf.x_lab_is_arg_num,
- iemgui->x_fsf.x_lab_arg_tail_len, pargc, &pargv);
- }
+ /* delete this function */
}
void iemgui_all_col2save(t_iemgui *iemgui, int *bflcol)
@@ -542,31 +350,12 @@ void iemgui_send(void *x, t_iemgui *iemgui, t_symbol *s)
oldsndrcvable += IEM_GUI_OLD_SND_FLAG;
if(!strcmp(s->s_name, "empty")) sndable = 0;
- iemgui_fetch_unique(iemgui);
snd = iemgui_raute2dollar(s);
- if(iemgui_is_dollarzero(snd))
- {
- iemgui->x_fsf.x_snd_is_unique = 1;
- iemgui->x_isa.x_snd_is_arg_num = 0;
- iemgui->x_isa.x_snd_arg_tail_len = 0;
- snd = iemgui_dollarzero2unique(snd, iemgui->x_unique_num);
- }
- else
- iemgui->x_fsf.x_snd_is_unique = 0;
- iemgui_fetch_parent_args(iemgui, &pargc, &pargv);
- if(nth_arg = iemgui_is_dollararg(snd, &tail_len))
- {
- iemgui->x_isa.x_snd_is_arg_num = nth_arg;
- iemgui->x_isa.x_snd_arg_tail_len = tail_len;
- iemgui->x_fsf.x_snd_is_unique = 0;
- snd = iemgui_dollararg2sym(snd, nth_arg, tail_len, pargc, pargv);
- }
- else
- {
- iemgui->x_isa.x_snd_is_arg_num = 0;
- iemgui->x_isa.x_snd_arg_tail_len = 0;
- }
- iemgui->x_snd = snd;
+ iemgui->x_snd_unexpanded = snd;
+ iemgui->x_snd = snd = canvas_realizedollar(iemgui->x_glist, snd);
+ post("send: before %s, after %s", iemgui->x_snd_unexpanded->s_name,
+ iemgui->x_snd->s_name);
+
iemgui->x_fsf.x_snd_able = sndable;
iemgui_verify_snd_ne_rcv(iemgui);
(*iemgui->x_draw)(x, iemgui->x_glist, IEM_GUI_DRAW_MODE_IO + oldsndrcvable);
@@ -585,29 +374,8 @@ void iemgui_receive(void *x, t_iemgui *iemgui, t_symbol *s)
if(!strcmp(s->s_name, "empty")) rcvable = 0;
rcv = iemgui_raute2dollar(s);
- iemgui_fetch_unique(iemgui);
- if(iemgui_is_dollarzero(rcv))
- {
- iemgui->x_fsf.x_rcv_is_unique = 1;
- iemgui->x_isa.x_rcv_is_arg_num = 0;
- iemgui->x_isa.x_rcv_arg_tail_len = 0;
- rcv = iemgui_dollarzero2unique(rcv, iemgui->x_unique_num);
- }
- else
- iemgui->x_fsf.x_rcv_is_unique = 0;
- iemgui_fetch_parent_args(iemgui, &pargc, &pargv);
- if(nth_arg = iemgui_is_dollararg(rcv, &tail_len))
- {
- iemgui->x_isa.x_rcv_is_arg_num = nth_arg;
- iemgui->x_isa.x_rcv_arg_tail_len = tail_len;
- iemgui->x_fsf.x_rcv_is_unique = 0;
- rcv = iemgui_dollararg2sym(rcv, nth_arg, tail_len, pargc, pargv);
- }
- else
- {
- iemgui->x_isa.x_rcv_is_arg_num = 0;
- iemgui->x_isa.x_rcv_arg_tail_len = 0;
- }
+ iemgui->x_rcv_unexpanded = rcv;
+ iemgui->x_rcv = rcv = canvas_realizedollar(iemgui->x_glist, rcv);
if(rcvable)
{
if(strcmp(rcv->s_name, iemgui->x_rcv->s_name))
@@ -635,32 +403,9 @@ void iemgui_label(void *x, t_iemgui *iemgui, t_symbol *s)
t_atom *pargv;
lab = iemgui_raute2dollar(s);
- iemgui_fetch_unique(iemgui);
-
- if(iemgui_is_dollarzero(lab))
- {
- iemgui->x_fsf.x_lab_is_unique = 1;
- iemgui->x_fsf.x_lab_is_arg_num = 0;
- iemgui->x_fsf.x_lab_arg_tail_len = 0;
- lab = iemgui_dollarzero2unique(lab, iemgui->x_unique_num);
- }
- else
- iemgui->x_fsf.x_lab_is_unique = 0;
+ iemgui->x_lab_unexpanded = lab;
+ iemgui->x_lab = lab = canvas_realizedollar(iemgui->x_glist, lab);
- iemgui_fetch_parent_args(iemgui, &pargc, &pargv);
- if(nth_arg = iemgui_is_dollararg(lab, &tail_len))
- {
- iemgui->x_fsf.x_lab_is_arg_num = nth_arg;
- iemgui->x_fsf.x_lab_arg_tail_len = tail_len;
- iemgui->x_fsf.x_lab_is_unique = 0;
- lab = iemgui_dollararg2sym(lab, nth_arg, tail_len, pargc, pargv);
- }
- else
- {
- iemgui->x_fsf.x_lab_is_arg_num = 0;
- iemgui->x_fsf.x_lab_arg_tail_len = 0;
- }
- iemgui->x_lab = lab;
if(glist_isvisible(iemgui->x_glist))
sys_vgui(".x%x.c itemconfigure %xLABEL -text {%s} \n",
glist_getcanvas(iemgui->x_glist), x,
@@ -782,7 +527,6 @@ void iemgui_save(t_iemgui *iemgui, t_symbol **srl, int *bflcol)
srl[0] = iemgui->x_snd;
srl[1] = iemgui->x_rcv;
srl[2] = iemgui->x_lab;
- iemgui_all_unique2dollarzero(iemgui, srl);
iemgui_all_sym2dollararg(iemgui, srl);
iemgui_all_col2save(iemgui, bflcol);
}
@@ -792,7 +536,6 @@ void iemgui_properties(t_iemgui *iemgui, t_symbol **srl)
srl[0] = iemgui->x_snd;
srl[1] = iemgui->x_rcv;
srl[2] = iemgui->x_lab;
- iemgui_all_unique2dollarzero(iemgui, srl);
iemgui_all_sym2dollararg(iemgui, srl);
iemgui_all_dollar2raute(srl);
}
@@ -840,7 +583,6 @@ int iemgui_dialog(t_iemgui *iemgui, t_symbol **srl, int argc, t_atom *argv)
if(!strcmp(srl[0]->s_name, "empty")) sndable = 0;
if(!strcmp(srl[1]->s_name, "empty")) rcvable = 0;
iemgui_all_raute2dollar(srl);
- iemgui_all_dollarzero2unique(iemgui, srl);
iemgui_all_dollararg2sym(iemgui, srl);
if(rcvable)
{
@@ -885,74 +627,36 @@ void iem_inttosymargs(t_iem_init_symargs *symargp, int n)
{
memset(symargp, 0, sizeof(*symargp));
symargp->x_loadinit = (n >> 0);
- symargp->x_rcv_arg_tail_len = (n >> 1);
- symargp->x_snd_arg_tail_len = (n >> 7);
- symargp->x_rcv_is_arg_num = (n >> 13);
- symargp->x_snd_is_arg_num = (n >> 19);
symargp->x_scale = (n >> 20);
- symargp->x_flashed = (n >> 21);
- symargp->x_locked = (n >> 22);
- symargp->x_reverse = (n >> 23);
- symargp->dummy = (n >> 24);
+ symargp->x_flashed = 0;
+ symargp->x_locked = 0;
+ symargp->x_reverse = 0;
+ symargp->dummy = 0;
}
int iem_symargstoint(t_iem_init_symargs *symargp)
{
return (
- ((symargp->x_loadinit << 0) |
- (symargp->x_rcv_arg_tail_len << 1) |
- (symargp->x_snd_arg_tail_len << 7) |
- (symargp->x_rcv_is_arg_num << 13) |
- (symargp->x_snd_is_arg_num << 19) |
- (symargp->x_scale << 20) |
- (symargp->x_flashed << 21) |
- (symargp->x_locked << 22) |
- (symargp->x_reverse << 23) |
- (symargp->dummy << 24)) & IEM_INIT_ARGS_ALL
- );
+ (((symargp->x_loadinit & 1) << 0) |
+ ((symargp->x_scale & 1) << 20)));
}
void iem_inttofstyle(t_iem_fstyle_flags *fstylep, int n)
{
memset(fstylep, 0, sizeof(*fstylep));
fstylep->x_font_style = (n >> 0);
- fstylep->x_rcv_able = (n >> 6);
- fstylep->x_snd_able = (n >> 7);
- fstylep->x_lab_is_unique = (n >> 8);
- fstylep->x_rcv_is_unique = (n >> 9);
- fstylep->x_snd_is_unique = (n >> 10);
- fstylep->x_lab_arg_tail_len = (n >> 11);
- fstylep->x_lab_is_arg_num = (n >> 17);
- fstylep->x_shiftdown = (n >> 23);
- fstylep->x_selected = (n >> 24);
- fstylep->x_finemoved = (n >> 25);
- fstylep->x_put_in2out = (n >> 26);
- fstylep->x_change = (n >> 27);
- fstylep->x_thick = (n >> 28);
- fstylep->x_lin0_log1 = (n >> 29);
- fstylep->x_steady = (n >> 30);
- fstylep->dummy = (n >> 31);
+ fstylep->x_shiftdown = 0;
+ fstylep->x_selected = 0;
+ fstylep->x_finemoved = 0;
+ fstylep->x_put_in2out = 0;
+ fstylep->x_change = 0;
+ fstylep->x_thick = 0;
+ fstylep->x_lin0_log1 = 0;
+ fstylep->x_steady = 0;
+ fstylep->dummy = 0;
}
int iem_fstyletoint(t_iem_fstyle_flags *fstylep)
{
- return (
- ((fstylep->x_font_style << 0) |
- (fstylep->x_rcv_able << 6) |
- (fstylep->x_snd_able << 7) |
- (fstylep->x_lab_is_unique << 8) |
- (fstylep->x_rcv_is_unique << 9) |
- (fstylep->x_snd_is_unique << 10) |
- (fstylep->x_lab_arg_tail_len << 11) |
- (fstylep->x_lab_is_arg_num << 17) |
- (fstylep->x_shiftdown << 23) |
- (fstylep->x_selected << 24) |
- (fstylep->x_finemoved << 25) |
- (fstylep->x_put_in2out << 26) |
- (fstylep->x_change << 27) |
- (fstylep->x_thick << 28) |
- (fstylep->x_lin0_log1 << 29) |
- (fstylep->x_steady << 30) |
- (fstylep->dummy << 31)) & IEM_FSTYLE_FLAGS_ALL
- );
+ return ((fstylep->x_font_style << 0) & 63);
}
diff --git a/pd/src/g_all_guis.h b/pd/src/g_all_guis.h
index 91bf1753..66d79bc9 100644
--- a/pd/src/g_all_guis.h
+++ b/pd/src/g_all_guis.h
@@ -151,10 +151,14 @@ typedef struct _iemgui
int x_fcol;
int x_bcol;
int x_lcol;
- int x_unique_num;
- t_symbol *x_snd;
- t_symbol *x_rcv;
- t_symbol *x_lab;
+ t_symbol *x_snd; /* send symbol */
+ t_symbol *x_rcv; /* receive */
+ t_symbol *x_lab; /* label */
+ t_symbol *x_snd_unexpanded; /* same 3, with '$' unexpanded */
+ t_symbol *x_rcv_unexpanded;
+ t_symbol *x_lab_unexpanded;
+ int x_binbufindex; /* where in binbuf to find these */
+ int x_labelbindex; /* where in binbuf to find label */
} t_iemgui;
typedef struct _iemguidummy
@@ -289,6 +293,8 @@ EXTERN void iemgui_verify_snd_ne_rcv(t_iemgui *iemgui);
EXTERN void iemgui_all_unique2dollarzero(t_iemgui *iemgui, t_symbol **srlsym);
EXTERN void iemgui_all_sym2dollararg(t_iemgui *iemgui, t_symbol **srlsym);
EXTERN void iemgui_all_dollarzero2unique(t_iemgui *iemgui, t_symbol **srlsym);
+EXTERN t_symbol *iemgui_new_dogetname(t_iemgui *iemgui, int indx, t_atom *argv);
+EXTERN void iemgui_new_getnames(t_iemgui *iemgui, int indx, t_atom *argv);
EXTERN void iemgui_all_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym);
EXTERN void iemgui_first_dollararg2sym(t_iemgui *iemgui, t_symbol **srlsym);
EXTERN void iemgui_all_col2save(t_iemgui *iemgui, int *bflcol);
diff --git a/pd/src/g_bang.c b/pd/src/g_bang.c
index 1b1d6f4a..6e4ee5ff 100644
--- a/pd/src/g_bang.c
+++ b/pd/src/g_bang.c
@@ -432,7 +432,6 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
{
t_bng *x = (t_bng *)pd_new(bng_class);
int bflcol[]={-262144, -1, -1};
- t_symbol *srl[3];
int a=IEM_GUI_DEFAULTSIZE;
int ldx=0, ldy=-6;
int fs=8;
@@ -442,9 +441,6 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
iem_inttosymargs(&x->x_gui.x_isa, 0);
iem_inttofstyle(&x->x_gui.x_fsf, 0);
- srl[0] = gensym("empty");
- srl[1] = gensym("empty");
- srl[2] = gensym("empty");
if((argc == 14)&&IS_A_FLOAT(argv,0)
&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2)
@@ -461,27 +457,7 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
fthold = (int)atom_getintarg(1, argc, argv);
ftbreak = (int)atom_getintarg(2, argc, argv);
iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(3, argc, argv));
- if(IS_A_SYMBOL(argv,4))
- srl[0] = atom_getsymbolarg(4, argc, argv);
- else if(IS_A_FLOAT(argv,4))
- {
- sprintf(str, "%d", (int)atom_getintarg(4, argc, argv));
- srl[0] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,5))
- srl[1] = atom_getsymbolarg(5, argc, argv);
- else if(IS_A_FLOAT(argv,5))
- {
- sprintf(str, "%d", (int)atom_getintarg(5, argc, argv));
- srl[1] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,6))
- srl[2] = atom_getsymbolarg(6, argc, argv);
- else if(IS_A_FLOAT(argv,6))
- {
- sprintf(str, "%d", (int)atom_getintarg(6, argc, argv));
- srl[2] = gensym(str);
- }
+ iemgui_new_getnames(&x->x_gui, 4, argv);
ldx = (int)atom_getintarg(7, argc, argv);
ldy = (int)atom_getintarg(8, argc, argv);
iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(9, argc, argv));
@@ -490,6 +466,7 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
bflcol[1] = (int)atom_getintarg(12, argc, argv);
bflcol[2] = (int)atom_getintarg(13, argc, argv);
}
+ else iemgui_new_getnames(&x->x_gui, 4, 0);
x->x_gui.x_draw = (t_iemfunptr)bng_draw;
@@ -497,19 +474,17 @@ static void *bng_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.x_fsf.x_rcv_able = 1;
x->x_flashed = 0;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
- x->x_gui.x_unique_num = 0;
+ if (!strcmp(x->x_gui.x_snd->s_name, "empty"))
+ x->x_gui.x_fsf.x_snd_able = 0;
+ if (!strcmp(x->x_gui.x_rcv->s_name, "empty"))
+ x->x_gui.x_fsf.x_rcv_able = 0;
if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- iemgui_first_dollararg2sym(&x->x_gui, srl);
- if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
- x->x_gui.x_snd = srl[0];
- x->x_gui.x_rcv = srl[1];
- x->x_gui.x_lab = srl[2];
+ if (x->x_gui.x_fsf.x_rcv_able)
+ pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
diff --git a/pd/src/g_canvas.c b/pd/src/g_canvas.c
index aee25c77..980db26e 100644
--- a/pd/src/g_canvas.c
+++ b/pd/src/g_canvas.c
@@ -1028,11 +1028,12 @@ void canvas_loadbang(t_canvas *x)
/* When you ask a canvas its size the result is 2 pixels more than what
you gave it to open it; perhaps there's a 1-pixel border all around it
- or something. Anyway, we just add the 2 pixels back here: */
+ 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 2
-#define VERTBORDER 2
+#define HORIZBORDER 0
+#define VERTBORDER 0
#else
#define HORIZBORDER 2
#define VERTBORDER 2
@@ -1301,8 +1302,8 @@ void glob_dsp(void *dummy, t_symbol *s, int argc, t_atom *argv)
newstate = atom_getintarg(0, argc, argv);
if (newstate && !canvas_dspstate)
{
- canvas_start_dsp();
sys_set_audio_state(1);
+ canvas_start_dsp();
}
else if (!newstate && canvas_dspstate)
{
diff --git a/pd/src/g_hdial.c b/pd/src/g_hdial.c
index f7267c99..79c87aeb 100644
--- a/pd/src/g_hdial.c
+++ b/pd/src/g_hdial.c
@@ -539,7 +539,6 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
{
t_hradio *x = (t_hradio *)pd_new(old? hradio_old_class : hradio_class);
int bflcol[]={-262144, -1, -1};
- t_symbol *srl[3];
int a=IEM_GUI_DEFAULTSIZE, on=0, f=0;
int ldx=0, ldy=-6, chg=1, num=8;
int fs=8;
@@ -548,9 +547,6 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
iem_inttosymargs(&x->x_gui.x_isa, 0);
iem_inttofstyle(&x->x_gui.x_fsf, 0);
- srl[0] = gensym("empty");
- srl[1] = gensym("empty");
- srl[2] = gensym("empty");
if((argc == 15)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2)
&&IS_A_FLOAT(argv,3)
@@ -565,27 +561,7 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
chg = (int)atom_getintarg(1, argc, argv);
iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(2, argc, argv));
num = (int)atom_getintarg(3, argc, argv);
- if(IS_A_SYMBOL(argv,4))
- srl[0] = atom_getsymbolarg(4, argc, argv);
- else if(IS_A_FLOAT(argv,4))
- {
- sprintf(str, "%d", (int)atom_getintarg(4, argc, argv));
- srl[0] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,5))
- srl[1] = atom_getsymbolarg(5, argc, argv);
- else if(IS_A_FLOAT(argv,5))
- {
- sprintf(str, "%d", (int)atom_getintarg(5, argc, argv));
- srl[1] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,6))
- srl[2] = atom_getsymbolarg(6, argc, argv);
- else if(IS_A_FLOAT(argv,6))
- {
- sprintf(str, "%d", (int)atom_getintarg(6, argc, argv));
- srl[2] = gensym(str);
- }
+ iemgui_new_getnames(&x->x_gui, 4, argv);
ldx = (int)atom_getintarg(7, argc, argv);
ldy = (int)atom_getintarg(8, argc, argv);
iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(9, argc, argv));
@@ -595,17 +571,19 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
bflcol[2] = (int)atom_getintarg(13, argc, argv);
on = (int)atom_getintarg(14, argc, argv);
}
+ else iemgui_new_getnames(&x->x_gui, 4, 0);
x->x_gui.x_draw = (t_iemfunptr)hradio_draw;
x->x_gui.x_fsf.x_snd_able = 1;
x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
+ if (!strcmp(x->x_gui.x_snd->s_name, "empty"))
+ x->x_gui.x_fsf.x_snd_able = 0;
+ if (!strcmp(x->x_gui.x_rcv->s_name, "empty"))
+ x->x_gui.x_fsf.x_rcv_able = 0;
if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- x->x_gui.x_unique_num = 0;
if(num < 1)
num = 1;
if(num > IEM_RADIO_MAX)
@@ -621,11 +599,8 @@ static void *hradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
x->x_on = 0;
x->x_on_old = x->x_on;
x->x_change = (chg==0)?0:1;
- iemgui_first_dollararg2sym(&x->x_gui, srl);
- if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
- x->x_gui.x_snd = srl[0];
- x->x_gui.x_rcv = srl[1];
- x->x_gui.x_lab = srl[2];
+ if (x->x_gui.x_fsf.x_rcv_able)
+ pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
if(fs < 4)
diff --git a/pd/src/g_hslider.c b/pd/src/g_hslider.c
index a805e7dd..57c60cff 100644
--- a/pd/src/g_hslider.c
+++ b/pd/src/g_hslider.c
@@ -524,7 +524,6 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
{
t_hslider *x = (t_hslider *)pd_new(hslider_class);
int bflcol[]={-262144, -1, -1};
- t_symbol *srl[3];
int w=IEM_SL_DEFAULTSIZE, h=IEM_GUI_DEFAULTSIZE;
int lilo=0, ldx=-2, ldy=-6, f=0, v=0, steady=1;
int fs=8;
@@ -533,9 +532,6 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
iem_inttosymargs(&x->x_gui.x_isa, 0);
iem_inttofstyle(&x->x_gui.x_fsf, 0);
- srl[0] = gensym("empty");
- srl[1] = gensym("empty");
- srl[2] = gensym("empty");
if(((argc == 17)||(argc == 18))&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)
&&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3)
@@ -553,27 +549,7 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
max = (double)atom_getfloatarg(3, argc, argv);
lilo = (int)atom_getintarg(4, argc, argv);
iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(5, argc, argv));
- if(IS_A_SYMBOL(argv,6))
- srl[0] = atom_getsymbolarg(6, argc, argv);
- else if(IS_A_FLOAT(argv,6))
- {
- sprintf(str, "%d", (int)atom_getintarg(6, argc, argv));
- srl[0] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,7))
- srl[1] = atom_getsymbolarg(7, argc, argv);
- else if(IS_A_FLOAT(argv,7))
- {
- sprintf(str, "%d", (int)atom_getintarg(7, argc, argv));
- srl[1] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,8))
- srl[2] = atom_getsymbolarg(8, argc, argv);
- else if(IS_A_FLOAT(argv,8))
- {
- sprintf(str, "%d", (int)atom_getintarg(8, argc, argv));
- srl[2] = gensym(str);
- }
+ iemgui_new_getnames(&x->x_gui, 6, argv);
ldx = (int)atom_getintarg(9, argc, argv);
ldy = (int)atom_getintarg(10, argc, argv);
iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(11, argc, argv));
@@ -583,6 +559,7 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
bflcol[2] = (int)atom_getintarg(15, argc, argv);
v = (int)atom_getintarg(16, argc, argv);
}
+ else iemgui_new_getnames(&x->x_gui, 6, 0);
if((argc == 18)&&IS_A_FLOAT(argv,17))
steady = (int)atom_getintarg(17, argc, argv);
@@ -601,18 +578,16 @@ static void *hslider_new(t_symbol *s, int argc, t_atom *argv)
x->x_lin0_log1 = lilo;
if(steady != 0) steady = 1;
x->x_steady = steady;
- if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
- x->x_gui.x_unique_num = 0;
+ if (!strcmp(x->x_gui.x_snd->s_name, "empty"))
+ x->x_gui.x_fsf.x_snd_able = 0;
+ if (!strcmp(x->x_gui.x_rcv->s_name, "empty"))
+ x->x_gui.x_fsf.x_rcv_able = 0;
if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- iemgui_first_dollararg2sym(&x->x_gui, srl);
- if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
- x->x_gui.x_snd = srl[0];
- x->x_gui.x_rcv = srl[1];
- x->x_gui.x_lab = srl[2];
+ if(x->x_gui.x_fsf.x_rcv_able)
+ pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
if(fs < 4)
diff --git a/pd/src/g_mycanvas.c b/pd/src/g_mycanvas.c
index 54e0ef07..ff55e86b 100644
--- a/pd/src/g_mycanvas.c
+++ b/pd/src/g_mycanvas.c
@@ -261,7 +261,6 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
{
t_my_canvas *x = (t_my_canvas *)pd_new(my_canvas_class);
int bflcol[]={-233017, -1, -66577};
- t_symbol *srl[3];
int a=IEM_GUI_DEFAULTSIZE, w=100, h=60;
int ldx=20, ldy=12, f=2, i=0;
int fs=14;
@@ -269,9 +268,6 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
iem_inttosymargs(&x->x_gui.x_isa, 0);
iem_inttofstyle(&x->x_gui.x_fsf, 0);
- srl[0] = gensym("empty");
- srl[1] = gensym("empty");
- srl[2] = gensym("empty");
if(((argc >= 10)&&(argc <= 13))
&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2))
@@ -283,32 +279,14 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
if((argc >= 12)&&(IS_A_SYMBOL(argv,3)||IS_A_FLOAT(argv,3))&&(IS_A_SYMBOL(argv,4)||IS_A_FLOAT(argv,4)))
{
i = 2;
- if(IS_A_SYMBOL(argv,3))
- srl[0] = atom_getsymbolarg(3, argc, argv);
- else if(IS_A_FLOAT(argv,3))
- {
- sprintf(str, "%d", (int)atom_getintarg(3, argc, argv));
- srl[0] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,4))
- srl[1] = atom_getsymbolarg(4, argc, argv);
- else if(IS_A_FLOAT(argv,4))
- {
- sprintf(str, "%d", (int)atom_getintarg(4, argc, argv));
- srl[1] = gensym(str);
- }
+ iemgui_new_getnames(&x->x_gui, 3, argv);
}
else if((argc == 11)&&(IS_A_SYMBOL(argv,3)||IS_A_FLOAT(argv,3)))
{
i = 1;
- if(IS_A_SYMBOL(argv,3))
- srl[1] = atom_getsymbolarg(3, argc, argv);
- else if(IS_A_FLOAT(argv,3))
- {
- sprintf(str, "%d", (int)atom_getintarg(3, argc, argv));
- srl[1] = gensym(str);
- }
+ iemgui_new_getnames(&x->x_gui, 3, argv);
}
+ else iemgui_new_getnames(&x->x_gui, 3, 0);
if(((argc >= 10)&&(argc <= 13))
&&(IS_A_SYMBOL(argv,i+3)||IS_A_FLOAT(argv,i+3))&&IS_A_FLOAT(argv,i+4)
@@ -336,9 +314,10 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.x_fsf.x_snd_able = 1;
x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
- x->x_gui.x_unique_num = 0;
+ if (!strcmp(x->x_gui.x_snd->s_name, "empty"))
+ x->x_gui.x_fsf.x_snd_able = 0;
+ if (!strcmp(x->x_gui.x_rcv->s_name, "empty"))
+ x->x_gui.x_fsf.x_rcv_able = 0;
if(a < 1)
a = 1;
x->x_gui.x_w = a;
@@ -353,11 +332,8 @@ static void *my_canvas_new(t_symbol *s, int argc, t_atom *argv)
else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- iemgui_first_dollararg2sym(&x->x_gui, srl);
- if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
- x->x_gui.x_snd = srl[0];
- x->x_gui.x_rcv = srl[1];
- x->x_gui.x_lab = srl[2];
+ if (x->x_gui.x_fsf.x_rcv_able)
+ pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
if(fs < 4)
diff --git a/pd/src/g_numbox.c b/pd/src/g_numbox.c
index f6288128..9fc7091b 100644
--- a/pd/src/g_numbox.c
+++ b/pd/src/g_numbox.c
@@ -753,7 +753,6 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
{
t_my_numbox *x = (t_my_numbox *)pd_new(my_numbox_class);
int bflcol[]={-262144, -1, -1};
- t_symbol *srl[3];
int w=5, h=14;
int lilo=0, f=0, ldx=0, ldy=-6;
int fs=10;
@@ -761,11 +760,6 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
double min=-1.0e+37, max=1.0e+37,v=0.0;
char str[144];
- srl[0] = gensym("empty");
- srl[1] = gensym("empty");
- srl[2] = gensym("empty");
-
-
if((argc >= 17)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)
&&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3)
&&IS_A_FLOAT(argv,4)&&IS_A_FLOAT(argv,5)
@@ -782,30 +776,7 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
max = (double)atom_getfloatarg(3, argc, argv);
lilo = (int)atom_getintarg(4, argc, argv);
iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(5, argc, argv));
- srl[0] = atom_getsymbolarg(6, argc, argv);
- srl[1] = atom_getsymbolarg(7, argc, argv);
- srl[2] = atom_getsymbolarg(8, argc, argv);
- if(IS_A_SYMBOL(argv,6))
- srl[0] = atom_getsymbolarg(6, argc, argv);
- else if(IS_A_FLOAT(argv,6))
- {
- sprintf(str, "%d", (int)atom_getintarg(6, argc, argv));
- srl[0] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,7))
- srl[1] = atom_getsymbolarg(7, argc, argv);
- else if(IS_A_FLOAT(argv,7))
- {
- sprintf(str, "%d", (int)atom_getintarg(7, argc, argv));
- srl[1] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,8))
- srl[2] = atom_getsymbolarg(8, argc, argv);
- else if(IS_A_FLOAT(argv,8))
- {
- sprintf(str, "%d", (int)atom_getintarg(8, argc, argv));
- srl[2] = gensym(str);
- }
+ iemgui_new_getnames(&x->x_gui, 6, argv);
ldx = (int)atom_getintarg(9, argc, argv);
ldy = (int)atom_getintarg(10, argc, argv);
iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(11, argc, argv));
@@ -815,6 +786,7 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
bflcol[2] = (int)atom_getintarg(15, argc, argv);
v = atom_getfloatarg(16, argc, argv);
}
+ else iemgui_new_getnames(&x->x_gui, 6, 0);
if((argc == 18)&&IS_A_FLOAT(argv,17))
{
log_height = (int)atom_getintarg(17, argc, argv);
@@ -832,18 +804,16 @@ static void *my_numbox_new(t_symbol *s, int argc, t_atom *argv)
if(log_height < 10)
log_height = 10;
x->x_log_height = log_height;
- if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
- x->x_gui.x_unique_num = 0;
+ if (!strcmp(x->x_gui.x_snd->s_name, "empty"))
+ x->x_gui.x_fsf.x_snd_able = 0;
+ if (!strcmp(x->x_gui.x_rcv->s_name, "empty"))
+ x->x_gui.x_fsf.x_rcv_able = 0;
if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- iemgui_first_dollararg2sym(&x->x_gui, srl);
- if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
- x->x_gui.x_snd = srl[0];
- x->x_gui.x_rcv = srl[1];
- x->x_gui.x_lab = srl[2];
+ if (x->x_gui.x_fsf.x_rcv_able)
+ pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
if(fs < 4)
diff --git a/pd/src/g_rtext.c b/pd/src/g_rtext.c
index aeeb5dfd..d44f30fa 100644
--- a/pd/src/g_rtext.c
+++ b/pd/src/g_rtext.c
@@ -137,6 +137,11 @@ static int lastone(char *s, int c, int n)
#define UPBUFSIZE 4000
#define BOXWIDTH 60
+/* Older (pre-8.3.4) TCL versions handle text selection differently; this
+flag is set from the GUI if this happens. LATER take this out: early 2006? */
+
+extern int sys_oldtclversion;
+
static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
int *indexp)
{
@@ -229,13 +234,7 @@ static void rtext_senditup(t_rtext *x, int action, int *widthp, int *heightp,
sys_vgui(".x%x.c select from %s %d\n", canvas,
x->x_tag, x->x_selstart);
sys_vgui(".x%x.c select to %s %d\n", canvas,
- x->x_tag, x->x_selend
-#if defined (MSW) || defined(MACOSX)
- /* Why is linux selecting text differently from MSW and OSX???
- Just adjust it here... LATER revisit this one */
- -1
-#endif
- );
+ x->x_tag, x->x_selend + (sys_oldtclversion ? 0 : -1));
sys_vgui(".x%x.c focus \"\"\n", canvas);
}
else
diff --git a/pd/src/g_scalar.c b/pd/src/g_scalar.c
index 538ca246..63b42b4f 100644
--- a/pd/src/g_scalar.c
+++ b/pd/src/g_scalar.c
@@ -174,24 +174,36 @@ static void scalar_getrect(t_gobj *z, t_glist *owner,
t_gobj *y;
float basex, basey;
scalar_getbasexy(x, &basex, &basey);
- for (y = templatecanvas->gl_list; y; y = y->g_next)
+ /* if someone deleted the template canvas, we're just a point */
+ if (!templatecanvas)
{
- t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
- int nx1, ny1, nx2, ny2;
- if (!wb) continue;
- (*wb->w_parentgetrectfn)(y, owner,
- x->sc_vec, template, basex, basey,
- &nx1, &ny1, &nx2, &ny2);
- if (hit)
+ x1 = x2 = glist_xtopixels(owner, basex);
+ y1 = y2 = glist_ytopixels(owner, basey);
+ }
+ else
+ {
+ int hit = 0;
+ x1 = y1 = 0x7fffffff;
+ x2 = y2 = -0x7fffffff;
+ for (y = templatecanvas->gl_list; y; y = y->g_next)
{
- if (nx1 < x1) x1 = nx1;
- if (ny1 < y1) y1 = ny1;
- if (nx2 > x2) x2 = nx2;
- if (ny2 > y2) y2 = ny2;
+ t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
+ int nx1, ny1, nx2, ny2;
+ if (!wb) continue;
+ (*wb->w_parentgetrectfn)(y, owner,
+ x->sc_vec, template, basex, basey,
+ &nx1, &ny1, &nx2, &ny2);
+ if (hit)
+ {
+ if (nx1 < x1) x1 = nx1;
+ if (ny1 < y1) y1 = ny1;
+ if (nx2 > x2) x2 = nx2;
+ if (ny2 > y2) y2 = ny2;
+ }
+ else x1 = nx1, y1 = ny1, x2 = nx2, y2 = ny2, hit = 1;
}
- else x1 = nx1, y1 = ny1, x2 = nx2, y2 = ny2, hit = 1;
+ if (!hit) x1 = y1 = x2 = y2 = 0;
}
- if (!hit) x1 = y1 = x2 = y2 = 0;
/* post("scalar x1 %d y1 %d x2 %d y2 %d", x1, y1, x2, y2); */
*xp1 = x1;
*yp1 = y1;
@@ -208,6 +220,7 @@ static void scalar_select(t_gobj *z, t_glist *owner, int state)
{
int x1, y1, x2, y2;
scalar_getrect(z, owner, &x1, &y1, &x2, &y2);
+ x1--; x2++; y1--; y2++;
sys_vgui(".x%x.c create line %d %d %d %d %d %d %d %d %d %d \
-width 0 -fill blue -tags select%x\n",
glist_getcanvas(owner), x1, y1, x1, y2, x2, y2, x2, y1, x1, y1,
@@ -266,12 +279,20 @@ static void scalar_vis(t_gobj *z, t_glist *owner, int vis)
t_canvas *templatecanvas = template_findcanvas(template);
t_gobj *y;
float basex, basey;
+ scalar_getbasexy(x, &basex, &basey);
+ /* if we don't know how to draw it, make a small rectangle */
if (!templatecanvas)
{
- bug("scalar_vis"); /* it's still a bug, have to fix this for real... */
- return; /* proposed by Krzysztof Czaja to avoid crashing */
+ if (vis)
+ {
+ int x1 = glist_xtopixels(owner, basex);
+ int y1 = glist_ytopixels(owner, basey);
+ sys_vgui(".x%x.c create rectangle %d %d %d %d -tags scalar%x\n",
+ glist_getcanvas(owner), x1-1, y1-1, x1+1, y1+1, x);
+ }
+ else sys_vgui(".x%x.c delete scalar%x\n", glist_getcanvas(owner), x);
+ return;
}
- scalar_getbasexy(x, &basex, &basey);
for (y = templatecanvas->gl_list; y; y = y->g_next)
{
@@ -330,7 +351,7 @@ static void scalar_properties(t_gobj *z, struct _glist *owner)
b = glist_writetobinbuf(owner, 0);
binbuf_gettext(b, &buf, &bufsize);
binbuf_free(b);
- t_resizebytes(buf, bufsize, bufsize+1);
+ buf = t_resizebytes(buf, bufsize, bufsize+1);
buf[bufsize] = 0;
sprintf(buf2, "pdtk_data_dialog %%s {");
gfxstub_new((t_pd *)owner, x, buf2);
diff --git a/pd/src/g_template.c b/pd/src/g_template.c
index 1695079b..52901460 100644
--- a/pd/src/g_template.c
+++ b/pd/src/g_template.c
@@ -608,10 +608,10 @@ static void *gtemplate_new_old(t_symbol *s, int argc, t_atom *argv)
static int warned;
if (!warned)
{
- post("warning -- 'template' is obsolete; replace with 'struct'");
+ post("warning -- 'template' (%s) is obsolete; replace with 'struct'",
+ sym->s_name);
warned = 1;
}
- post("name: %s", sym->s_name);
return (gtemplate_donew(sym, argc, argv));
}
diff --git a/pd/src/g_toggle.c b/pd/src/g_toggle.c
index c6077b89..5369e468 100644
--- a/pd/src/g_toggle.c
+++ b/pd/src/g_toggle.c
@@ -362,7 +362,6 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
{
t_toggle *x = (t_toggle *)pd_new(toggle_class);
int bflcol[]={-262144, -1, -1};
- t_symbol *srl[3];
int a=IEM_GUI_DEFAULTSIZE, f=0;
int ldx=0, ldy=-6;
int fs=8;
@@ -371,9 +370,6 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
iem_inttosymargs(&x->x_gui.x_isa, 0);
iem_inttofstyle(&x->x_gui.x_fsf, 0);
- srl[0] = gensym("empty");
- srl[1] = gensym("empty");
- srl[2] = gensym("empty");
if(((argc == 13)||(argc == 14))&&IS_A_FLOAT(argv,0)
&&IS_A_FLOAT(argv,1)
@@ -386,27 +382,7 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
{
a = (int)atom_getintarg(0, argc, argv);
iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(1, argc, argv));
- if(IS_A_SYMBOL(argv,2))
- srl[0] = atom_getsymbolarg(2, argc, argv);
- else if(IS_A_FLOAT(argv,2))
- {
- sprintf(str, "%d", (int)atom_getintarg(2, argc, argv));
- srl[0] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,3))
- srl[1] = atom_getsymbolarg(3, argc, argv);
- else if(IS_A_FLOAT(argv,3))
- {
- sprintf(str, "%d", (int)atom_getintarg(3, argc, argv));
- srl[1] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,4))
- srl[2] = atom_getsymbolarg(4, argc, argv);
- else if(IS_A_FLOAT(argv,4))
- {
- sprintf(str, "%d", (int)atom_getintarg(4, argc, argv));
- srl[2] = gensym(str);
- }
+ iemgui_new_getnames(&x->x_gui, 2, argv);
ldx = (int)atom_getintarg(5, argc, argv);
ldy = (int)atom_getintarg(6, argc, argv);
iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(7, argc, argv));
@@ -416,6 +392,7 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
bflcol[2] = (int)atom_getintarg(11, argc, argv);
on = (float)atom_getfloatarg(12, argc, argv);
}
+ else iemgui_new_getnames(&x->x_gui, 2, 0);
if((argc == 14)&&IS_A_FLOAT(argv,13))
nonzero = (float)atom_getfloatarg(13, argc, argv);
x->x_gui.x_draw = (t_iemfunptr)toggle_draw;
@@ -423,9 +400,10 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.x_fsf.x_snd_able = 1;
x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
- x->x_gui.x_unique_num = 0;
+ if (!strcmp(x->x_gui.x_snd->s_name, "empty"))
+ x->x_gui.x_fsf.x_snd_able = 0;
+ if (!strcmp(x->x_gui.x_rcv->s_name, "empty"))
+ x->x_gui.x_fsf.x_rcv_able = 0;
if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
else { x->x_gui.x_fsf.x_font_style = 0;
@@ -435,11 +413,8 @@ static void *toggle_new(t_symbol *s, int argc, t_atom *argv)
x->x_on = (on!=0.0)?nonzero:0.0;
else
x->x_on = 0.0;
- iemgui_first_dollararg2sym(&x->x_gui, srl);
- if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
- x->x_gui.x_snd = srl[0];
- x->x_gui.x_rcv = srl[1];
- x->x_gui.x_lab = srl[2];
+ if (x->x_gui.x_fsf.x_rcv_able)
+ pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
diff --git a/pd/src/g_vdial.c b/pd/src/g_vdial.c
index be3956b5..8b9e210b 100644
--- a/pd/src/g_vdial.c
+++ b/pd/src/g_vdial.c
@@ -542,18 +542,12 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
{
t_vradio *x = (t_vradio *)pd_new(old? vradio_old_class : vradio_class);
int bflcol[]={-262144, -1, -1};
- t_symbol *srl[3];
int a=IEM_GUI_DEFAULTSIZE, on=0, f=0;
int ldx=0, ldy=-6, chg=1, num=8;
int fs=8;
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
char str[144];
- /* post("new %s %d", s->s_name, old); */
- srl[0] = gensym("empty");
- srl[1] = gensym("empty");
- srl[2] = gensym("empty");
-
if((argc == 15)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)&&IS_A_FLOAT(argv,2)
&&IS_A_FLOAT(argv,3)
&&(IS_A_SYMBOL(argv,4)||IS_A_FLOAT(argv,4))
@@ -567,27 +561,7 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
chg = (int)atom_getintarg(1, argc, argv);
iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(2, argc, argv));
num = (int)atom_getintarg(3, argc, argv);
- if(IS_A_SYMBOL(argv,4))
- srl[0] = atom_getsymbolarg(4, argc, argv);
- else if(IS_A_FLOAT(argv,4))
- {
- sprintf(str, "%d", (int)atom_getintarg(4, argc, argv));
- srl[0] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,5))
- srl[1] = atom_getsymbolarg(5, argc, argv);
- else if(IS_A_FLOAT(argv,5))
- {
- sprintf(str, "%d", (int)atom_getintarg(5, argc, argv));
- srl[1] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,6))
- srl[2] = atom_getsymbolarg(6, argc, argv);
- else if(IS_A_FLOAT(argv,6))
- {
- sprintf(str, "%d", (int)atom_getintarg(6, argc, argv));
- srl[2] = gensym(str);
- }
+ iemgui_new_getnames(&x->x_gui, 4, argv);
ldx = (int)atom_getintarg(7, argc, argv);
ldy = (int)atom_getintarg(8, argc, argv);
iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(9, argc, argv));
@@ -597,17 +571,19 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
bflcol[2] = (int)atom_getintarg(13, argc, argv);
on = (int)atom_getintarg(14, argc, argv);
}
+ else iemgui_new_getnames(&x->x_gui, 4, 0);
x->x_gui.x_draw = (t_iemfunptr)vradio_draw;
x->x_gui.x_fsf.x_snd_able = 1;
x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
+ if (!strcmp(x->x_gui.x_snd->s_name, "empty"))
+ x->x_gui.x_fsf.x_snd_able = 0;
+ if (!strcmp(x->x_gui.x_rcv->s_name, "empty"))
+ x->x_gui.x_fsf.x_rcv_able = 0;
if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- x->x_gui.x_unique_num = 0;
if(num < 1)
num = 1;
if(num > IEM_RADIO_MAX)
@@ -623,11 +599,8 @@ static void *vradio_donew(t_symbol *s, int argc, t_atom *argv, int old)
x->x_on = 0;
x->x_on_old = x->x_on;
x->x_change = (chg==0)?0:1;
- iemgui_first_dollararg2sym(&x->x_gui, srl);
- if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
- x->x_gui.x_snd = srl[0];
- x->x_gui.x_rcv = srl[1];
- x->x_gui.x_lab = srl[2];
+ if (x->x_gui.x_fsf.x_rcv_able)
+ pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
if(fs < 4)
diff --git a/pd/src/g_vslider.c b/pd/src/g_vslider.c
index 25522af3..add8388f 100644
--- a/pd/src/g_vslider.c
+++ b/pd/src/g_vslider.c
@@ -505,7 +505,6 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
{
t_vslider *x = (t_vslider *)pd_new(vslider_class);
int bflcol[]={-262144, -1, -1};
- t_symbol *srl[3];
int w=IEM_GUI_DEFAULTSIZE, h=IEM_SL_DEFAULTSIZE;
int lilo=0, f=0, ldx=0, ldy=-8;
int fs=8, v=0, steady=1;
@@ -514,10 +513,6 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
iem_inttosymargs(&x->x_gui.x_isa, 0);
iem_inttofstyle(&x->x_gui.x_fsf, 0);
- srl[0] = gensym("empty");
- srl[1] = gensym("empty");
- srl[2] = gensym("empty");
-
if(((argc == 17)||(argc == 18))&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)
&&IS_A_FLOAT(argv,2)&&IS_A_FLOAT(argv,3)
@@ -535,30 +530,7 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
max = (double)atom_getfloatarg(3, argc, argv);
lilo = (int)atom_getintarg(4, argc, argv);
iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(5, argc, argv));
- srl[0] = atom_getsymbolarg(6, argc, argv);
- srl[1] = atom_getsymbolarg(7, argc, argv);
- srl[2] = atom_getsymbolarg(8, argc, argv);
- if(IS_A_SYMBOL(argv,6))
- srl[0] = atom_getsymbolarg(6, argc, argv);
- else if(IS_A_FLOAT(argv,6))
- {
- sprintf(str, "%d", (int)atom_getintarg(6, argc, argv));
- srl[0] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,7))
- srl[1] = atom_getsymbolarg(7, argc, argv);
- else if(IS_A_FLOAT(argv,7))
- {
- sprintf(str, "%d", (int)atom_getintarg(7, argc, argv));
- srl[1] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,8))
- srl[2] = atom_getsymbolarg(8, argc, argv);
- else if(IS_A_FLOAT(argv,8))
- {
- sprintf(str, "%d", (int)atom_getintarg(8, argc, argv));
- srl[2] = gensym(str);
- }
+ iemgui_new_getnames(&x->x_gui, 6, argv);
ldx = (int)atom_getintarg(9, argc, argv);
ldy = (int)atom_getintarg(10, argc, argv);
iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(11, argc, argv));
@@ -568,6 +540,7 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
bflcol[2] = (int)atom_getintarg(15, argc, argv);
v = (int)atom_getintarg(16, argc, argv);
}
+ else iemgui_new_getnames(&x->x_gui, 6, 0);
if((argc == 18)&&IS_A_FLOAT(argv,17))
steady = (int)atom_getintarg(17, argc, argv);
x->x_gui.x_draw = (t_iemfunptr)vslider_draw;
@@ -583,18 +556,13 @@ static void *vslider_new(t_symbol *s, int argc, t_atom *argv)
x->x_lin0_log1 = lilo;
if(steady != 0) steady = 1;
x->x_steady = steady;
- if(!strcmp(srl[0]->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
- if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
- x->x_gui.x_unique_num = 0;
+ if(!strcmp(x->x_gui.x_snd->s_name, "empty")) x->x_gui.x_fsf.x_snd_able = 0;
+ if(!strcmp(x->x_gui.x_rcv->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- iemgui_first_dollararg2sym(&x->x_gui, srl);
- if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
- x->x_gui.x_snd = srl[0];
- x->x_gui.x_rcv = srl[1];
- x->x_gui.x_lab = srl[2];
+ if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
if(fs < 4)
diff --git a/pd/src/g_vumeter.c b/pd/src/g_vumeter.c
index dcb95b04..2f77c958 100644
--- a/pd/src/g_vumeter.c
+++ b/pd/src/g_vumeter.c
@@ -607,7 +607,6 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
{
t_vu *x = (t_vu *)pd_new(vu_class);
int bflcol[]={-66577, -1, -1};
- t_symbol *srl[3];
int w=IEM_GUI_DEFAULTSIZE, h=IEM_VU_STEPS*IEM_VU_DEFAULTSIZE;
int ldx=-1, ldy=-8, f=0, fs=8, scale=1;
int ftbreak=IEM_BNG_DEFAULTBREAKFLASHTIME, fthold=IEM_BNG_DEFAULTHOLDFLASHTIME;
@@ -615,9 +614,6 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
iem_inttosymargs(&x->x_gui.x_isa, 0);
iem_inttofstyle(&x->x_gui.x_fsf, 0);
- srl[0] = gensym("empty");
- srl[1] = gensym("empty");
- srl[2] = gensym("empty");
if((argc >= 11)&&IS_A_FLOAT(argv,0)&&IS_A_FLOAT(argv,1)
&&(IS_A_SYMBOL(argv,2)||IS_A_FLOAT(argv,2))
@@ -628,20 +624,7 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
{
w = (int)atom_getintarg(0, argc, argv);
h = (int)atom_getintarg(1, argc, argv);
- if(IS_A_SYMBOL(argv,2))
- srl[1] = atom_getsymbolarg(2, argc, argv);
- else if(IS_A_FLOAT(argv,2))
- {
- sprintf(str, "%d", (int)atom_getintarg(2, argc, argv));
- srl[1] = gensym(str);
- }
- if(IS_A_SYMBOL(argv,3))
- srl[2] = atom_getsymbolarg(3, argc, argv);
- else if(IS_A_FLOAT(argv,3))
- {
- sprintf(str, "%d", (int)atom_getintarg(3, argc, argv));
- srl[2] = gensym(str);
- }
+ iemgui_new_getnames(&x->x_gui, 1, argv);
ldx = (int)atom_getintarg(4, argc, argv);
ldy = (int)atom_getintarg(5, argc, argv);
iem_inttofstyle(&x->x_gui.x_fsf, atom_getintarg(6, argc, argv));
@@ -650,6 +633,7 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
bflcol[2] = (int)atom_getintarg(9, argc, argv);
scale = (int)atom_getintarg(10, argc, argv);
}
+ else iemgui_new_getnames(&x->x_gui, 1, 0);
if((argc == 12)&&IS_A_FLOAT(argv,11))
iem_inttosymargs(&x->x_gui.x_isa, atom_getintarg(11, argc, argv));
x->x_gui.x_draw = (t_iemfunptr)vu_draw;
@@ -657,17 +641,16 @@ static void *vu_new(t_symbol *s, int argc, t_atom *argv)
x->x_gui.x_fsf.x_snd_able = 0;
x->x_gui.x_fsf.x_rcv_able = 1;
x->x_gui.x_glist = (t_glist *)canvas_getcurrent();
- if(!strcmp(srl[1]->s_name, "empty")) x->x_gui.x_fsf.x_rcv_able = 0;
- x->x_gui.x_unique_num = 0;
- if(x->x_gui.x_fsf.x_font_style == 1) strcpy(x->x_gui.x_font, "helvetica");
- else if(x->x_gui.x_fsf.x_font_style == 2) strcpy(x->x_gui.x_font, "times");
+ if (!strcmp(x->x_gui.x_rcv->s_name, "empty"))
+ x->x_gui.x_fsf.x_rcv_able = 0;
+ if (x->x_gui.x_fsf.x_font_style == 1)
+ strcpy(x->x_gui.x_font, "helvetica");
+ else if(x->x_gui.x_fsf.x_font_style == 2)
+ strcpy(x->x_gui.x_font, "times");
else { x->x_gui.x_fsf.x_font_style = 0;
strcpy(x->x_gui.x_font, "courier"); }
- iemgui_first_dollararg2sym(&x->x_gui, srl);
- if(x->x_gui.x_fsf.x_rcv_able) pd_bind(&x->x_gui.x_obj.ob_pd, srl[1]);
- x->x_gui.x_snd = srl[0];
- x->x_gui.x_rcv = srl[1];
- x->x_gui.x_lab = srl[2];
+ if(x->x_gui.x_fsf.x_rcv_able)
+ pd_bind(&x->x_gui.x_obj.ob_pd, x->x_gui.x_rcv);
x->x_gui.x_ldx = ldx;
x->x_gui.x_ldy = ldy;
diff --git a/pd/src/m_binbuf.c b/pd/src/m_binbuf.c
index 60fb9974..1936b2fa 100644
--- a/pd/src/m_binbuf.c
+++ b/pd/src/m_binbuf.c
@@ -446,7 +446,6 @@ void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv)
t_atom *at = x->b_vec;
int ac = x->b_n;
int nargs;
-
while (1)
{
t_pd *nexttarget;
diff --git a/pd/src/m_pd.h b/pd/src/m_pd.h
index fd8d61bf..bfae6f5b 100644
--- a/pd/src/m_pd.h
+++ b/pd/src/m_pd.h
@@ -623,11 +623,14 @@ defined, there is a "te_xpix" field in objects, not a "te_xpos" as before: */
#define PD_USE_TE_XPIX
-/* a test for NANs and denormals. Shouldn't be necessary on Mac but can't
-test this just now. */
+/* a test for NANs and denormals. Should only be necessary on i386. */
+#ifdef __i386__
#define PD_BADFLOAT(f) ((((*(unsigned int*)&(f))&0x7f800000)==0) || \
(((*(unsigned int*)&(f))&0x7f800000)==0x7f800000))
+#else
+#define PD_BADFLOAT(f) 0
+#endif
#if defined(_LANGUAGE_C_PLUS_PLUS) || defined(__cplusplus)
}
diff --git a/pd/src/m_sched.c b/pd/src/m_sched.c
index 552a89d0..b431848d 100644
--- a/pd/src/m_sched.c
+++ b/pd/src/m_sched.c
@@ -360,6 +360,8 @@ static void sched_tick(double next_sys_time)
countdown = 5000;
sys_pollgui();
}
+ if (sys_quit)
+ return;
}
sys_time = next_sys_time;
dsp_tick();
@@ -399,7 +401,7 @@ int m_scheduler( void)
else if (sys_sleepgrain > 5000)
sys_sleepgrain = 5000;
sys_initmidiqueue();
- while (1)
+ while (!sys_quit)
{
int didsomething = 0;
int timeforward;
diff --git a/pd/src/makefile b/pd/src/makefile
index 40f1f2f3..62e5f34b 100644
--- a/pd/src/makefile
+++ b/pd/src/makefile
@@ -1,222 +1,3 @@
-VPATH = ../obj:./
-OBJ_DIR = ../obj
-BIN_DIR = ../bin
-PDEXEC = $(BIN_DIR)/pd
-EXT= pd_linux
-GUINAME= pd-gui
-
-INSTALL_PREFIX = /usr/local
-GFLAGS = -DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
-
-# there should be a better way to do this...
-prefix = /usr/local
-MANDIR = ${prefix}/man
-
-# ALSA compilation
-
-SOUND_ALSA = yes
-
-DEFINES =
-MORECFLAGS = -DDL_OPEN -DUSEAPI_PORTAUDIO -DPA_USE_OSS -DPA_LITTLE_ENDIAN -DUSEAPI_OSS -I../portaudio/pa_common -I../portaudio/pablio -I../portaudio/portmidi-macosx -Werror
-
-INCLUDE = -I.
-GINCLUDE = $(INCLUDE) -I/usr/include/tcl8.4
-GLIB = -ltk8.4 -ltcl8.4 -lX11 -L/usr/X11R6/lib -L/usr/local/lib
-
-LDFLAGS = -Wl,-export-dynamic
-LIB = -ldl -lm -lpthread -lasound
-
-#select either the DBG and OPT compiler flags below:
-OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
-WARN_CFLAGS = -Wall -W -Wstrict-prototypes -Werror \
- -Wno-unused -Wno-parentheses -Wno-switch
-ARCH_CFLAGS = -DPD -DUNIX
-
-CFLAGS = $(ARCH_CFLAGS) $(WARN_CFLAGS) $(OPT_CFLAGS) $(DEFINES) $(MORECFLAGS)
-
-# you might want ALSA linked in non-shared because
-# many Linux machines don't have the ALSA shared library. To link
-# ALSA non-shared, move the # sign below.
-
-ifeq (${SOUND_ALSA},yes)
-CFLAGS += -DPA_USE_ALSA -DUSEAPI_ALSA
-SYSSRC += s_audio_alsa.c \
- ../portaudio/pa_linux_alsa/callback_thread.c \
- ../portaudio/pa_linux_alsa/pa_linux_alsa.c \
- ../portaudio/pa_linux_alsa/blocking_calls.c
-endif
-
-# Which system
-
-SYSTEM = $(shell uname -m)
-
-ifeq (${SYSTEM},alpha)
-#LIB += -lffm -lm
-CFLAGS += -mieee -mcpu=ev56
-endif
-
-# Which compiler
-
-ifeq (${CC},ccc)
-CFLAGS += -g3 -D__COMPAQC__ -arch host
-endif
-
-# the sources
-
-SYSSRC += s_midi_oss.c s_audio_pa.c s_audio_oss.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/pablio/pablio_pd.c ../portaudio/pablio/ringbuffer_pd.c ../portaudio/pa_unix/pa_unix_hostapis.c ../portaudio/pa_unix/pa_unix_util.c ../portaudio/pa_unix_oss/pa_unix_oss.c
-
-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 \
- g_toggle.c g_vdial.c g_vslider.c g_vumeter.c \
- m_pd.c m_class.c m_obj.c m_atom.c m_memory.c m_binbuf.c \
- m_conf.c m_glob.c m_sched.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_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 d_soundfile.c \
- $(SYSSRC)
-
-
-OBJ = $(SRC:.c=.o)
-EXTERNS = ../extra/*/*.$(EXT)
-
-GSRC = t_main.c t_tkcmd.c
-
-GOBJ = $(GSRC:.c=.o)
-
-#
-# ------------------ targets ------------------------------------
-#
-
-.PHONY: pd gui externs all
-
-all: $(PDEXEC) $(BIN_DIR)/pd-watchdog $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
- $(BIN_DIR)/pdreceive $(BIN_DIR)/pd.tk externs
-
-bin: $(PDEXEC) $(BIN_DIR)/pd-watchdog $(BIN_DIR)/$(GUINAME) $(BIN_DIR)/pdsend \
- $(BIN_DIR)/pdreceive $(BIN_DIR)/pd.tk
-
-$(OBJ) : %.o : %.c
- $(CC) $(CFLAGS) $(GFLAGS) $(INCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
-
-$(GOBJ) : %.o : %.c
- $(CC) $(CFLAGS) $(GFLAGS) $(GINCLUDE) -c -o $(OBJ_DIR)/$*.o $*.c
-
-pd: $(PDEXEC)
-
-gui: $(BIN_DIR)/$(GUINAME)
-
-pd-watchdog: $(BIN_DIR)/pd-watchdog
-
-$(BIN_DIR)/pd-watchdog: s_watchdog.c
- cc -O2 $(STRIPFLAG) -o $(BIN_DIR)/pd-watchdog s_watchdog.c
-
-$(BIN_DIR)/pdsend: u_pdsend.c
- cc $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdsend u_pdsend.c
-
-$(BIN_DIR)/pdreceive: u_pdreceive.c
- cc $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdreceive u_pdreceive.c
-
-$(PDEXEC): $(OBJ)
- cd ../obj; $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) \
- $(LIB)
-
-$(BIN_DIR)/pd-gui: $(GOBJ) $(GSRC)
- cd ../obj; $(CC) $(INCLUDE) -o $(BIN_DIR)/$(GUINAME) $(GOBJ) \
- $(GLIB)
-
-$(BIN_DIR)/pd.tk: u_main.tk
- echo set pd_nt 0 > $(BIN_DIR)/pd.tk
- grep -v "set pd_nt" < 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) \
- /Library/Frameworks/Tk.framework/Versions/Current/Tk \
- /Library/Frameworks/Tcl.framework/Versions/Current/Tcl \
- /usr/lib/libSystem.B.dylib
-
-externs:
- cd ../extra/bonk~;make
- cd ../extra/choice;make
- cd ../extra/expr~;make
- cd ../extra/fiddle~;make
- cd ../extra/loop~;make
- cd ../extra/lrshift~;make
- cd ../extra/pique;make
-
-INSTDIR = $(DESTDIR)/$(INSTALL_PREFIX)
-MANINSTDIR = $(DESTDIR)/$(MANDIR)
-
-install: all
- install -d $(INSTDIR)/lib/pd/bin
- install $(BIN_DIR)/$(GUINAME) $(INSTDIR)/lib/pd/bin/$(GUINAME)
- install $(BIN_DIR)/pd-watchdog $(INSTDIR)/lib/pd/bin/pd-watchdog
- install -m644 $(BIN_DIR)/pd.tk $(INSTDIR)/lib/pd/bin/pd.tk
- install -d $(INSTDIR)/bin
- install -m755 $(PDEXEC) $(INSTDIR)/bin/pd
- install -m 755 $(BIN_DIR)/pdsend $(INSTDIR)/bin/pdsend
- install -m 755 $(BIN_DIR)/pdreceive $(INSTDIR)/bin/pdreceive
- install -d $(INSTDIR)/lib/pd/extra
- install -d $(INSTDIR)/lib/pd/externs
- install -m 644 $(EXTERNS) $(INSTDIR)/lib/pd/extra
- cp -r ../doc $(INSTDIR)/lib/pd/
- install -d $(INSTDIR)/include
- install -m644 m_pd.h $(INSTDIR)/include/m_pd.h
- install -d $(MANINSTDIR)/man1
- gzip < ../man/pd.1 > $(MANINSTDIR)/man1/pd.1.gz
- chmod 644 $(MANINSTDIR)/man1/pd.1.gz
- gzip < ../man/pdsend.1 > $(MANINSTDIR)/man1/pdsend.1.gz
- chmod 644 $(MANINSTDIR)/man1/pdsend.1.gz
- gzip < ../man/pdreceive.1 > $(MANINSTDIR)/man1/pdreceive.1.gz
- chmod 644 $(MANINSTDIR)/man1/pdreceive.1.gz
-
-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 *~
- -rm -f $(BIN_DIR)/pdsend $(BIN_DIR)/pdreceive
- -(cd ../doc/6.externs; rm -f *.pd_linux)
- -rm -f makefile.dependencies
- touch makefile.dependencies
- chmod 666 makefile.dependencies
-
-extra-clean:
- -rm -f `find ../extra/ -name "*.pd_*"`
- -rm -f tags
-
-clean: extra-clean local-clean
-
-distclean: clean
- -rm config.cache config.log config.status makefile tags
- echo all: > makefile
- echo -e "\t./configure" >> makefile
- echo -e "\tmake" >> makefile
-
-tags: $(SRC) $(GSRC); ctags *.[ch]
-
-depend:
- $(CC) $(INCLUDE) $(CFLAGS) -M $(SRC) > makefile.dependencies
-
-uninstall:
- -rm -r $(INSTDIR)/lib/pd
- -rm $(INSTDIR)/bin/pd
- -rm $(INSTDIR)/bin/pdsend
- -rm $(INSTDIR)/bin/pdreceive
- -rm $(INSTDIR)/include/m_pd.h
- -rm $(MANINSTDIR)/man/man1/pd.1.gz
- -rm $(MANINSTDIR)/man/man1/pdsend.1.gz
- -rm $(MANINSTDIR)/man/man1/pdreceive.1.gz
-
-include makefile.dependencies
-
-
-
-
-
-
-
+all:
+ ./configure
+ make
diff --git a/pd/src/makefile.in b/pd/src/makefile.in
index 5ffd284a..40587b17 100644
--- a/pd/src/makefile.in
+++ b/pd/src/makefile.in
@@ -8,15 +8,8 @@ GUINAME= @GUINAME@
INSTALL_PREFIX = @prefix@
GFLAGS = -DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
-# there should be a better way to do this...
-prefix = @prefix@
MANDIR = @mandir@
-# ALSA compilation
-
-SOUND_ALSA = @alsa@
-
-DEFINES = @DEFINES@
MORECFLAGS = @MORECFLAGS@
INCLUDE = -I.
@@ -26,40 +19,12 @@ GLIB = @LIBS@
LDFLAGS = @LDFLAGS@
LIB = @PDLIB@
-#select either the DBG and OPT compiler flags below:
OPT_CFLAGS = @OPT_CFLAGS@
-WARN_CFLAGS = -Wall -W -Wstrict-prototypes -Werror \
+WARN_CFLAGS = -Wall -W -Wstrict-prototypes \
-Wno-unused -Wno-parentheses -Wno-switch
ARCH_CFLAGS = -DPD -DUNIX
-CFLAGS = $(ARCH_CFLAGS) $(WARN_CFLAGS) $(OPT_CFLAGS) $(DEFINES) $(MORECFLAGS)
-
-# you might want ALSA linked in non-shared because
-# many Linux machines don't have the ALSA shared library. To link
-# ALSA non-shared, move the # sign below.
-
-ifeq (${SOUND_ALSA},yes)
-CFLAGS += -DPA_USE_ALSA -DUSEAPI_ALSA
-SYSSRC += s_audio_alsa.c \
- ../portaudio/pa_linux_alsa/callback_thread.c \
- ../portaudio/pa_linux_alsa/pa_linux_alsa.c \
- ../portaudio/pa_linux_alsa/blocking_calls.c
-endif
-
-# Which system
-
-SYSTEM = $(shell uname -m)
-
-ifeq (${SYSTEM},alpha)
-#LIB += -lffm -lm
-CFLAGS += -mieee -mcpu=ev56
-endif
-
-# Which compiler
-
-ifeq (${CC},ccc)
-CFLAGS += -g3 -D__COMPAQC__ -arch host
-endif
+CFLAGS = @CFLAGS@ $(ARCH_CFLAGS) $(WARN_CFLAGS) $(OPT_CFLAGS) $(MORECFLAGS)
# the sources
@@ -82,7 +47,6 @@ SRC = g_canvas.c g_graph.c g_text.c g_rtext.c g_array.c g_template.c g_io.c \
OBJ = $(SRC:.c=.o)
-EXTERNS = ../extra/*/*.$(EXT)
GSRC = t_main.c t_tkcmd.c
@@ -113,13 +77,13 @@ gui: $(BIN_DIR)/$(GUINAME)
pd-watchdog: $(BIN_DIR)/pd-watchdog
$(BIN_DIR)/pd-watchdog: s_watchdog.c
- cc -O2 $(STRIPFLAG) -o $(BIN_DIR)/pd-watchdog s_watchdog.c
+ $(CC) -O2 $(STRIPFLAG) -o $(BIN_DIR)/pd-watchdog s_watchdog.c
$(BIN_DIR)/pdsend: u_pdsend.c
- cc $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdsend u_pdsend.c
+ $(CC) $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdsend u_pdsend.c
$(BIN_DIR)/pdreceive: u_pdreceive.c
- cc $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdreceive u_pdreceive.c
+ $(CC) $(CFLAGS) $(STRIPFLAG) -o $(BIN_DIR)/pdreceive u_pdreceive.c
$(PDEXEC): $(OBJ)
cd ../obj; $(CC) $(LDFLAGS) $(DBG_CFLAGS) -o $(PDEXEC) $(OBJ) \
@@ -150,7 +114,7 @@ externs:
cd ../extra/pique;make @EXTERNTARGET@
INSTDIR = $(DESTDIR)/$(INSTALL_PREFIX)
-MANINSTDIR = $(DESTDIR)/$(MANDIR)
+MANINSTDIR = $(DESTDIR)/$(INSTALL_PREFIX)/$(MANDIR)
install: all
install -d $(INSTDIR)/lib/pd/bin
@@ -161,10 +125,8 @@ install: all
install -m755 $(PDEXEC) $(INSTDIR)/bin/pd
install -m 755 $(BIN_DIR)/pdsend $(INSTDIR)/bin/pdsend
install -m 755 $(BIN_DIR)/pdreceive $(INSTDIR)/bin/pdreceive
- install -d $(INSTDIR)/lib/pd/extra
- install -d $(INSTDIR)/lib/pd/externs
- install -m 644 $(EXTERNS) $(INSTDIR)/lib/pd/extra
- cp -r ../doc $(INSTDIR)/lib/pd/
+ cp -pr ../doc ../extra $(INSTDIR)/lib/pd/
+ rm -f $(INSTDIR)/extra/*/*.o
install -d $(INSTDIR)/include
install -m644 m_pd.h $(INSTDIR)/include/m_pd.h
install -d $(MANINSTDIR)/man1
@@ -179,7 +141,6 @@ 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 *~
- -rm -f $(BIN_DIR)/pdsend $(BIN_DIR)/pdreceive
-(cd ../doc/6.externs; rm -f *.pd_linux)
-rm -f makefile.dependencies
touch makefile.dependencies
@@ -192,7 +153,8 @@ extra-clean:
clean: extra-clean local-clean
distclean: clean
- -rm config.cache config.log config.status makefile tags
+ rm -rf config.cache config.log config.status makefile tags \
+ autom4te-*.cache
echo all: > makefile
echo -e "\t./configure" >> makefile
echo -e "\tmake" >> makefile
@@ -203,14 +165,14 @@ depend:
$(CC) $(INCLUDE) $(CFLAGS) -M $(SRC) > makefile.dependencies
uninstall:
- -rm -r $(INSTDIR)/lib/pd
- -rm $(INSTDIR)/bin/pd
- -rm $(INSTDIR)/bin/pdsend
- -rm $(INSTDIR)/bin/pdreceive
- -rm $(INSTDIR)/include/m_pd.h
- -rm $(MANINSTDIR)/man/man1/pd.1.gz
- -rm $(MANINSTDIR)/man/man1/pdsend.1.gz
- -rm $(MANINSTDIR)/man/man1/pdreceive.1.gz
+ rm -f -r $(INSTDIR)/lib/pd
+ rm -f $(INSTDIR)/bin/pd
+ rm -f $(INSTDIR)/bin/pdsend
+ rm -f $(INSTDIR)/bin/pdreceive
+ rm -f $(INSTDIR)/include/m_pd.h
+ rm -f $(MANINSTDIR)/man1/pd.1.gz
+ rm -f $(MANINSTDIR)/man1/pdsend.1.gz
+ rm -f $(MANINSTDIR)/man1/pdreceive.1.gz
include makefile.dependencies
diff --git a/pd/src/notes.txt b/pd/src/notes.txt
index a480f191..8d1fead9 100644
--- a/pd/src/notes.txt
+++ b/pd/src/notes.txt
@@ -13,25 +13,29 @@ make watchdog work for MACOSX
%x to %lx in all "tags" to make 64-bit safe
plug-in support
portaudio_pd files into src
+settings saver (registry in Windows; .pdrc in linux; defaults system in OSX?)
+text cut/copy/paste
GOP bounding box object
+signal inlets to sense signals; fix +~ etc, vcf~, biquad~, and make a vcfb~
+
+makefile to set SETUID bit on install?
+loading e-mailed patches without removing headers crashes pd
+investigate gcc 3.3 warnings; try to reinstate -fstrict-aliasing
+message dialog not to disappear
+sprout inlets/outlets on objects whose creation failed.
pd $1 bug ($1 is saved as it was evaluated, not as '$1')
why does changing the name of an explode in jupiter patch take so long?
close-subwindows menu item
trouble typing into number boxes
abstraction reload doesn't have to vis everyone??
-check MIDI device numbering on MSW
show results of opening audio and MIDI on dialogs
-settings saver
-latency testing
windows escape from control-C
add standard bindings (ctl-o, etc) to dialogs
-
settable netsend and netreceive port numbers
suspend/resume graphics updates
scheduler to handle callbacks
scheduler to do DSP computations even if no audio
hook to scheduler to let others get called for DSP I/O
-figure out how to avoid "dac freeze" if nosound
new: mline~, msnapshot~, abs~
flags to defeat adding specified classes from libraries
incorporate pddp doc
@@ -42,6 +46,7 @@ open/save panel to take messages to init directory
look at prctl(2) for FP exception handling
problems:
+qlist - 'next 1' seems not to work
arrays of non-existent templates crash
don't draw in/outlets on gui objects in graphs
Alsa degradation after several hours running on soundblaster
@@ -59,6 +64,7 @@ data copy/paste doesn't check templates aren't changed
rfft~ loses nyquist bin -- see "to hell with it" comment in d_fft.c
data:
+allow field*2+5 etc. in drawing commands
vget, vset traversal objects
cursor to show (x, y) location
better hit detection (getrect is too greedy)
@@ -75,7 +81,6 @@ figure out why Pd sometimes crashes when you close example after adding fields
features:
command line flag to defeat loading objects
signal inlets with initialized values...
-Pd to open html help on windows/mac
flag to hide array names
??? have a way to disambiguate externs from different libs???
put serial object in main dist (see rat@telecoma, Apr. 25; winfried May 22)
diff --git a/pd/src/s_audio.c b/pd/src/s_audio.c
index c08b42cb..9e0c4b01 100644
--- a/pd/src/s_audio.c
+++ b/pd/src/s_audio.c
@@ -27,6 +27,8 @@ typedef long t_pa_sample;
#define SYS_XFERSAMPS (SYS_DEFAULTCH*DEFDACBLKSIZE)
#define SYS_XFERSIZE (SYS_SAMPLEWIDTH * SYS_XFERSAMPS)
+ /* these are set in this file when opening audio, but then may be reduced,
+ even to zero, in the system dependent open_audio routines. */
int sys_inchannels;
int sys_outchannels;
int sys_advance_samples; /* scheduler advance in samples */
@@ -189,7 +191,7 @@ void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
else
{
for (i = 0; i < MAXAUDIOINDEV; i++)
- audioindev[i] = i+1;
+ audioindev[i] = i;
naudioindev = nchindev;
}
}
@@ -235,7 +237,7 @@ void sys_open_audio(int naudioindev, int *audioindev, int nchindev,
else
{
for (i = 0; i < MAXAUDIOOUTDEV; i++)
- audiooutdev[i] = i+1;
+ audiooutdev[i] = i;
naudiooutdev = nchoutdev;
}
}
diff --git a/pd/src/s_audio_alsa.c b/pd/src/s_audio_alsa.c
index 89c2d9de..f42b6436 100644
--- a/pd/src/s_audio_alsa.c
+++ b/pd/src/s_audio_alsa.c
@@ -38,14 +38,21 @@ typedef int32_t t_alsa_sample32;
#define INT32_MAX 0x7fffffff
#endif
+#if (SND_LIB_MAJOR < 1)
+#define ALSAAPI9
+#endif
+
typedef struct _alsa_dev
{
snd_pcm_t *inhandle;
snd_pcm_t *outhandle;
+ int innoninterleave; /* true if we're set for noninterleaved read */
+ int outnoninterleave; /* same for write */
} t_alsa_dev;
t_alsa_dev alsa_device;
-static short *alsa_buf = 0;
+static void *alsa_snd_buf = 0;
+static void **alsa_buf_ptrs;
static int alsa_samplewidth;
static snd_pcm_status_t* in_status;
static snd_pcm_status_t* out_status;
@@ -60,6 +67,7 @@ static int alsa_outchannels;
#define DEBUG2(x) {x;}
static void alsa_checkiosync( void);
+static void alsa_numbertoname(int devno, char *devname, int nchar);
/* don't assume we can turn all 31 bits when doing float-to-fix;
otherwise some audio drivers (e.g. Midiman/ALSA) wrap around. */
@@ -89,6 +97,7 @@ int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
int nfrags, i;
short* tmp_buf;
unsigned int tmp_uint;
+ snd_pcm_uframes_t tmp_snd_pcm_uframes;
int wantinchans, wantoutchans, devno;
if (naudioindev >= 2 || naudiooutdev >= 2)
@@ -105,10 +114,7 @@ int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
devno = (naudioindev > 0 ? audioindev[0] :
(naudiooutdev > 0 ? audiooutdev[0] : 0));
- /* device names are hw:0, plughw:0, hw:1, and so on. */
- if (devno & 1)
- sprintf(devname, "plughw:%d", devno/2);
- else sprintf(devname, "hw:%d", devno/2);
+ alsa_numbertoname(devno, devname, 512);
if (sys_verbose)
post("device name %s; channels in %d, out %d", devname, wantinchans,
@@ -121,7 +127,7 @@ int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
if (sys_verbose)
post("audio buffer set to %d", (int)(0.001 * sys_schedadvance));
-
+ alsa_device.innoninterleave = alsa_device.outnoninterleave = 0;
if (wantinchans)
{
err = snd_pcm_open(&alsa_device.inhandle, devname,
@@ -160,9 +166,21 @@ int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
// get the default params
err = snd_pcm_hw_params_any(alsa_device.inhandle, hw_params);
check_error(err, "snd_pcm_hw_params_any (input)");
- // set interleaved access - FIXME deal with other access types
- err = snd_pcm_hw_params_set_access(alsa_device.inhandle, hw_params,
- SND_PCM_ACCESS_RW_INTERLEAVED);
+
+ /* try to set interleaved access */
+ err = snd_pcm_hw_params_set_access(alsa_device.inhandle,
+ hw_params, SND_PCM_ACCESS_RW_INTERLEAVED);
+ if (err < 0)
+ {
+ /* OK, so try non-interleaved */
+ err = snd_pcm_hw_params_set_access(alsa_device.inhandle,
+ hw_params, SND_PCM_ACCESS_RW_NONINTERLEAVED);
+ if (err >= 0)
+ {
+ post("using non-interleaved audio input");
+ alsa_device.innoninterleave = 1;
+ }
+ }
check_error(err, "snd_pcm_hw_params_set_access (input)");
// Try to set 32 bit format first
err = snd_pcm_hw_params_set_format(alsa_device.inhandle, hw_params,
@@ -212,20 +230,38 @@ int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
snd_pcm_hw_params_get_period_size_min(hw_params, 0),
snd_pcm_hw_params_get_period_size_max(hw_params, 0));
#endif
+#ifdef ALSAAPI9
err = snd_pcm_hw_params_set_period_size_near(alsa_device.inhandle,
hw_params,
(snd_pcm_uframes_t)
frag_size, 0);
+#else
+ tmp_snd_pcm_uframes = frag_size;
+ err = snd_pcm_hw_params_set_period_size_near(alsa_device.inhandle,
+ hw_params, &tmp_snd_pcm_uframes, 0);
+#endif
check_error(err, "snd_pcm_hw_params_set_period_size_near (input)");
// post("fragsize b %d", frag_size);
// set the number of periods - ie numfrags
// post("nfrags a %d", nfrags);
+#ifdef ALSAAPI9
err = snd_pcm_hw_params_set_periods_near(alsa_device.inhandle,
hw_params, nfrags, 0);
+#else
+ tmp_uint = nfrags;
+ err = snd_pcm_hw_params_set_periods_near(alsa_device.inhandle,
+ hw_params, &tmp_uint, 0);
+#endif
check_error(err, "snd_pcm_hw_params_set_periods_near (input)");
// set the buffer size
+#ifdef ALSAAPI9
err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.inhandle,
hw_params, nfrags * frag_size);
+#else
+ tmp_snd_pcm_uframes = nfrags * frag_size;
+ err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.inhandle,
+ hw_params, &tmp_snd_pcm_uframes);
+#endif
check_error(err, "snd_pcm_hw_params_set_buffer_size_near (input)");
err = snd_pcm_hw_params(alsa_device.inhandle, hw_params);
@@ -276,6 +312,24 @@ int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
err = snd_pcm_hw_params_set_access(alsa_device.outhandle, hw_params,
SND_PCM_ACCESS_RW_INTERLEAVED);
check_error(err, "snd_pcm_hw_params_set_access (output)");
+
+ /* try to set interleaved access */
+ err = snd_pcm_hw_params_set_access(alsa_device.outhandle,
+ hw_params, SND_PCM_ACCESS_RW_INTERLEAVED);
+ if (err < 0)
+ {
+ /* OK, so try non-interleaved */
+ err = snd_pcm_hw_params_set_access(alsa_device.outhandle,
+ hw_params, SND_PCM_ACCESS_RW_NONINTERLEAVED);
+ if (err >= 0)
+ {
+ post("using non-interleaved audio");
+ alsa_device.outnoninterleave = 1;
+ }
+ }
+ check_error(err, "snd_pcm_hw_params_set_access (output)");
+
+
// Try to set 32 bit format first
err = snd_pcm_hw_params_set_format(alsa_device.outhandle, hw_params,
SND_PCM_FORMAT_S32);
@@ -320,20 +374,37 @@ int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
snd_pcm_hw_params_get_period_size_max(hw_params, 0));
#endif
// post("fragsize c %d", frag_size);
+#ifdef ALSAAPI9
err = snd_pcm_hw_params_set_period_size_near(alsa_device.outhandle,
hw_params,
(snd_pcm_uframes_t)
frag_size, 0);
+#else
+ tmp_snd_pcm_uframes = frag_size;
+ err = snd_pcm_hw_params_set_period_size_near(alsa_device.outhandle,
+ hw_params, &tmp_snd_pcm_uframes, 0);
+#endif
// post("fragsize d %d", frag_size);
check_error(err, "snd_pcm_hw_params_set_period_size_near (output)");
// set the number of periods - ie numfrags
+#ifdef ALSAAPI9
err = snd_pcm_hw_params_set_periods_near(alsa_device.outhandle,
hw_params, nfrags, 0);
+#else
+ tmp_uint = nfrags;
+ err = snd_pcm_hw_params_set_periods_near(alsa_device.outhandle,
+ hw_params, &tmp_uint, 0);
+#endif
check_error(err, "snd_pcm_hw_params_set_periods_near (output)");
// set the buffer size
+#ifdef ALSAAPI9
err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.outhandle,
hw_params, nfrags * frag_size);
-
+#else
+ tmp_snd_pcm_uframes = nfrags * frag_size;
+ err = snd_pcm_hw_params_set_buffer_size_near(alsa_device.outhandle,
+ hw_params, &tmp_snd_pcm_uframes);
+#endif
check_error(err, "snd_pcm_hw_params_set_buffer_size_near (output)");
err = snd_pcm_hw_params(alsa_device.outhandle, hw_params);
@@ -384,42 +455,57 @@ int alsa_open_audio(int naudioindev, int *audioindev, int nchindev,
check_error(err, "snd_pcm_status_malloc");
// set up the buffer
- if (alsa_buf)
- free(alsa_buf);
- alsa_buf = (short *)malloc(
+ if (alsa_snd_buf)
+ free(alsa_snd_buf);
+ alsa_snd_buf = (void *)malloc(
sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE *
(outchans > inchans ? outchans : inchans));
- memset(alsa_buf, 0, sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE *
+ memset(alsa_snd_buf, 0, sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE *
(outchans > inchans ? outchans : inchans));
+ /* make an array of pointers too in case we need them */
+ if (alsa_buf_ptrs)
+ free(alsa_buf_ptrs);
+ alsa_buf_ptrs = (void **)malloc(
+ sizeof(void *) * (outchans > inchans ? outchans : inchans));
+ for (i = 0; i < (outchans > inchans ? outchans : inchans); i++)
+ alsa_buf_ptrs[i] = (t_alsa_sample32 *)alsa_snd_buf + i * DEFDACBLKSIZE;
+
// fill the buffer with silence
if (outchans)
{
i = (frag_size * nfrags)/DEFDACBLKSIZE + 1;
while (i--)
- snd_pcm_writei(alsa_device.outhandle, alsa_buf, DEFDACBLKSIZE);
- /* apparently we're not suppposed to start it in this case,
- but can (and must) if there's only ADC open (below). */
+ {
+ if (alsa_device.outnoninterleave)
+ snd_pcm_writen(alsa_device.outhandle, alsa_buf_ptrs,
+ DEFDACBLKSIZE);
+ else snd_pcm_writei(alsa_device.outhandle, alsa_snd_buf,
+ DEFDACBLKSIZE);
+ }
+ /* confused about this: */
/* if ((err = snd_pcm_start(alsa_device.outhandle) < 0))
check_error(err, "output start failed\n"); */
}
- else if (snd_pcm_start(alsa_device.inhandle) < 0)
+ else if (inchans)
+ {
+ if (snd_pcm_start(alsa_device.inhandle) < 0)
check_error(err, "input start failed\n");
-
+ }
alsa_outchannels = outchans;
alsa_inchannels = inchans;
- return 0;
+ return (!(inchans || outchans));
}
void alsa_close_audio(void)
{
int err;
- if (sys_inchannels)
+ if (alsa_inchannels)
{
err = snd_pcm_close(alsa_device.inhandle);
check_error(err, "snd_pcm_close (input)");
}
- if (sys_outchannels)
+ if (alsa_outchannels)
{
err = snd_pcm_close(alsa_device.outhandle);
check_error(err, "snd_pcm_close (output)");
@@ -484,14 +570,30 @@ int alsa_send_dacs(void)
fp = sys_soundout;
if (alsa_samplewidth == 4)
{
- for (i = 0, fp1 = fp; i < outchannels; i++, fp1 += DEFDACBLKSIZE)
+ if (alsa_device.outnoninterleave)
{
- for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--;
- j += alsa_outchannels, fp2++)
+ int n = outchannels * DEFDACBLKSIZE;
+ for (i = 0, fp1 = fp; i < n; i++)
{
- float s1 = *fp2 * INT32_MAX;
- ((t_alsa_sample32 *)alsa_buf)[j] = CLIP32(s1);
- }
+ float s1 = *fp1 * INT32_MAX;
+ ((t_alsa_sample32 *)alsa_snd_buf)[i] = CLIP32(s1);
+ }
+ n = alsa_outchannels * DEFDACBLKSIZE;
+ for (; i < n; i++)
+ ((t_alsa_sample32 *)alsa_snd_buf)[i] = 0;
+ }
+ else
+ {
+ for (i = 0, fp1 = fp; i < outchannels; i++,
+ fp1 += DEFDACBLKSIZE)
+ {
+ for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--;
+ j += alsa_outchannels, fp2++)
+ {
+ float s1 = *fp2 * INT32_MAX;
+ ((t_alsa_sample32 *)alsa_snd_buf)[j] = CLIP32(s1);
+ }
+ }
}
}
else
@@ -506,13 +608,17 @@ int alsa_send_dacs(void)
s = 32767;
else if (s < -32767)
s = -32767;
- ((t_alsa_sample16 *)alsa_buf)[j] = s;
+ ((t_alsa_sample16 *)alsa_snd_buf)[j] = s;
}
}
}
- result = snd_pcm_writei(alsa_device.outhandle, alsa_buf,
- outtransfersize);
+ if (alsa_device.outnoninterleave)
+ result = snd_pcm_writen(alsa_device.outhandle, alsa_buf_ptrs,
+ outtransfersize);
+ else result = snd_pcm_writei(alsa_device.outhandle, alsa_snd_buf,
+ outtransfersize);
+
if (result != (int)outtransfersize)
{
#ifdef DEBUG_ALSA_XFER
@@ -547,7 +653,11 @@ int alsa_send_dacs(void)
/* do input */
if (alsa_inchannels)
{
- result = snd_pcm_readi(alsa_device.inhandle, alsa_buf, intransfersize);
+ if (alsa_device.innoninterleave)
+ result = snd_pcm_readn(alsa_device.inhandle, alsa_buf_ptrs,
+ intransfersize);
+ else result = snd_pcm_readi(alsa_device.inhandle, alsa_snd_buf,
+ intransfersize);
if (result < (int)intransfersize)
{
#ifdef DEBUG_ALSA_XFER
@@ -570,12 +680,23 @@ int alsa_send_dacs(void)
fp = sys_soundin;
if (alsa_samplewidth == 4)
{
- for (i = 0, fp1 = fp; i < inchannels; i++, fp1 += DEFDACBLKSIZE)
+ if (alsa_device.innoninterleave)
{
- for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--;
- j += alsa_inchannels, fp2++)
- *fp2 = (float) ((t_alsa_sample32 *)alsa_buf)[j]
- * (1./ INT32_MAX);
+ int n = inchannels * DEFDACBLKSIZE;
+ for (i = 0, fp1 = fp; i < n; i++)
+ *fp1 = (float) ((t_alsa_sample32 *)alsa_snd_buf)[i]
+ * (1./ INT32_MAX);
+ }
+ else
+ {
+ for (i = 0, fp1 = fp; i < inchannels;
+ i++, fp1 += DEFDACBLKSIZE)
+ {
+ for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--;
+ j += alsa_inchannels, fp2++)
+ *fp2 = (float) ((t_alsa_sample32 *)alsa_snd_buf)[j]
+ * (1./ INT32_MAX);
+ }
}
}
else
@@ -584,7 +705,7 @@ int alsa_send_dacs(void)
{
for (j = i, k = DEFDACBLKSIZE, fp2 = fp1; k--;
j += alsa_inchannels, fp2++)
- *fp2 = (float) ((t_alsa_sample16 *)alsa_buf)[j]
+ *fp2 = (float) ((t_alsa_sample16 *)alsa_snd_buf)[j]
* 3.051850e-05;
}
}
@@ -638,12 +759,15 @@ void alsa_resync( void)
error("restart-audio: implemented for ALSA only.");
return;
}
- memset(alsa_buf, 0,
+ memset(alsa_snd_buf, 0,
sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE * sys_outchannels);
for (i = 0; i < 1000000; i++)
{
- result = snd_pcm_writei(alsa_device.outhandle, alsa_buf,
- DEFDACBLKSIZE);
+ if (alsa_device.outnoninterleave)
+ result = snd_pcm_writen(alsa_device.outhandle, alsa_buf_ptrs,
+ DEFDACBLKSIZE);
+ else result = snd_pcm_writei(alsa_device.outhandle, alsa_snd_buf,
+ DEFDACBLKSIZE);
if (result != (int)DEFDACBLKSIZE)
break;
}
@@ -653,11 +777,15 @@ void alsa_resync( void)
void alsa_putzeros(int n)
{
int i, result;
- memset(alsa_buf, 0,
+ memset(alsa_snd_buf, 0,
sizeof(char) * alsa_samplewidth * DEFDACBLKSIZE * alsa_outchannels);
for (i = 0; i < n; i++)
{
- result = snd_pcm_writei(alsa_device.outhandle, alsa_buf, DEFDACBLKSIZE);
+ if (alsa_device.outnoninterleave)
+ result = snd_pcm_writen(alsa_device.outhandle, alsa_buf_ptrs,
+ DEFDACBLKSIZE);
+ else result = snd_pcm_writei(alsa_device.outhandle, alsa_snd_buf,
+ DEFDACBLKSIZE);
#if 0
if (result != DEFDACBLKSIZE)
post("result %d", result);
@@ -671,7 +799,8 @@ void alsa_getzeros(int n)
int i, result;
for (i = 0; i < n; i++)
{
- result = snd_pcm_readi(alsa_device.inhandle, alsa_buf, DEFDACBLKSIZE);
+ result = snd_pcm_readi(alsa_device.inhandle, alsa_snd_buf,
+ DEFDACBLKSIZE);
#if 0
if (result != DEFDACBLKSIZE)
post("result %d", result);
@@ -771,7 +900,7 @@ void alsa_getdevs(char *indevlist, int *nindevs,
char *outdevlist, int *noutdevs, int *canmulti,
int maxndev, int devdescsize)
{
- int ndev = 0, cardno = -1;
+ int ndev = 0, cardno = -1, i, j;
*canmulti = 0; /* only one device; must be the same for input&output */
while (!snd_card_next(&cardno) && cardno >= 0)
{
@@ -805,5 +934,12 @@ void alsa_getdevs(char *indevlist, int *nindevs,
sprintf(outdevlist + (2*ndev + 1) * devdescsize, "%s (plug-in)", desc);
ndev++;
}
- *nindevs = *noutdevs = 2 * ndev;
+ for (i = 0, j = 2*ndev; i < alsa_nnames; i++, j++)
+ {
+ if (j >= maxndev)
+ break;
+ snprintf(indevlist + j * devdescsize, devdescsize, "%s",
+ alsa_names[i]);
+ }
+ *nindevs = *noutdevs = j;
}
diff --git a/pd/src/s_audio_jack.c b/pd/src/s_audio_jack.c
index e9d8fcb5..1e79b43b 100644
--- a/pd/src/s_audio_jack.c
+++ b/pd/src/s_audio_jack.c
@@ -25,12 +25,14 @@ static int jack_started = 0;
static jack_port_t *input_port[NUM_JACK_PORTS];
static jack_port_t *output_port[NUM_JACK_PORTS];
-static jack_client_t *jack_client;
+static int outport_count = 0;
+static jack_client_t *jack_client = NULL;
char *jack_client_names[MAX_CLIENTS];
pthread_mutex_t jack_mutex;
pthread_cond_t jack_sem;
+
static int
process (jack_nframes_t nframes, void *arg)
{
@@ -38,9 +40,9 @@ process (jack_nframes_t nframes, void *arg)
float *out;
float *in;
+
if (nframes > JACK_OUT_MAX) jack_out_max = nframes;
else jack_out_max = JACK_OUT_MAX;
-
if (jack_filled >= nframes) {
if (jack_filled != nframes) fprintf(stderr,"Partial read");
@@ -67,9 +69,8 @@ process (jack_nframes_t nframes, void *arg)
}
static int
-srate (jack_nframes_t srate, void *arg)
+jack_srate (jack_nframes_t srate, void *arg)
{
- printf ("jack: sample rate %ld/sec\n", srate);
sys_dacsr = srate;
return 0;
}
@@ -202,12 +203,12 @@ jack_open_audio(int inchans, int outchans, int rate)
{
int j;
char port_name[80] = "";
- int samplerate;
int client_iterator = 0;
+ int new_jack = 0;
+ int srate;
if ((inchans == 0) && (outchans == 0)) return 0;
- post("Testing for Jack");
if (outchans > NUM_JACK_PORTS) {
fprintf(stderr,"%d output ports not supported, setting to %d\n",outchans, NUM_JACK_PORTS);
outchans = NUM_JACK_PORTS;
@@ -219,88 +220,97 @@ jack_open_audio(int inchans, int outchans, int rate)
}
/* try to become a client of the JACK server (we allow two pd's)*/
-
- do {
- sprintf(port_name,"pure_data_%d",client_iterator);
- client_iterator++;
- }
- while (((jack_client = jack_client_new (port_name)) == 0) && client_iterator < 2);
-
- if (!jack_client) { // jack spits out enough messages already, do not warn
- return 1;
- }
-
- jack_get_clients();
-
- /* tell the JACK server to call `process()' whenever
- there is work to be done.
- */
-
- jack_set_process_callback (jack_client, process, 0);
+ if (!jack_client) {
+ do {
+ sprintf(port_name,"pure_data_%d",client_iterator);
+ client_iterator++;
+ } while (((jack_client = jack_client_new (port_name)) == 0) && client_iterator < 2);
- jack_set_error_function (jack_error);
+
+ if (!jack_client) { // jack spits out enough messages already, do not warn
+ return 1;
+ }
+
+ jack_get_clients();
+ /* tell the JACK server to call `process()' whenever
+ there is work to be done.
+ */
+
+ jack_set_process_callback (jack_client, process, 0);
+
+ jack_set_error_function (jack_error);
+
#ifdef JACK_XRUN
- jack_set_xrun_callback (jack_client, jack_xrun, NULL);
+ jack_set_xrun_callback (jack_client, jack_xrun, NULL);
#endif
+
+ /* tell the JACK server to call `srate()' whenever
+ the sample rate of the system changes.
+ */
+
+ jack_set_sample_rate_callback (jack_client, jack_srate, 0);
+
+
+ /* tell the JACK server to call `jack_shutdown()' if
+ it ever shuts down, either entirely, or if it
+ just decides to stop calling us.
+ */
+
+ jack_on_shutdown (jack_client, jack_shutdown, 0);
+
+ for (j=0;j<NUM_JACK_PORTS;j++) {
+ input_port[j]=NULL;
+ output_port[j] = NULL;
+ }
+
+ new_jack = 1;
+ }
- /* tell the JACK server to call `srate()' whenever
- the sample rate of the system changes.
- */
-
- jack_set_sample_rate_callback (jack_client, srate, 0);
+ /* display the current sample rate. once the client is activated
+ (see below), you should rely on your own sample rate
+ callback (see above) for this value.
+ */
-
- /* tell the JACK server to call `jack_shutdown()' if
- it ever shuts down, either entirely, or if it
- just decides to stop calling us.
- */
-
- jack_on_shutdown (jack_client, jack_shutdown, 0);
-
-
- /* display the current sample rate. once the client is activated
- (see below), you should rely on your own sample rate
- callback (see above) for this value.
- */
-
- samplerate = jack_get_sample_rate (jack_client);
-
+ srate = jack_get_sample_rate (jack_client);
+ sys_dacsr = srate;
+
/* create the ports */
-
+
for (j = 0; j < inchans; j++) {
sprintf(port_name, "input%d", j);
- input_port[j] = jack_port_register (jack_client, port_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
+ if (!input_port[j]) input_port[j] = jack_port_register (jack_client, port_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsInput, 0);
}
+
for (j = 0; j < outchans; j++) {
sprintf(port_name, "output%d", j);
- output_port[j] = jack_port_register (jack_client, port_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
+ if (!output_port[j]) output_port[j] = jack_port_register (jack_client, port_name, JACK_DEFAULT_AUDIO_TYPE, JackPortIsOutput, 0);
}
+ outport_count = outchans;
/* tell the JACK server that we are ready to roll */
- if (jack_activate (jack_client)) {
- fprintf (stderr, "cannot activate client");
- return 1;
- }
-
- memset(jack_outbuf,0,sizeof(jack_outbuf));
-
- if (jack_client_names[0])
- jack_connect_ports(jack_client_names[0]);
-
- pthread_mutex_init(&jack_mutex,NULL);
- pthread_cond_init(&jack_sem,NULL);
+ if (new_jack) {
+ if (jack_activate (jack_client)) {
+ fprintf (stderr, "cannot activate client");
+ return 1;
+ }
+
+ memset(jack_outbuf,0,sizeof(jack_outbuf));
+
+ if (jack_client_names[0])
+ jack_connect_ports(jack_client_names[0]);
- post("using JACK audio interface");
+ pthread_mutex_init(&jack_mutex,NULL);
+ pthread_cond_init(&jack_sem,NULL);
+ }
return 0;
}
void jack_close_audio(void)
{
- jack_started = 0;
- /* ignore for now */
+ jack_started = 0;
}
int jack_send_dacs(void)
@@ -342,6 +352,21 @@ int jack_send_dacs(void)
return rtnval;
}
+void jack_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int *canmulti,
+ int maxndev, int devdescsize)
+{
+ int i, ndev;
+ *canmulti = 0; /* supports multiple devices */
+ ndev = 1;
+ for (i = 0; i < ndev; i++)
+ {
+ sprintf(indevlist + i * devdescsize, "JACK");
+ sprintf(outdevlist + i * devdescsize, "JACK");
+ }
+ *nindevs = *noutdevs = ndev;
+}
+
void jack_listdevs( void)
{
post("device listing not implemented for jack yet\n");
diff --git a/pd/src/s_audio_oss.c b/pd/src/s_audio_oss.c
index 63fe0ed1..f0a86a45 100644
--- a/pd/src/s_audio_oss.c
+++ b/pd/src/s_audio_oss.c
@@ -5,18 +5,7 @@
/* this file inputs and outputs audio using the OSS API available on linux. */
-#ifdef __linux__
#include <linux/soundcard.h>
-#endif
-
-#ifdef __FreeBSD__
-#include <sys/soundcard.h>
-#include <sys/mman.h>
-#endif
-
-
-
-
#include "m_pd.h"
#include "s_stuff.h"
@@ -276,7 +265,7 @@ static int oss_setchannels(int fd, int wantchannels, char *devname)
return (0);
}
-#define O_AUDIOFLAG 0 /* O_NDELAY */
+#define O_AUDIOFLAG O_NDELAY
int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
int noutdev, int *outdev, int nchout, int *chout, int rate)
@@ -284,7 +273,7 @@ int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
int capabilities = 0;
int inchannels = 0, outchannels = 0;
char devname[20];
- int n, i, fd;
+ int n, i, fd, flags;
char buf[OSS_MAXSAMPLEWIDTH * DEFDACBLKSIZE * OSS_MAXCHPERDEV];
int num_devs = 0;
int wantmore=0;
@@ -331,6 +320,12 @@ int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
}
else
{
+ if (fcntl(fd, F_SETFD, 1) < 0)
+ post("couldn't set close-on-exec flag on audio");
+ if ((flags = fcntl(fd, F_GETFL)) < 0)
+ post("couldn't get audio device flags");
+ else if (fcntl(fd, F_SETFL, flags & (!O_NDELAY)) < 0)
+ post("couldn't set audio device flags");
if (sys_verbose)
post("opened %s for reading and writing\n", devname);
linux_adcs[inindex].d_fd = fd;
@@ -346,6 +341,12 @@ int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
devname, strerror(errno));
break;
}
+ if (fcntl(fd, F_SETFD, 1) < 0)
+ post("couldn't set close-on-exec flag on audio");
+ if ((flags = fcntl(fd, F_GETFL)) < 0)
+ post("couldn't get audio device flags");
+ else if (fcntl(fd, F_SETFL, flags & (!O_NDELAY)) < 0)
+ post("couldn't set audio device flags");
if (sys_verbose)
post("opened %s for writing only\n", devname);
}
@@ -405,7 +406,7 @@ int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
/* perhaps it's already open from the above? */
if (linux_dacs[n].d_fd >= 0)
{
- fd = linux_dacs[n].d_fd;
+ fd = linux_adcs[n].d_fd;
alreadyopened = 1;
}
else
@@ -416,6 +417,12 @@ int oss_open_audio(int nindev, int *indev, int nchin, int *chin,
post("%s (readonly): %s", devname, strerror(errno));
goto end_in_loop;
}
+ if (fcntl(fd, F_SETFD, 1) < 0)
+ post("couldn't set close-on-exec flag on audio");
+ if ((flags = fcntl(fd, F_GETFL)) < 0)
+ post("couldn't get audio device flags");
+ else if (fcntl(fd, F_SETFL, flags & (!O_NDELAY)) < 0)
+ post("couldn't set audio device flags");
if (sys_verbose)
post("opened %s for reading only\n", devname);
}
@@ -789,14 +796,12 @@ int oss_send_dacs(void)
for (i = DEFDACBLKSIZE,fp1 = sys_soundin + thischan*DEFDACBLKSIZE,
sp = (t_oss_int16 *)buf; i--; fp1++, sp += nchannels)
{
- for (j=0;j<sys_inchannels;j++)
+ for (j=0;j<nchannels;j++)
fp1[j*DEFDACBLKSIZE] = (float)sp[j]*(float)3.051850e-05;
}
}
thischan += nchannels;
}
- if (thischan != sys_inchannels)
- bug("inchannels");
return (rtnval);
}
diff --git a/pd/src/s_audio_pa.c b/pd/src/s_audio_pa.c
index 85f6252e..c74c6649 100644
--- a/pd/src/s_audio_pa.c
+++ b/pd/src/s_audio_pa.c
@@ -127,6 +127,7 @@ int pa_open_audio(int inchans, int outchans, int rate, t_sample *soundin,
err);
fprintf( stderr, "Error message: %s\n", Pa_GetErrorText( err ) );
Pa_Terminate();
+ sys_inchannels = sys_outchannels = 0;
return (1);
}
else if (sys_verbose)
diff --git a/pd/src/s_inter.c b/pd/src/s_inter.c
index 8fa0cbd3..cd6096bb 100644
--- a/pd/src/s_inter.c
+++ b/pd/src/s_inter.c
@@ -47,6 +47,15 @@ typedef int pid_t;
#define DEBUG_MESSUP 1 /* messages up from pd to pd-gui */
#define DEBUG_MESSDOWN 2 /* messages down from pd-gui to pd */
+/* T.Grill - make it a _little_ more adaptable... */
+#ifndef PDBINDIR
+#define PDBINDIR "bin/"
+#endif
+
+#ifndef WISHAPP
+#define WISHAPP "wish83.exe"
+#endif
+
extern char pd_version[];
typedef struct _fdpoll
@@ -439,7 +448,7 @@ static void sys_signal(int signo, sighandler_t sigfun)
action.sa_flags = 0;
action.sa_handler = sigfun;
memset(&action.sa_mask, 0, sizeof(action.sa_mask));
-#ifdef __linux__
+#if 0 /* GG says: don't use that */
action.sa_restorer = 0;
#endif
if (sigaction(signo, &action, 0) < 0)
@@ -570,7 +579,7 @@ int sys_startgui(const char *guidir)
signal(SIGPIPE, sys_exithandler);
signal(SIGALRM, SIG_IGN);
signal(SIGTERM, SIG_IGN);
-#ifdef __linux__
+#if 0 /* GG says: don't use that */
signal(SIGSTKFLT, sys_exithandler);
#endif
#endif
@@ -596,7 +605,8 @@ int sys_startgui(const char *guidir)
SETSYMBOL(zz, gensym(cmdbuf));
for (i = 1; i < 22; i++)
SETFLOAT(zz + i, defaultfontshit[i-1]);
- glob_initfromgui(0, 0, 22, zz);
+ SETFLOAT(zz+22,0);
+ glob_initfromgui(0, 0, 23, zz);
}
else
{
@@ -741,16 +751,16 @@ int sys_startgui(const char *guidir)
strcpy(scriptbuf, "\"");
strcat(scriptbuf, sys_libdir->s_name);
- strcat(scriptbuf, "/bin/pd.tk\"");
+ strcat(scriptbuf, "/" PDBINDIR "pd.tk\"");
sys_bashfilename(scriptbuf, scriptbuf);
sprintf(portbuf, "%d", portno);
strcpy(wishbuf, sys_libdir->s_name);
- strcat(wishbuf, "/bin/wish83.exe");
+ strcat(wishbuf, "/" PDBINDIR WISHAPP);
sys_bashfilename(wishbuf, wishbuf);
- spawnret = _spawnl(P_NOWAIT, wishbuf, "wish83", scriptbuf, portbuf, 0);
+ spawnret = _spawnl(P_NOWAIT, wishbuf, WISHAPP, scriptbuf, portbuf, 0);
if (spawnret < 0)
{
perror("spawnl");
@@ -891,13 +901,13 @@ int sys_pollgui(void)
return (sys_domicrosleep(0, 1) || sys_poll_togui());
}
+
/* T.Grill - import clean quit function */
extern void sys_exit(void);
/* This is called when something bad has happened, like a segfault.
Call glob_quit() below to exit cleanly.
LATER try to save dirty documents even in the bad case. */
-
void sys_bail(int n)
{
static int reentered = 0;
diff --git a/pd/src/s_loader.c b/pd/src/s_loader.c
index 3b80eaad..c210206c 100644
--- a/pd/src/s_loader.c
+++ b/pd/src/s_loader.c
@@ -25,7 +25,7 @@ typedef void (*t_xxx)(void);
static char sys_dllextent[] =
#ifdef __FreeBSD__
- ".pd_linux";
+ ".pd_freebsd";
#endif
#ifdef IRIX
#ifdef N32
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index 9f038259..cc8bcc20 100644
--- a/pd/src/s_main.c
+++ b/pd/src/s_main.c
@@ -7,7 +7,7 @@
* 1311:forum::für::umläute:2001
*/
-char pd_version[] = "Pd version 0.37.1 TEST6 devel\n";
+char pd_version[] = "Pd version 0.37.1 TEST6\n";
char pd_compiletime[] = __TIME__;
char pd_compiledate[] = __DATE__;
@@ -51,6 +51,7 @@ static t_namelist *sys_externlist;
static t_namelist *sys_openlist;
static t_namelist *sys_messagelist;
static int sys_version;
+int sys_oldtclversion; /* hack to warn g_rtext.c about old text sel */
int sys_nmidiout = 1;
#ifdef MSW
@@ -182,7 +183,7 @@ 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 != 1 + 3 * NHOSTFONT) bug("glob_initfromgui");
+ if (argc != 2 + 3 * NHOSTFONT) bug("glob_initfromgui");
for (i = 0; i < NFONT; i++)
{
int wantheight = sys_fontlist[i].fi_maxheight;
@@ -226,6 +227,7 @@ 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);
diff --git a/pd/src/s_midi.c b/pd/src/s_midi.c
index 0382d0b0..aac80f03 100644
--- a/pd/src/s_midi.c
+++ b/pd/src/s_midi.c
@@ -225,18 +225,33 @@ void outmidi_mclk(int portno)
typedef struct midiparser
{
int mp_status;
- int mp_sysex;
int mp_gotbyte1;
int mp_byte1;
} t_midiparser;
-#define MIDINOTEOFF 0x80
-#define MIDINOTEON 0x90
-#define MIDIPOLYTOUCH 0xa0
-#define MIDICONTROLCHANGE 0xb0
-#define MIDIPROGRAMCHANGE 0xc0
-#define MIDICHANNELTOUCH 0xd0
-#define MIDIPITCHBEND 0xe0
+#define MIDINOTEOFF 0x80 /* 2 following 'data bytes' */
+#define MIDINOTEON 0x90 /* 2 */
+#define MIDIPOLYTOUCH 0xa0 /* 2 */
+#define MIDICONTROLCHANGE 0xb0 /* 2 */
+#define MIDIPROGRAMCHANGE 0xc0 /* 1 */
+#define MIDICHANNELTOUCH 0xd0 /* 1 */
+#define MIDIPITCHBEND 0xe0 /* 2 */
+#define MIDISTARTSYSEX 0xf0 /* (until F7) */
+#define MIDITIMECODE 0xf1 /* 1 */
+#define MIDISONGPOS 0xf2 /* 2 */
+#define MIDISONGSELECT 0xf3 /* 1 */
+#define MIDIRESERVED1 0xf4 /* ? */
+#define MIDIRESERVED2 0xf5 /* ? */
+#define MIDITUNEREQUEST 0xf6 /* 0 */
+#define MIDIENDSYSEX 0xf7 /* 0 */
+#define MIDICLOCK 0xf8 /* 0 */
+#define MIDITICK 0xf9 /* 0 */
+#define MIDISTART 0xfa /* 0 */
+#define MIDICONT 0xfb /* 0 */
+#define MIDISTOP 0xfc /* 0 */
+#define MIDIACTIVESENSE 0xfe /* 0 */
+#define MIDIRESET 0xff /* 0 */
+
/* functions in x_midi.c */
void inmidi_realtimein(int portno, int cmd);
void inmidi_byte(int portno, int byte);
@@ -265,59 +280,86 @@ static void sys_dispatchnextmidiin( void)
else
{
inmidi_byte(portno, byte);
- if (byte < 0xf0)
+ if (byte & 0x80)
{
- if (byte & 0x80)
+ if (byte == MIDITUNEREQUEST || byte == MIDIRESERVED1 ||
+ byte == MIDIRESERVED2)
+ parserp->mp_status = 0;
+ else if (byte == MIDISTARTSYSEX)
{
+ inmidi_sysex(portno, byte);
parserp->mp_status = byte;
- parserp->mp_gotbyte1 = 0;
+ }
+ else if (byte == MIDIENDSYSEX)
+ {
+ inmidi_sysex(portno, byte);
+ parserp->mp_status = 0;
}
else
{
- int cmd = (parserp->mp_status & 0xf0);
- int chan = (parserp->mp_status & 0xf);
- int byte1 = parserp->mp_byte1, gotbyte1 = parserp->mp_gotbyte1;
- switch (cmd)
- {
- case MIDINOTEOFF:
- if (gotbyte1)
- inmidi_noteon(portno, chan, byte1, 0),
- parserp->mp_gotbyte1 = 0;
- else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
- break;
- case MIDINOTEON:
- if (gotbyte1)
- inmidi_noteon(portno, chan, byte1, byte),
- parserp->mp_gotbyte1 = 0;
- else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
- break;
- case MIDIPOLYTOUCH:
- if (gotbyte1)
- inmidi_polyaftertouch(portno, chan, byte1, byte),
- parserp->mp_gotbyte1 = 0;
- else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
- break;
- case MIDICONTROLCHANGE:
- if (gotbyte1)
- inmidi_controlchange(portno, chan, byte1, byte),
- parserp->mp_gotbyte1 = 0;
- else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
- break;
- case MIDIPROGRAMCHANGE:
- inmidi_programchange(portno, chan, byte);
- break;
- case MIDICHANNELTOUCH:
- inmidi_aftertouch(portno, chan, byte);
- break;
- case MIDIPITCHBEND:
- if (gotbyte1)
- inmidi_pitchbend(portno, chan, ((byte << 7) + byte1)),
- parserp->mp_gotbyte1 = 0;
- else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
- break;
- }
+ parserp->mp_status = byte;
}
- }
+ parserp->mp_gotbyte1 = 0;
+ }
+ else
+ {
+ int cmd = (parserp->mp_status >= 0xf0 ? parserp->mp_status :
+ (parserp->mp_status & 0xf0));
+ int chan = (parserp->mp_status & 0xf);
+ int byte1 = parserp->mp_byte1, gotbyte1 = parserp->mp_gotbyte1;
+ switch (cmd)
+ {
+ case MIDINOTEOFF:
+ if (gotbyte1)
+ inmidi_noteon(portno, chan, byte1, 0),
+ parserp->mp_gotbyte1 = 0;
+ else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
+ break;
+ case MIDINOTEON:
+ if (gotbyte1)
+ inmidi_noteon(portno, chan, byte1, byte),
+ parserp->mp_gotbyte1 = 0;
+ else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
+ break;
+ case MIDIPOLYTOUCH:
+ if (gotbyte1)
+ inmidi_polyaftertouch(portno, chan, byte1, byte),
+ parserp->mp_gotbyte1 = 0;
+ else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
+ break;
+ case MIDICONTROLCHANGE:
+ if (gotbyte1)
+ inmidi_controlchange(portno, chan, byte1, byte),
+ parserp->mp_gotbyte1 = 0;
+ else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
+ break;
+ case MIDIPROGRAMCHANGE:
+ inmidi_programchange(portno, chan, byte);
+ break;
+ case MIDICHANNELTOUCH:
+ inmidi_aftertouch(portno, chan, byte);
+ break;
+ case MIDIPITCHBEND:
+ if (gotbyte1)
+ inmidi_pitchbend(portno, chan, ((byte << 7) + byte1)),
+ parserp->mp_gotbyte1 = 0;
+ else parserp->mp_byte1 = byte, parserp->mp_gotbyte1 = 1;
+ break;
+ case MIDISTARTSYSEX:
+ inmidi_sysex(portno, byte);
+ break;
+
+ /* other kinds of messages are just dropped here. We'll
+ need another status byte before we start letting MIDI in
+ again (no running status across "system" messages). */
+ case MIDITIMECODE: /* 1 data byte*/
+ break;
+ case MIDISONGPOS: /* 2 */
+ break;
+ case MIDISONGSELECT: /* 1 */
+ break;
+ }
+ }
}
midi_intail = (midi_intail + 1 == MIDIQSIZE ? 0 : midi_intail + 1);
}
diff --git a/pd/src/s_midi_mmio.c b/pd/src/s_midi_mmio.c
index ec1a75ee..99b38906 100644
--- a/pd/src/s_midi_mmio.c
+++ b/pd/src/s_midi_mmio.c
@@ -79,8 +79,7 @@ static void msw_open_midiout(int nmidiout, int *midioutvec)
for (i = 0; i < nmidiout; i++)
{
MIDIOUTCAPS mocap;
- int devno = (midioutvec[i] == DEFMIDIDEV ?
- MIDI_MAPPER : midioutvec[i]-1);
+ int devno = midioutvec[i];
result = midiOutOpen(&hMidiOut[dev], devno, 0, 0,
CALLBACK_NULL);
wRtn = midiOutGetDevCaps(i, (LPMIDIOUTCAPS) &mocap,
@@ -534,7 +533,7 @@ void msw_open_midiin(int nmidiin, int *midiinvec)
lpCallbackInstanceData[i]->lpBuf = lpInputBuffer;
wRtn = midiInOpen((LPHMIDIIN)&hMidiIn[ndev],
- midiinvec[i] - 1,
+ midiinvec[i],
(DWORD)midiInputHandler,
(DWORD)lpCallbackInstanceData[ndev],
CALLBACK_FUNCTION);
@@ -661,7 +660,8 @@ void sys_poll_midi(void)
}
}
-void sys_open_midi(int nmidiin, int *midiinvec, int nmidiout, int *midioutvec)
+void sys_do_open_midi(int nmidiin, int *midiinvec,
+ int nmidiout, int *midioutvec)
{
if (nmidiout)
msw_open_midiout(nmidiout, midioutvec);
@@ -680,7 +680,7 @@ void sys_close_midi( void)
msw_close_midiout();
}
-
+#if 0
/* list the audio and MIDI device names */
void sys_listmididevs(void)
{
@@ -713,3 +713,33 @@ void sys_listmididevs(void)
}
}
+#endif
+
+void midi_getdevs(char *indevlist, int *nindevs,
+ char *outdevlist, int *noutdevs, int maxndev, int devdescsize)
+{
+ int i, nin = midiInGetNumDevs(), nout = midiOutGetNumDevs();
+ UINT wRtn;
+ if (nin > maxndev)
+ nin = maxndev;
+ for (i = 0; i < nin; i++)
+ {
+ MIDIINCAPS micap;
+ wRtn = midiInGetDevCaps(i, (LPMIDIINCAPS) &micap, sizeof(micap));
+ strncpy(indevlist + i * devdescsize,
+ (wRtn ? "???" : micap.szPname), devdescsize);
+ indevlist[(i+1) * devdescsize - 1] = 0;
+ }
+ if (nout > maxndev)
+ nout = maxndev;
+ for (i = 0; i < nout; i++)
+ {
+ MIDIOUTCAPS mocap;
+ wRtn = midiOutGetDevCaps(i, (LPMIDIOUTCAPS) &mocap, sizeof(mocap));
+ strncpy(outdevlist + i * devdescsize,
+ (wRtn ? "???" : mocap.szPname), devdescsize);
+ outdevlist[(i+1) * devdescsize - 1] = 0;
+ }
+ *nindevs = nin;
+ *noutdevs = nout;
+}
diff --git a/pd/src/s_midi_pm.c b/pd/src/s_midi_pm.c
index 59959e83..59882fe6 100644
--- a/pd/src/s_midi_pm.c
+++ b/pd/src/s_midi_pm.c
@@ -132,9 +132,93 @@ void sys_putmidimess(int portno, int a, int b, int c)
}
}
+static void writemidi4(PortMidiStream* stream, int a, int b, int c, int d)
+{
+ PmEvent buffer;
+ buffer.timestamp = 0;
+ buffer.message = ((a & 0xff) | ((b & 0xff) << 8)
+ | ((c & 0xff) << 16) | ((d & 0xff) << 24));
+ Pm_Write(stream, &buffer, 1);
+}
+
+
void sys_putmidibyte(int portno, int byte)
{
- post("sorry, no byte-by-byte MIDI output implemented in MAC OSX");
+ /* try to parse the bytes into MIDI messages so they can
+ fit into PortMidi buffers. */
+ static int mess[4];
+ static int nbytes = 0, sysex = 0, i;
+ if (byte >= 0xf8) /* MIDI real time */
+ writemidi4(mac_midioutdevlist[portno], byte, 0, 0, 0);
+ else if (byte == 0xf0)
+ {
+ mess[0] = 0xf7;
+ nbytes = 1;
+ sysex = 1;
+ }
+ else if (byte == 0xf7)
+ {
+ mess[nbytes] = byte;
+ for (i = nbytes+1; i < 4; i++)
+ mess[i] = 0;
+ writemidi4(mac_midioutdevlist[portno],
+ mess[0], mess[1], mess[2], mess[3]);
+ sysex = 0;
+ nbytes = 0;
+ }
+ else if (byte >= 0x80)
+ {
+ sysex = 0;
+ if (byte == 0xf4 || byte == 0xf5 || byte == 0xf6)
+ {
+ writemidi4(mac_midioutdevlist[portno], byte, 0, 0, 0);
+ nbytes = 0;
+ }
+ else
+ {
+ mess[0] = byte;
+ nbytes = 1;
+ }
+ }
+ else if (sysex)
+ {
+ mess[nbytes] = byte;
+ nbytes++;
+ if (nbytes == 4)
+ {
+ writemidi4(mac_midioutdevlist[portno],
+ mess[0], mess[1], mess[2], mess[3]);
+ nbytes = 0;
+ }
+ }
+ else if (nbytes)
+ {
+ int status = mess[0];
+ if (status < 0xf0)
+ status &= 0xf0;
+ /* 2 byte messages: */
+ if (status == 0xc0 || status == 0xd0 ||
+ status == 0xf1 || status == 0xf3)
+ {
+ writemidi4(mac_midioutdevlist[portno],
+ mess[0], byte, 0, 0);
+ nbytes = (status < 0xf0 ? 1 : 0);
+ }
+ else
+ {
+ if (nbytes == 1)
+ {
+ mess[1] = byte;
+ nbytes = 2;
+ }
+ else
+ {
+ writemidi4(mac_midioutdevlist[portno],
+ mess[0], mess[1], byte, 0);
+ nbytes = (status < 0xf0 ? 1 : 0);
+ }
+ }
+ }
}
void sys_poll_midi(void)
diff --git a/pd/src/s_stuff.h b/pd/src/s_stuff.h
index e967d9a3..7a827b8b 100644
--- a/pd/src/s_stuff.h
+++ b/pd/src/s_stuff.h
@@ -135,10 +135,6 @@ void sys_setvirtualalarm( void);
#define API_DEFAULT API_OSS
#define API_DEFSTRING "OSS"
#endif
-#ifdef __FreeBSD__
-#define API_DEFAULT API_OSS
-#define API_DEFSTRING "OSS"
-#endif
#ifdef MSW
#define API_DEFAULT API_MMIO
#define API_DEFSTRING "MMIO"
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index ef10c80b..6140c714 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -123,6 +123,11 @@ pack .controls.dio -side right -padx 20
bind . <Control-Key> {pdtk_pd_ctrlkey %W %K 0}
bind . <Control-Shift-Key> {pdtk_pd_ctrlkey %W %K 1}
+if {$pd_nt == 2} {
+ bind . <Mod1-Key> {pdtk_canvas_ctrlkey %W %K 0}
+ bind . <Mod1-Shift-Key> {pdtk_canvas_ctrlkey %W %K 1}
+}
+
wm title . "Pd"
. configure -menu .mbar -width 200 -height 150
@@ -924,6 +929,10 @@ proc pdtk_canvas_new {name width height geometry editable} {
bind $name.c <Control-Shift-Key> {pdtk_canvas_ctrlkey %W %K 1}
bind $name.c <Alt-Key> {pdtk_canvas_altkey %W %K %A}
# bind $name.c <Mod1-Key> {puts stderr [concat mod1 %W %K %A]}
+ if {$pd_nt == 2} {
+ bind $name.c <Mod1-Key> {pdtk_canvas_ctrlkey %W %K 0}
+ bind $name.c <Mod1-Shift-Key> {pdtk_canvas_ctrlkey %W %K 1}
+ }
bind $name.c <Key> {pdtk_canvas_key %W %K %A 0}
bind $name.c <Shift-Key> {pdtk_canvas_key %W %K %A 1}
bind $name.c <KeyRelease> {pdtk_canvas_keyup %W %K %A}
@@ -2641,6 +2650,15 @@ proc pdtk_pd_startup {version apilist} {
set width7 [font measure -*-courier-bold--normal--36-* x]
set height7 [lindex [font metrics -*-courier-bold--normal--36-*] 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
+ } else {
+ set oldtclversion 0
+ }
pd [concat pd init [pdtk_enquote [pwd]] \
8 $width1 $height1 \
10 $width2 $height2 \
@@ -2649,7 +2667,7 @@ proc pdtk_pd_startup {version apilist} {
16 $width5 $height5 \
24 $width6 $height6 \
36 $width7 $height7 \
- \;];
+ $oldtclversion \;];
# add the audio and help menus to the Pd window. We delayed this
# so that we'd know the value of "apilist".