From 6e17759e69d5d51bafebc4e5e44e1ee5dbaf58fe Mon Sep 17 00:00:00 2001 From: Miller Puckette Date: Thu, 11 Nov 2004 04:58:21 +0000 Subject: More bug fixes... version 0.38 test10. svn path=/trunk/; revision=2259 --- 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 +++++++++++++++++++------- 6 files changed, 50 insertions(+), 79 deletions(-) (limited to 'pd/src') 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 - int sys_main(int argc, char **argv); #ifdef MSW #include #include -#include - -#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