From 6e17759e69d5d51bafebc4e5e44e1ee5dbaf58fe Mon Sep 17 00:00:00 2001
From: Miller Puckette <millerpuckette@users.sourceforge.net>
Date: Thu, 11 Nov 2004 04:58:21 +0000
Subject: More bug fixes... version 0.38 test10.

svn path=/trunk/; revision=2259
---
 pd/doc/1.manual/x1.htm         | 30 +++++++++++++++-----
 pd/doc/5.reference/0.INTRO.txt | 13 +++++++--
 pd/portmidi_osx/README         |  2 +-
 pd/portmidi_osx/pmdarwin.c     |  2 +-
 pd/portmidi_osx/pmmacosx.c     |  2 +-
 pd/portmidi_osx/ptdarwin.c     |  2 +-
 pd/src/d_array.c               | 21 +++++++++-----
 pd/src/makefile                |  8 +++---
 pd/src/s_audio_pablio.c        |  2 +-
 pd/src/s_entry.c               | 62 ++++--------------------------------------
 pd/src/s_main.c                |  3 +-
 pd/src/u_main.tk               | 33 ++++++++++++++++------
 12 files changed, 88 insertions(+), 92 deletions(-)

diff --git a/pd/doc/1.manual/x1.htm b/pd/doc/1.manual/x1.htm
index c115a510..a9d8caaf 100644
--- a/pd/doc/1.manual/x1.htm
+++ b/pd/doc/1.manual/x1.htm
@@ -77,8 +77,8 @@ downloads; to forums, member pages, a patch exchange.
 
 <P> There is a growing number of Pd-related projects hosted at 
 <A HREF="http://pure-data.sf.net">SourceForge</A>.  This is open to all Pd
-developers, and all are encouraged to join.  Send an email to the pd-dev list,
-<A HREF="pd-dev[AT]iem.kug.ac.at">pd-dev[AT]iem.kug.ac.at</A>, to join.
+developers, and all are encouraged to join; send an email to the pd-dev list
+(see below).
 
 <P>
 Most of the interesting resources related to Pd show up on the Pd mailing list,
@@ -94,13 +94,30 @@ you can contact msp@ucsd.edu for help.
 
 <P> Many extensions to Pd are announced on the mailing list.  In particular,
 for people interested in graphics, there is a A 3D graphics rendering package,
-named GEM, based on OpenGL, was written by Mark Danks, adapted to Linux by
-Guenter Geiger, and is now maintained by Iohannes Zmoelnig.  GEM runs on
+named GEM, based on OpenGL, written by Mark Danks, adapted to Linux by
+Guenter Geiger, and now maintained by Iohannes Zmoelnig.  GEM runs on
 Windows and Linux and probably will run with some coaxing on IRIX.  You can get
 it from: <A href="http://iem.kug.ac.at/GEM">http://iem.kug.ac.at/GEM</A> .
 
-<P> A video processing package, Framestein, is by Juha Vehvilainen.  This runs
-on Windows only: <A href="http://framestein.org"> http://framestein.org </A>.
+<P> At least three video processing packages are available for Pd. The oldest
+is Framestein, by Juha Vehvilainen.  This runs on Windows only: <A
+href="http://framestein.org"> http://framestein.org </A>.
+
+<P> The newer  <A> href="http://zwizwa.fartit.com/pd/pdp/overview.html"> PDP
+<A> library, by Tom Schouten, and its extension <A
+href="http://ydegoyon.free.fr/pidip.html"> PiDiP </A> by Yves Degoyon, run well
+in linux and has been ported to Windows and MacOS.  Video is extremely fast in
+PDP, but is currently limited to 240x320 resolution.  
+
+<P> Mathieu Bouchard has written  <A href=http://artengine.ca/gridflow/>
+Gridflow </A>, which runs on linux and MacOSX.  The mathematical operators are
+more powerful than in PDP, and the design makes smarter use of cache behavior
+in modern CPUs.
+
+All this and much more is described in detail at the 
+<A href="http://puredata.info/community/projects/convention04/">
+first Pd Convention </A>.
+
 
 <P>
 Here are some more Pd links (in the order I found them): <BR>
@@ -112,7 +129,6 @@ Here are some more Pd links (in the order I found them): <BR>
 <a href="http://iem.kug.ac.at/~zmoelnig/index.html">
     Johannes M Zmoelnig</a><br>
 <a href="http://iem.kug.ac.at/~math/pd/"> Norbert Math's Pd page</a> <br>
-<a href="http://iem.kug.ac.at/iemlib/"> Thomas Musil's IEMLIB</a> <br>
 <a href="http://iem.kug.ac.at/pdwiki/">
 Nicolas Lhommet's WikiWikiWeb page for Pd</a><br>
 <a href="http://iem.kug.ac.at/pdb/"> Norbert's searchable list of all known 
diff --git a/pd/doc/5.reference/0.INTRO.txt b/pd/doc/5.reference/0.INTRO.txt
index d7594ecb..8f935404 100644
--- a/pd/doc/5.reference/0.INTRO.txt
+++ b/pd/doc/5.reference/0.INTRO.txt
@@ -82,8 +82,10 @@ dac~ -      audio output
 adc~ -      audio input
 sig~ -      convert numbers to audio signals
 line~ -     generate audio ramps
+vline~ -    deluxe line~
 threshold~  detect signal thresholds
 snapshot~ - sample a signal (convert it back to a number)
+vsnapshot~  deluxe snapshot~
 bang~ -     send a bang message after each DSP block
 samplerate~ get the sample rate
 send~ -     nonlocal signal connection with fanout
@@ -102,6 +104,7 @@ tabwrite~ - write to a table
 tabplay~ -  play back from a table (non-transposing)
 tabread~ -  non-interpolating table read
 tabread4~ - four-point interpolating table read
+tabosc4~ -  wavetable oscillator
 tabsend~ -  write one block continuously to a table
 tabreceive~ read one block continuously from a table
 -------------------- AUDIO FILTERS ------------------------
@@ -114,17 +117,22 @@ bp~ -       band pass filter
 biquad~ -   raw filter
 samphold~ - sample and hold unit
 print~ -    print out one or more "blocks"
+rpole~ -    raw real-valued one-pole filter
+rzero~ -    raw real-valued one-zero filter
+rzero_rev~  rzero~, time-reversed
+cpole~, czero~, czero_rev - corresponding complex-valued filters
 -------------------- AUDIO DELAY ------------------------
 delwrite~ - write to a delay line
 delread~ -  read from a delay line
 vd~ -       read from a delay line at a variable delay time
 ------------------------------ SUBWINDOWS ----------------------------------
 pd -      define a subwindow
+table -   array of numbers in a subwindow
 inlet -   add an inlet to a pd
 outlet -  add an outlet to a pd
-table -   array of numbers in a subwindow
+inlet~, outlet~ - signal versions of inlet, outlet
 ------------------------------ DATA TEMPLATES -----------------------------
-template - define the fields in a template
+struct -     define a data structure
 drawcurve, filledcurve - draw a curve
 drawpolygon, filledpolygon - draw a polygon
 plot -       plot an array field
@@ -142,3 +150,4 @@ scalar -  draw a scalar on parent
 ------------------------------ OBSOLETE ----------------------------
 scope~ (use tabwrite~ now)
 namecanvas
+template (use struct now)
diff --git a/pd/portmidi_osx/README b/pd/portmidi_osx/README
index 0834442c..1629c584 100644
--- a/pd/portmidi_osx/README
+++ b/pd/portmidi_osx/README
@@ -1,6 +1,6 @@
 PortMidi for MacOS X / Darwin
 Jon Parise <jparise@cmu.edu>
-$Date: 2004-11-07 04:04:14 $
+$Date: 2004-11-11 04:58:20 $
 
 This is the MacOS X / Darwin port of the PortMidi library from the Carnegie
 Mellon Computer Music Group.  It is based on the Apple CoreAudio MIDI
diff --git a/pd/portmidi_osx/pmdarwin.c b/pd/portmidi_osx/pmdarwin.c
index a7c6de9b..2df9e5f3 100644
--- a/pd/portmidi_osx/pmdarwin.c
+++ b/pd/portmidi_osx/pmdarwin.c
@@ -2,7 +2,7 @@
  * PortMidi OS-dependent interface for Darwin (MacOS X)
  * Jon Parise <jparise@cmu.edu>
  *
- * $Id: pmdarwin.c,v 1.5 2004-11-07 04:04:14 millerpuckette Exp $
+ * $Id: pmdarwin.c,v 1.6 2004-11-11 04:58:20 millerpuckette Exp $
  *
  * CHANGE LOG:
  * 03Jul03 - X. J. Scott (xjs):
diff --git a/pd/portmidi_osx/pmmacosx.c b/pd/portmidi_osx/pmmacosx.c
index dec63725..fa7c3beb 100644
--- a/pd/portmidi_osx/pmmacosx.c
+++ b/pd/portmidi_osx/pmmacosx.c
@@ -3,7 +3,7 @@
  * 
  * Jon Parise <jparise@cmu.edu>
  *
- * $Id: pmmacosx.c,v 1.5 2004-11-07 04:04:14 millerpuckette Exp $
+ * $Id: pmmacosx.c,v 1.6 2004-11-11 04:58:20 millerpuckette Exp $
  *
  * 27Jun02 XJS (X. J. Scott)
  *   - midi_length():
diff --git a/pd/portmidi_osx/ptdarwin.c b/pd/portmidi_osx/ptdarwin.c
index 5ab94b3c..35c69bae 100644
--- a/pd/portmidi_osx/ptdarwin.c
+++ b/pd/portmidi_osx/ptdarwin.c
@@ -3,7 +3,7 @@
  *
  * Jon Parise <jparise@cmu.edu>
  *
- * $Id: ptdarwin.c,v 1.5 2004-11-07 04:04:14 millerpuckette Exp $
+ * $Id: ptdarwin.c,v 1.6 2004-11-11 04:58:20 millerpuckette Exp $
  */
 
 #include <stdio.h>
diff --git a/pd/src/d_array.c b/pd/src/d_array.c
index 38beff5d..d9f9d280 100644
--- a/pd/src/d_array.c
+++ b/pd/src/d_array.c
@@ -792,6 +792,7 @@ typedef struct _tabreceive
 {
     t_object x_obj;
     float *x_vec;
+    int x_vecsize;
     t_symbol *x_arrayname;
 } t_tabreceive;
 
@@ -801,7 +802,15 @@ static t_int *tabreceive_perform(t_int *w)
     t_float *out = (t_float *)(w[2]);
     int n = w[3];
     t_float *from = x->x_vec;
-    if (from) while (n--) *out++ = *from++;
+    if (from)
+    {
+        int vecsize = x->x_vecsize;
+        while (vecsize--)
+            *out++ = *from++;
+        vecsize = n - x->x_vecsize;
+        while (vecsize--)
+            *out++ = 0;
+    }
     else while (n--) *out++ = 0;
     return (w+4);
 }
@@ -809,21 +818,19 @@ static t_int *tabreceive_perform(t_int *w)
 static void tabreceive_dsp(t_tabreceive *x, t_signal **sp)
 {
     t_garray *a;
-    int vecsize;
-    
     if (!(a = (t_garray *)pd_findbyclass(x->x_arrayname, garray_class)))
     {
         if (*x->x_arrayname->s_name)
             pd_error(x, "tabsend~: %s: no such array", x->x_arrayname->s_name);
     }
-    else if (!garray_getfloatarray(a, &vecsize, &x->x_vec))
+    else if (!garray_getfloatarray(a, &x->x_vecsize, &x->x_vec))
         pd_error(x, "%s: bad template for tabreceive~", x->x_arrayname->s_name);
     else 
     {
-        int n = sp[0]->s_n;
-        if (n < vecsize) vecsize = n;
+        if (x->x_vecsize > sp[0]->s_n)
+            x->x_vecsize = sp[0]->s_n;
         garray_usedindsp(a);
-        dsp_add(tabreceive_perform, 3, x, sp[0]->s_vec, vecsize);
+        dsp_add(tabreceive_perform, 3, x, sp[0]->s_vec, sp[0]->s_n);
     }
 }
 
diff --git a/pd/src/makefile b/pd/src/makefile
index 3db69e30..06723100 100644
--- a/pd/src/makefile
+++ b/pd/src/makefile
@@ -10,14 +10,14 @@ GFLAGS = -DINSTALL_PREFIX=\"$(INSTALL_PREFIX)\"
 
 MANDIR = ${prefix}/man
 
-MORECFLAGS = -DDL_OPEN -DPA_USE_OSS -DPA_LITTLE_ENDIAN -DUNIX -DUNISTD    	 -DUSEAPI_OSS         -I../portaudio/pa_common -I../portaudio/pablio         -I../portaudio/portmidi-macosx 	-fno-strict-aliasing
+MORECFLAGS = -DDL_OPEN -DPA_USE_OSS -DPA_LITTLE_ENDIAN -DUNIX -DUNISTD    	 -DUSEAPI_OSS         -I../portaudio/pa_common -I../portaudio/pablio         -I../portaudio/portmidi-macosx 	-fno-strict-aliasing -DPA_USE_ALSA -DUSEAPI_ALSA
 
 INCLUDE = -I.
 GINCLUDE = $(INCLUDE) 
 GLIB = -ltk8.4 -ltcl8.4  -lX11 -L/usr/X11R6/lib -lrt
 
-LDFLAGS = -Wl,-export-dynamic
-LIB =   -ldl -lpthread
+LDFLAGS = -Wl,-export-dynamic -lasound
+LIB =   -ldl -lpthread -lasound
 
 OPT_CFLAGS = -O6 -funroll-loops -fomit-frame-pointer
 WARN_CFLAGS = -Wall -W -Wstrict-prototypes \
@@ -28,7 +28,7 @@ CFLAGS = -Werror $(ARCH_CFLAGS) $(WARN_CFLAGS) $(OPT_CFLAGS) $(MORECFLAGS)
 
 # the sources
 
-SYSSRC += s_midi_oss.c s_audio_oss.c
+SYSSRC += s_midi_oss.c s_audio_oss.c s_audio_alsa.c s_audio_alsamm.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 \
diff --git a/pd/src/s_audio_pablio.c b/pd/src/s_audio_pablio.c
index e6c1a272..03ef42b3 100644
--- a/pd/src/s_audio_pablio.c
+++ b/pd/src/s_audio_pablio.c
@@ -1,5 +1,5 @@
 /*
- * $Id: s_audio_pablio.c,v 1.3 2004-11-07 04:04:18 millerpuckette Exp $
+ * $Id: s_audio_pablio.c,v 1.4 2004-11-11 04:58:21 millerpuckette Exp $
  * pablio.c
  * Portable Audio Blocking Input/Output utility.
  *
diff --git a/pd/src/s_entry.c b/pd/src/s_entry.c
index e81e45c6..eb49cfc1 100644
--- a/pd/src/s_entry.c
+++ b/pd/src/s_entry.c
@@ -1,78 +1,26 @@
 /* In MSW, this is all there is to pd; the rest sits in a "pdlib" dll so
 that externs can link back to functions defined in pd. */
 
-#include <stdio.h>
-
 int sys_main(int argc, char **argv);
 
 #ifdef MSW
 #include <windows.h>
 #include <stdio.h>
-#include <malloc.h>
-
-#define MAXARGS 1024
-#define MAXARGLEN 1024
 
-/* jsarlo { */
-int tokenizeCommandLineString(char *clString, char **tokens)
-{
-    int i, charCount = 0;
-    int tokCount= 0;
-    int quoteOpen = 0;
-
-    for (i = 0; i < (int)strlen(clString); i++)
-    {
-        if (clString[i] == '"')
-        {
-            quoteOpen = !quoteOpen;
-        }
-        else if (clString[i] == ' ' && !quoteOpen)
-        {
-            tokens[tokCount][charCount] = 0;
-            tokCount++;
-            charCount = 0;
-        }
-        else
-        {
-            tokens[tokCount][charCount] = clString[i];
-            charCount++;
-        }
-    }
-    tokens[tokCount][charCount] = 0;
-    tokCount++;
-    return tokCount;
-}
-
-int WINAPI WinMain(HINSTANCE hInstance, 
+int WINAPI WinMain(HINSTANCE hInstance,
                                HINSTANCE hPrevInstance,
                                LPSTR lpCmdLine,
                                int nCmdShow)
-{
-    int i, argc;
-    char *argv[MAXARGS];
-
-     __try
-    {
-        for (i = 0; i < MAXARGS; i++)
-        {
-            argv[i] = (char *)malloc(MAXARGLEN * sizeof(char));
-        }
-        GetModuleFileName(NULL, argv[0], MAXARGLEN);
-        argc = tokenizeCommandLineString(lpCmdLine, argv + 1) + 1;
-        sys_main(argc, argv);
-        for (i = 0; i < MAXARGS; i++)
-        {
-            free(argv[i]);
-        }
+{ 
+    __try {
+        sys_main(__argc,__argv);
     }
     __finally
-    {
+    { 
         printf("caught an exception; stopping\n");
     }
 }
 
-/* } jsarlo */
-
 #else /* not MSW */
 int main(int argc, char **argv)
 {
diff --git a/pd/src/s_main.c b/pd/src/s_main.c
index 056f5bbf..53a5d39f 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.38 TEST9\n";
+char pd_version[] = "Pd version 0.38 TEST10\n";
 char pd_compiletime[] = __TIME__;
 char pd_compiledate[] = __DATE__;
 
@@ -765,6 +765,7 @@ int sys_argparse(int argc, char **argv)
         else if (!strcmp(*argv, "-stderr"))
         {
             sys_printtostderr = 1;
+            fprintf(stderr, "set it\n");
             argc--; argv++;
         }
         else if (!strcmp(*argv, "-guicmd") && argc > 1)
diff --git a/pd/src/u_main.tk b/pd/src/u_main.tk
index 8d32f954..5320acdc 100644
--- a/pd/src/u_main.tk
+++ b/pd/src/u_main.tk
@@ -3,13 +3,10 @@
 # set pd_nt (bad name) 0 for unix, 1 for microsoft, and 2 for Mac OSX.
 if { $tcl_platform(platform) == "windows" }  {
          set pd_nt 1
-         puts stderr {Configuring for Windows}
 } elseif { $tcl_platform(os) == "Darwin" } {  
          set pd_nt 2
-         puts stderr {Configuring for MacOS X}
 } else { 
          set pd_nt 0
-         puts stderr {Configuring for UNIX}
 }        
 
 # Copyright (c) 1997-1999 Miller Puckette.
@@ -969,10 +966,20 @@ proc pdtk_canvas_new {name width height geometry editable} {
     bind $name.c <Button> {pdtk_canvas_click %W %x %y %b 0}
     bind $name.c <Shift-Button> {pdtk_canvas_click %W %x %y %b 1}
     bind $name.c <Control-Shift-Button> {pdtk_canvas_click %W %x %y %b 3}
-    bind $name.c <Alt-Button> {pdtk_canvas_click %W %x %y %b 4}
-    bind $name.c <Alt-Shift-Button> {pdtk_canvas_click %W %x %y %b 5}
-    bind $name.c <Alt-Control-Button> {pdtk_canvas_click %W %x %y %b 6}
-    bind $name.c <Alt-Control-Shift-Button> {pdtk_canvas_click %W %x %y %b 7}
+    # Alt key is called Option on the Mac
+    if {$pd_nt == 2} {
+    	bind $name.c <Option-Button> {pdtk_canvas_click %W %x %y %b 4}
+    	bind $name.c <Option-Shift-Button> {pdtk_canvas_click %W %x %y %b 5}
+    	bind $name.c <Option-Control-Button> {pdtk_canvas_click %W %x %y %b 6}
+    	bind $name.c <Option-Control-Shift-Button> \
+	    {pdtk_canvas_click %W %x %y %b 7}
+    } else {
+    	bind $name.c <Alt-Button> {pdtk_canvas_click %W %x %y %b 4}
+    	bind $name.c <Alt-Shift-Button> {pdtk_canvas_click %W %x %y %b 5}
+    	bind $name.c <Alt-Control-Button> {pdtk_canvas_click %W %x %y %b 6}
+    	bind $name.c <Alt-Control-Shift-Button> \
+	    {pdtk_canvas_click %W %x %y %b 7}
+    }
     global pd_nt
 # button 2 is the right button on Mac; on other platforms it's button 3.
     if {$pd_nt == 2} {
@@ -993,7 +1000,11 @@ proc pdtk_canvas_new {name width height geometry editable} {
     bind $name.c <ButtonRelease> {pdtk_canvas_mouseup %W %x %y %b}
     bind $name.c <Control-Key> {pdtk_canvas_ctrlkey %W %K 0}
     bind $name.c <Control-Shift-Key> {pdtk_canvas_ctrlkey %W %K 1}
-    bind $name.c <Alt-Key> {pdtk_canvas_altkey %W %K %A}
+    if {$pd_nt == 2} {
+    	bind $name.c <Option-Key> {pdtk_canvas_altkey %W %K %A}
+    } else {
+    	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}
@@ -1003,7 +1014,11 @@ proc pdtk_canvas_new {name width height geometry editable} {
     bind $name.c <Shift-Key> {pdtk_canvas_key %W %K %A 1}
     bind $name.c <KeyRelease> {pdtk_canvas_keyup %W %K %A}
     bind $name.c <Motion> {pdtk_canvas_motion %W %x %y 0}
-    bind $name.c <Alt-Motion> {pdtk_canvas_motion %W %x %y 4}
+    if {$pd_nt == 2} {
+        bind $name.c <Option-Motion> {pdtk_canvas_motion %W %x %y 4}
+    } else { 
+        bind $name.c <Alt-Motion> {pdtk_canvas_motion %W %x %y 4}
+    }   
     bind $name.c <Map> {pdtk_canvas_map %W}
     bind $name.c <Unmap> {pdtk_canvas_unmap %W}
     focus $name.c
-- 
cgit v1.2.1