Revision: 10496 http://pure-data.svn.sourceforge.net/pure-data/?rev=10496&view=rev Author: eighthave Date: 2009-01-10 02:18:04 +0000 (Sat, 10 Jan 2009)
Log Message: ----------- checked all merges of files that were modified in branches/pd-extended/v0-40 but had no conflicts with the 0.41-4 merge. Looks like this should all merge cleanly with no problems.
Modified Paths: -------------- branches/pd-extended/0.41/pd/src/g_array.c branches/pd-extended/0.41/pd/src/g_editor.c branches/pd-extended/0.41/pd/src/g_io.c branches/pd-extended/0.41/pd/src/g_readwrite.c branches/pd-extended/0.41/pd/src/g_scalar.c branches/pd-extended/0.41/pd/src/g_text.c branches/pd-extended/0.41/pd/src/m_binbuf.c branches/pd-extended/0.41/pd/src/m_class.c branches/pd-extended/0.41/pd/src/m_glob.c branches/pd-extended/0.41/pd/src/m_sched.c branches/pd-extended/0.41/pd/src/s_audio.c branches/pd-extended/0.41/pd/src/s_loader.c branches/pd-extended/0.41/pd/src/s_midi.c branches/pd-extended/0.41/pd/src/s_midi_alsa.c branches/pd-extended/0.41/pd/src/s_midi_pm.c branches/pd-extended/0.41/pd/src/s_print.c branches/pd-extended/0.41/pd/src/t_tkcmd.c branches/pd-extended/0.41/pd/src/x_arithmetic.c branches/pd-extended/0.41/pd/src/x_connective.c branches/pd-extended/0.41/pd/src/x_list.c branches/pd-extended/0.41/pd/src/x_midi.c branches/pd-extended/0.41/pd/src/x_misc.c branches/pd-extended/0.41/pd/src/x_qlist.c
Modified: branches/pd-extended/0.41/pd/src/g_array.c =================================================================== --- branches/pd-extended/0.41/pd/src/g_array.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/g_array.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -395,7 +395,7 @@ int flags = fflags; int saveit = ((flags & 1) != 0); int style = ((flags & 6) >> 1); - float stylewas = template_getfloat( + t_float stylewas = template_getfloat( template_findbyname(x->x_scalar->sc_template), gensym("style"), x->x_scalar->sc_vec, 1); if (deleteit != 0) @@ -450,7 +450,7 @@ else if (style != stylewas) garray_fittograph(x, size, style); template_setfloat(scalartemplate, gensym("style"), - x->x_scalar->sc_vec, (float)style, 0); + x->x_scalar->sc_vec, (t_float)style, 0);
garray_setsaveit(x, (saveit != 0)); garray_redraw(x); @@ -462,7 +462,7 @@ void garray_arrayviewlist_new(t_garray *x) { int i, xonset=0, yonset=0, type=0, elemsize=0; - float yval; + t_float yval; char cmdbuf[200]; t_symbol *arraytype; t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize); @@ -480,7 +480,7 @@ gfxstub_new(&x->x_gobj.g_pd, x, cmdbuf); for (i = 0; i < ARRAYPAGESIZE && i < a->a_n; i++) { - yval = *(float *)(a->a_vec + + yval = *(t_float *)(a->a_vec + elemsize * i + yonset); sys_vgui(".%sArrayWindow.lb insert %d {%d) %g}\n", x->x_realname->s_name, @@ -495,7 +495,7 @@ t_float fTopItem) { int i, xonset=0, yonset=0, type=0, elemsize=0, topItem; - float yval; + t_float yval; char cmdbuf[200]; t_symbol *arraytype; t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize); @@ -526,7 +526,7 @@ (i < (page + 1) * ARRAYPAGESIZE && i < a->a_n); i++) { - yval = *(float *)(a->a_vec + \ + yval = *(t_float *)(a->a_vec + \ elemsize * i + yonset); sys_vgui(".%sArrayWindow.lb insert %d {%d) %g}\n", x->x_realname->s_name, @@ -577,23 +577,23 @@ /* routine to get screen coordinates of a point in an array */ void array_getcoordinate(t_glist *glist, char *elem, int xonset, int yonset, int wonset, int indx, - float basex, float basey, float xinc, + t_float basex, t_float basey, t_float xinc, t_fielddesc *xfielddesc, t_fielddesc *yfielddesc, t_fielddesc *wfielddesc, - float *xp, float *yp, float *wp) + t_float *xp, t_float *yp, t_float *wp) { - float xval, yval, ypix, wpix; + t_float xval, yval, ypix, wpix; if (xonset >= 0) - xval = *(float *)(elem + xonset); + xval = *(t_float *)(elem + xonset); else xval = indx * xinc; if (yonset >= 0) - yval = *(float *)(elem + yonset); + yval = *(t_float *)(elem + yonset); else yval = 0; ypix = glist_ytopixels(glist, basey + fielddesc_cvttocoord(yfielddesc, yval)); if (wonset >= 0) { /* found "w" field which controls linewidth. */ - float wval = *(float *)(elem + wonset); + t_float wval = *(t_float *)(elem + wonset); wpix = glist_ytopixels(glist, basey + fielddesc_cvttocoord(yfielddesc, yval) + fielddesc_cvttocoord(wfielddesc, wval)) - ypix; @@ -607,8 +607,8 @@ *wp = wpix; }
-static float array_motion_xcumulative; -static float array_motion_ycumulative; +static t_float array_motion_xcumulative; +static t_float array_motion_ycumulative; static t_fielddesc *array_motion_xfield; static t_fielddesc *array_motion_yfield; static t_glist *array_motion_glist; @@ -619,9 +619,9 @@ static int array_motion_npoints; static int array_motion_elemsize; static int array_motion_altkey; -static float array_motion_initx; -static float array_motion_xperpix; -static float array_motion_yperpix; +static t_float array_motion_initx; +static t_float array_motion_xperpix; +static t_float array_motion_yperpix; static int array_motion_lastx; static int array_motion_fatten;
@@ -640,9 +640,9 @@ { t_word *thisword = (t_word *)(((char *)array_motion_wp) + i * array_motion_elemsize); - float xwas = fielddesc_getcoord(array_motion_xfield, + t_float xwas = fielddesc_getcoord(array_motion_xfield, array_motion_template, thisword, 1); - float ywas = (array_motion_yfield ? + t_float ywas = (array_motion_yfield ? fielddesc_getcoord(array_motion_yfield, array_motion_template, thisword, 1) : 0); fielddesc_setcoord(array_motion_xfield, @@ -653,7 +653,7 @@ { if (i == 0) { - float newy = ywas + dy * array_motion_yperpix; + t_float newy = ywas + dy * array_motion_yperpix; if (newy < 0) newy = 0; fielddesc_setcoord(array_motion_yfield, @@ -674,13 +674,13 @@ /* a y-only plot. */ int thisx = array_motion_initx + array_motion_xcumulative + 0.5, x2; int increment, i, nchange; - float newy = array_motion_ycumulative, + t_float newy = array_motion_ycumulative, oldy = fielddesc_getcoord(array_motion_yfield, array_motion_template, (t_word *)(((char *)array_motion_wp) + array_motion_elemsize * array_motion_lastx), 1); - float ydiff = newy - oldy; + t_float ydiff = newy - oldy; if (thisx < 0) thisx = 0; else if (thisx >= array_motion_npoints) thisx = array_motion_npoints - 1; @@ -706,7 +706,7 @@
int scalar_doclick(t_word *data, t_template *template, t_scalar *sc, t_array *ap, struct _glist *owner, - float xloc, float yloc, int xpix, int ypix, + t_float xloc, t_float yloc, int xpix, int ypix, int shift, int alt, int dbl, int doit);
/* try clicking on an element of the array as a scalar (if clicking @@ -714,14 +714,14 @@ static int array_doclick_element(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, t_symbol *elemtemplatesym, - float linewidth, float xloc, float xinc, float yloc, + t_float linewidth, t_float xloc, t_float xinc, t_float yloc, t_fielddesc *xfield, t_fielddesc *yfield, t_fielddesc *wfield, int xpix, int ypix, int shift, int alt, int dbl, int doit) { t_canvas *elemtemplatecanvas; t_template *elemtemplate; int elemsize, yonset, wonset, xonset, i, incr, hit; - float xsum; + t_float xsum;
if (elemtemplatesym == &s_float) return (0); @@ -735,13 +735,13 @@ else incr = array->a_n / 300; for (i = 0, xsum = 0; i < array->a_n; i += incr) { - float usexloc, useyloc; + t_float usexloc, useyloc; if (xonset >= 0) usexloc = xloc + fielddesc_cvttocoord(xfield, - *(float *)(((char *)(array->a_vec) + elemsize * i) + xonset)); + *(t_float *)(((char *)(array->a_vec) + elemsize * i) + xonset)); else usexloc = xloc + xsum, xsum += xinc; useyloc = yloc + (yonset >= 0 ? fielddesc_cvttocoord(yfield, - *(float *)(((char *)(array->a_vec) + elemsize * i) + yonset)) : 0); + *(t_float *)(((char *)(array->a_vec) + elemsize * i) + yonset)) : 0);
if (hit = scalar_doclick( (t_word *)((char *)(array->a_vec) + i * elemsize), @@ -757,7 +757,7 @@ they can be static (look in g_canvas.h for candidates). */ int array_doclick(t_array *array, t_glist *glist, t_scalar *sc, t_array *ap, t_symbol *elemtemplatesym, - float linewidth, float xloc, float xinc, float yloc, float scalarvis, + t_float linewidth, t_float xloc, t_float xinc, t_float yloc, t_float scalarvis, t_fielddesc *xfield, t_fielddesc *yfield, t_fielddesc *wfield, int xpix, int ypix, int shift, int alt, int dbl, int doit) { @@ -769,12 +769,12 @@ &elemtemplate, &elemsize, xfield, yfield, wfield, &xonset, &yonset, &wonset)) { - float best = 100; + t_float best = 100; /* if it has more than 2000 points, just check 1000 of them. */ int incr = (array->a_n <= 2000 ? 1 : array->a_n / 1000); for (i = 0; i < array->a_n; i += incr) { - float pxpix, pypix, pwpix, dx, dy; + t_float pxpix, pypix, pwpix, dx, dy; array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, xonset, yonset, wonset, i, xloc, yloc, xinc, xfield, yfield, wfield, &pxpix, &pypix, &pwpix); @@ -812,7 +812,7 @@ best += 0.001; /* add truncation error margin */ for (i = 0; i < array->a_n; i += incr) { - float pxpix, pypix, pwpix, dx, dy, dy2, dy3; + t_float pxpix, pypix, pwpix, dx, dy, dy2, dy3; array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, xonset, yonset, wonset, i, xloc, yloc, xinc, xfield, yfield, wfield, &pxpix, &pypix, &pwpix); @@ -905,7 +905,7 @@ array_motion_ycumulative = fielddesc_getcoord(yfield, array_motion_template, (t_word *)(elem + i * elemsize), 1); - /* *(float *)((elem + elemsize * i) + yonset); */ + /* *(t_float *)((elem + elemsize * i) + yonset); */ } else { @@ -931,7 +931,7 @@ static void array_getrect(t_array *array, t_glist *glist, int *xp1, int *yp1, int *xp2, int *yp2) { - float x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff; + t_float x1 = 0x7fffffff, y1 = 0x7fffffff, x2 = -0x7fffffff, y2 = -0x7fffffff; t_canvas *elemtemplatecanvas; t_template *elemtemplate; int elemsize, yonset, wonset, xonset, i; @@ -946,7 +946,7 @@ else incr = array->a_n / 300; for (i = 0; i < array->a_n; i += incr) { - float pxpix, pypix, pwpix, dx, dy; + t_float pxpix, pypix, pwpix, dx, dy; array_getcoordinate(glist, (char *)(array->a_vec) + i * elemsize, xonset, yonset, wonset, i, 0, 0, 1, @@ -1053,7 +1053,7 @@ chunk = ARRAYWRITECHUNKSIZE; binbuf_addv(b, "si", gensym("#A"), n2); for (i = 0; i < chunk; i++) - binbuf_addv(b, "f", ((float *)(array->a_vec))[n2+i]); + binbuf_addv(b, "f", ((t_word *)(array->a_vec))[n2+i].w_float); binbuf_addv(b, ";"); n2 += chunk; } @@ -1132,7 +1132,7 @@ /* routine that checks if we're just an array of floats and if so returns the goods */
-int garray_getfloatarray(t_garray *x, int *size, t_float **vec) +int garray_getfloatwords(t_garray *x, int *size, t_word **vec) { int yonset, type, elemsize; t_array *a = garray_getarray_floatonly(x, &yonset, &elemsize); @@ -1147,10 +1147,24 @@ return (0); } *size = garray_npoints(x); - *vec = (float *)garray_vec(x); + *vec = (t_word *)garray_vec(x); return (1); } + /* older, non-64-bit safe version, supplied for older externs */
+int garray_getfloatarray(t_garray *x, int *size, t_float **vec) +{ + if (sizeof(t_word) != sizeof(t_float)) + { + static int warned; + if (!warned) + post( + "warning: extern using garray_getfloatarray() won't work in 64-bit version"); + warned = 1; + } + return (garray_getfloatwords(x, size, (t_word **)vec)); +} + /* set the "saveit" flag */ void garray_setsaveit(t_garray *x, int saveit) { @@ -1168,13 +1182,13 @@ if (!array) error("%s: needs floating-point 'y' field", x->x_realname->s_name); else for (i = 0; i < array->a_n; i++) - *((float *)((char *)array->a_vec + *((t_float *)((char *)array->a_vec + elemsize * i) + yonset) = g; garray_redraw(x); }
/* sum of Fourier components; called from routines below */ -static void garray_dofo(t_garray *x, int npoints, float dcval, +static void garray_dofo(t_garray *x, int npoints, t_float dcval, int nsin, t_float *vsin, int sineflag) { double phase, phaseincr, fj; @@ -1201,7 +1215,7 @@ else for (j = 0, fj = 0; j < nsin; j++, fj += phase) sum += vsin[j] * cos(fj); - *((float *)((array->a_vec + elemsize * i)) + yonset) + *((t_float *)((array->a_vec + elemsize * i)) + yonset) = sum; } garray_redraw(x); @@ -1270,7 +1284,7 @@
for (i = 0, maxv = 0; i < array->a_n; i++) { - double v = *((float *)(array->a_vec + elemsize * i) + double v = *((t_float *)(array->a_vec + elemsize * i) + yonset); if (v > maxv) maxv = v; @@ -1281,7 +1295,7 @@ { renormer = f / maxv; for (i = 0; i < array->a_n; i++) - *((float *)(array->a_vec + elemsize * i) + yonset) + *((t_float *)(array->a_vec + elemsize * i) + yonset) *= renormer; } garray_redraw(x); @@ -1319,7 +1333,7 @@ if (argc <= 0) return; } for (i = 0; i < argc; i++) - *((float *)(array->a_vec + elemsize * (i + firstindex)) + yonset) + *((t_float *)(array->a_vec + elemsize * (i + firstindex)) + yonset) = atom_getfloat(argv + i); } garray_redraw(x); @@ -1390,7 +1404,7 @@ } for (i = 0; i < nelem; i++) { - if (!fscanf(fd, "%f", ((float *)(array->a_vec + + if (!fscanf(fd, "%f", ((t_float *)(array->a_vec + elemsize * i) + yonset))) { post("%s: read %d elements into table of size %d", @@ -1399,7 +1413,7 @@ } } while (i < nelem) - *((float *)(array->a_vec + + *((t_float *)(array->a_vec + elemsize * i) + yonset) = 0, i++; fclose(fd); garray_redraw(x); @@ -1427,7 +1441,7 @@ for (i = 0; i < array->a_n; i++) { if (fprintf(fd, "%g\n", - *(float *)(((array->a_vec + sizeof(t_word) * i)) + yonset)) < 1) + *(t_float *)(((array->a_vec + sizeof(t_word) * i)) + yonset)) < 1) { post("%s: write error", filename->s_name); break;
Modified: branches/pd-extended/0.41/pd/src/g_editor.c =================================================================== --- branches/pd-extended/0.41/pd/src/g_editor.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/g_editor.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -394,7 +394,7 @@ }
void canvas_disconnect(t_canvas *x, - float index1, float outno, float index2, float inno) + t_float index1, t_float outno, t_float index2, t_float inno) { t_linetraverser t; t_outconnect *oc; @@ -802,6 +802,17 @@ && (x1 > *x1p)) *x1p = x1, *y1p = y1, *x2p = x2, *y2p = y2, rval = y; } + /* if there are at least two selected objects, we'd prefer + to find a selected one (never mind which) to the one we got. */ + if (x->gl_editor && x->gl_editor->e_selection && + x->gl_editor->e_selection->sel_next && !glist_isselected(x, y)) + { + t_selection *sel; + for (sel = x->gl_editor->e_selection; sel; sel = sel->sel_next) + if (canvas_hitbox(x, sel->sel_what, xpos, ypos, &x1, &y1, &x2, &y2)) + *x1p = x1, *y1p = y1, *x2p = x2, *y2p = y2, + rval = sel->sel_what; + } return (rval); }
@@ -902,7 +913,7 @@ {
- float xperpix, yperpix, x1, y1, x2, y2, xpix, ypix, xmargin, ymargin; + t_float xperpix, yperpix, x1, y1, x2, y2, xpix, ypix, xmargin, ymargin; int graphme, redraw = 0;
xperpix = atom_getfloatarg(0, argc, argv); @@ -976,7 +987,7 @@
/* called from the gui when a popup menu comes back with "properties," "open," or "help." */ -static void canvas_done_popup(t_canvas *x, float which, float xpos, float ypos) +static void canvas_done_popup(t_canvas *x, t_float which, t_float xpos, t_float ypos) { char pathbuf[FILENAME_MAX], namebuf[FILENAME_MAX]; t_gobj *y; @@ -1215,16 +1226,16 @@ { t_linetraverser t; t_outconnect *oc; - float fx = xpos, fy = ypos; + t_float fx = xpos, fy = ypos; t_glist *glist2 = glist_getcanvas(x); linetraverser_start(&t, glist2); while (oc = linetraverser_next(&t)) { - float lx1 = t.tr_lx1, ly1 = t.tr_ly1, + t_float lx1 = t.tr_lx1, ly1 = t.tr_ly1, lx2 = t.tr_lx2, ly2 = t.tr_ly2; - float area = (lx2 - lx1) * (fy - ly1) - + t_float area = (lx2 - lx1) * (fy - ly1) - (ly2 - ly1) * (fx - lx1); - float dsquare = (lx2-lx1) * (lx2-lx1) + (ly2-ly1) * (ly2-ly1); + t_float dsquare = (lx2-lx1) * (lx2-lx1) + (ly2-ly1) * (ly2-ly1); if (area * area >= 50 * dsquare) continue; if ((lx2-lx1) * (fx-lx1) + (ly2-ly1) * (fy-ly1) < 0) continue; if ((lx2-lx1) * (lx2-fx) + (ly2-ly1) * (ly2-fy) < 0) continue; @@ -1520,9 +1531,9 @@ keynum = 0, gotkeysym = gensym("Right"); #endif if (keynumsym->s_thing && down) - pd_float(keynumsym->s_thing, (float)keynum); + pd_float(keynumsym->s_thing, (t_float)keynum); if (keyupsym->s_thing && !down) - pd_float(keyupsym->s_thing, (float)keynum); + pd_float(keyupsym->s_thing, (t_float)keynum); if (keynamesym->s_thing) { t_atom at[2]; @@ -1539,7 +1550,7 @@ if (x->gl_editor->e_grab && x->gl_editor->e_keyfn && keynum) (* x->gl_editor->e_keyfn) - (x->gl_editor->e_grab, (float)keynum); + (x->gl_editor->e_grab, (t_float)keynum); /* if a text editor is open send the key on, as long as it is either "real" (has a key number) or else is an arrow key. */ else if (x->gl_editor->e_textedfor && (keynum @@ -1580,6 +1591,12 @@ else if (!strcmp(gotkeysym->s_name, "Right")) canvas_displaceselection(x, shift ? 10 : 1, 0); } + /* if control key goes up or down, and if we're in edit mode, change + cursor to indicate how the click action changes */ + if (x && keynum == 0 && x->gl_edit && + !strncmp(gotkeysym->s_name, "Control", 7)) + canvas_setcursor(x, down ? + CURSOR_RUNMODE_NOTHING :CURSOR_EDITMODE_NOTHING); }
void canvas_motion(t_canvas *x, t_floatarg xpos, t_floatarg ypos, @@ -2411,7 +2428,7 @@ static void canvas_font(t_canvas *x, t_floatarg font, t_floatarg resize, t_floatarg whichresize) { - float realresize, realresx = 1, realresy = 1; + t_float realresize, realresx = 1, realresy = 1; t_canvas *x2 = canvas_getrootfor(x); if (!resize) realresize = 1; else
Modified: branches/pd-extended/0.41/pd/src/g_io.c =================================================================== --- branches/pd-extended/0.41/pd/src/g_io.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/g_io.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -295,10 +295,10 @@ t_canvas *x_canvas; t_outlet *x_parentoutlet; int x_bufsize; - t_float *x_buf; /* signal buffer; zero if not a signal */ - t_float *x_endbuf; - t_float *x_empty; /* next to read out of buffer in epilog code */ - t_float *x_write; /* next to write in to buffer */ + t_sample *x_buf; /* signal buffer; zero if not a signal */ + t_sample *x_endbuf; + t_sample *x_empty; /* next to read out of buffer in epilog code */ + t_sample *x_write; /* next to write in to buffer */ int x_hop; /* hopsize */ /* vice versa from the inlet, if we don't block, this holds the parent's outlet signal, valid between the prolog and the dsp setup @@ -376,7 +376,7 @@ t_voutlet *x = (t_voutlet *)(w[1]); t_float *in = (t_float *)(w[2]); int n = (int)(w[3]); - t_float *out = x->x_write, *outwas = out; + t_sample *out = x->x_write, *outwas = out; #if 0 if (tot < 5) post("-in %lx out %lx n %d", in, out, n); if (tot < 5) post("-buf %lx endbuf %lx", x->x_buf, x->x_endbuf); @@ -396,10 +396,10 @@ static t_int *voutlet_doepilog(t_int *w) { t_voutlet *x = (t_voutlet *)(w[1]); - t_float *out = (t_float *)(w[2]); + t_sample *out = (t_sample *)(w[2]);
int n = (int)(w[3]); - t_float *in = x->x_empty; + t_sample *in = x->x_empty; if (x->x_updown.downsample != x->x_updown.upsample) out = x->x_updown.s_vec;
@@ -416,8 +416,8 @@ { t_voutlet *x = (t_voutlet *)(w[1]); int n = (int)(w[2]); - t_float *in = x->x_empty; - t_float *out = x->x_updown.s_vec; + t_sample *in = x->x_empty; + t_sample *out = x->x_updown.s_vec;
#if 0 if (tot < 5) post("outlet in %lx out %lx n %lx", in, out, n), tot++; @@ -510,9 +510,9 @@ if (bufsize < myvecsize) bufsize = myvecsize; if (bufsize != (oldbufsize = x->x_bufsize)) { - t_float *buf = x->x_buf; + t_sample *buf = x->x_buf; t_freebytes(buf, oldbufsize * sizeof(*buf)); - buf = (t_float *)t_getbytes(bufsize * sizeof(*buf)); + buf = (t_sample *)t_getbytes(bufsize * sizeof(*buf)); memset((char *)buf, 0, bufsize * sizeof(*buf)); x->x_bufsize = bufsize; x->x_endbuf = buf + bufsize; @@ -562,7 +562,7 @@ x->x_parentoutlet = canvas_addoutlet(x->x_canvas, &x->x_obj.ob_pd, &s_signal); inlet_new(&x->x_obj, &x->x_obj.ob_pd, &s_signal, &s_signal); - x->x_endbuf = x->x_buf = (t_float *)getbytes(0); + x->x_endbuf = x->x_buf = (t_sample *)getbytes(0); x->x_bufsize = 0;
resample_init(&x->x_updown);
Modified: branches/pd-extended/0.41/pd/src/g_readwrite.c =================================================================== --- branches/pd-extended/0.41/pd/src/g_readwrite.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/g_readwrite.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -258,8 +258,7 @@ else if (*format->s_name) error("qlist_read: unknown flag: %s", format->s_name);
- if (binbuf_read_via_path(b, filename->s_name, - canvas_getdir(canvas)->s_name, cr)) + if (binbuf_read_via_canvas(b, filename->s_name, canvas, cr)) { pd_error(x, "read failed"); binbuf_free(b); @@ -620,15 +619,15 @@ binbuf_addv(b, "ssfffffffff;", gensym("#X"), gensym("coords"), x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2, - (float)x->gl_pixwidth, (float)x->gl_pixheight, - (float)((x->gl_hidetext)?2.:1.), - (float)x->gl_xmargin, (float)x->gl_ymargin); + (t_float)x->gl_pixwidth, (t_float)x->gl_pixheight, + (t_float)((x->gl_hidetext)?2.:1.), + (t_float)x->gl_xmargin, (t_float)x->gl_ymargin); /* otherwise write in 0.38-compatible form */ else binbuf_addv(b, "ssfffffff;", gensym("#X"), gensym("coords"), x->gl_x1, x->gl_y1, x->gl_x2, x->gl_y2, - (float)x->gl_pixwidth, (float)x->gl_pixheight, - (float)x->gl_isgraph); + (t_float)x->gl_pixwidth, (t_float)x->gl_pixheight, + (t_float)x->gl_isgraph); } }
Modified: branches/pd-extended/0.41/pd/src/g_scalar.c =================================================================== --- branches/pd-extended/0.41/pd/src/g_scalar.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/g_scalar.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -49,7 +49,7 @@ int type = datatypes->ds_type; if (type == DT_FLOAT) { - float f; + t_float f; if (argc) { f = atom_getfloat(argv); @@ -145,7 +145,7 @@ }
/* -------------------- widget behavior for scalar ------------ */ -void scalar_getbasexy(t_scalar *x, float *basex, float *basey) +void scalar_getbasexy(t_scalar *x, t_float *basex, t_float *basey) { t_template *template = template_findbyname(x->sc_template); *basex = template_getfloat(template, gensym("x"), x->sc_vec, 0); @@ -160,7 +160,7 @@ t_canvas *templatecanvas = template_findcanvas(template); int x1 = 0x7fffffff, x2 = -0x7fffffff, y1 = 0x7fffffff, y2 = -0x7fffffff; t_gobj *y; - float basex, basey; + t_float basex, basey; scalar_getbasexy(x, &basex, &basey); /* if someone deleted the template canvas, we're just a point */ if (!templatecanvas) @@ -195,45 +195,50 @@ *yp2 = y2; }
-static void scalar_select(t_gobj *z, t_glist *owner, int state) +static void scalar_drawselectrect(t_scalar *x, t_glist *glist, int state) { - t_scalar *x = (t_scalar *)z; - t_symbol *templatesym = x->sc_template; - t_template *tmpl; - t_atom at; - t_gpointer gp; - gpointer_init(&gp); - gpointer_setglist(&gp, owner, x); - SETPOINTER(&at, &gp); if (state) { int x1, y1, x2, y2; - if (tmpl = template_findbyname(templatesym)) - template_notify(tmpl, gensym("select"), 1, &at); - gpointer_unset(&gp); - - scalar_getrect(z, owner, &x1, &y1, &x2, &y2); + + scalar_getrect(&x->sc_gobj, glist, &x1, &y1, &x2, &y2); x1--; x2++; y1--; y2++; sys_vgui(".x%lx.c create line %d %d %d %d %d %d %d %d %d %d \ -width 0 -fill $select_color -tags select%lx\n", - glist_getcanvas(owner), x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, + glist_getcanvas(glist), x1, y1, x1, y2, x2, y2, x2, y1, x1, y1, x); } else { - sys_vgui(".x%lx.c delete select%lx\n", glist_getcanvas(owner), x); - if (tmpl = template_findbyname(templatesym)) - template_notify(tmpl, gensym("deselect"), 1, &at); - + sys_vgui(".x%lx.c delete select%lx\n", glist_getcanvas(glist), x); } }
+static void scalar_select(t_gobj *z, t_glist *owner, int state) +{ + t_scalar *x = (t_scalar *)z; + t_template *tmpl; + t_symbol *templatesym = x->sc_template; + t_atom at; + t_gpointer gp; + gpointer_init(&gp); + gpointer_setglist(&gp, owner, x); + SETPOINTER(&at, &gp); + if (tmpl = template_findbyname(templatesym)) + template_notify(tmpl, (state ? gensym("select") : gensym("deselect")), + 1, &at); + gpointer_unset(&gp); + scalar_drawselectrect(x, owner, state); +} + static void scalar_displace(t_gobj *z, t_glist *glist, int dx, int dy) { t_scalar *x = (t_scalar *)z; t_symbol *templatesym = x->sc_template; t_template *template = template_findbyname(templatesym); t_symbol *zz; + t_atom at[3]; + t_gpointer gp; int xonset, yonset, xtype, ytype, gotx, goty; if (!template) { @@ -252,12 +257,13 @@ if (goty) *(t_float *)(((char *)(x->sc_vec)) + yonset) += dy * (glist_pixelstoy(glist, 1) - glist_pixelstoy(glist, 0)); + gpointer_init(&gp); + gpointer_setglist(&gp, glist, x); + SETPOINTER(&at[0], &gp); + SETFLOAT(&at[1], (t_float)dx); + SETFLOAT(&at[2], (t_float)dy); + template_notify(template, gensym("displace"), 2, at); scalar_redraw(x, glist); - if (glist_isselected(glist, z)) - { - scalar_select(z, glist, 0); - scalar_select(z, glist, 1); - } }
static void scalar_activate(t_gobj *z, t_glist *owner, int state) @@ -277,7 +283,7 @@ t_template *template = template_findbyname(x->sc_template); t_canvas *templatecanvas = template_findcanvas(template); t_gobj *y; - float basex, basey; + t_float basex, basey; scalar_getbasexy(x, &basex, &basey); /* if we don't know how to draw it, make a small rectangle */ if (!templatecanvas) @@ -299,6 +305,11 @@ if (!wb) continue; (*wb->w_parentvisfn)(y, owner, x->sc_vec, template, basex, basey, vis); } + if (glist_isselected(owner, &x->sc_gobj)) + { + scalar_drawselectrect(x, owner, 0); + scalar_drawselectrect(x, owner, 1); + } sys_unqueuegui(x); }
@@ -316,14 +327,14 @@
int scalar_doclick(t_word *data, t_template *template, t_scalar *sc, t_array *ap, struct _glist *owner, - float xloc, float yloc, int xpix, int ypix, + t_float xloc, t_float yloc, int xpix, int ypix, int shift, int alt, int dbl, int doit) { int hit = 0; t_canvas *templatecanvas = template_findcanvas(template); t_gobj *y; - float basex = template_getfloat(template, gensym("x"), data, 0); - float basey = template_getfloat(template, gensym("y"), data, 0); + t_float basex = template_getfloat(template, gensym("x"), data, 0); + t_float basey = template_getfloat(template, gensym("y"), data, 0); for (y = templatecanvas->gl_list; y; y = y->g_next) { t_parentwidgetbehavior *wb = pd_getparentwidget(&y->g_pd);
Modified: branches/pd-extended/0.41/pd/src/g_text.c =================================================================== --- branches/pd-extended/0.41/pd/src/g_text.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/g_text.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -943,7 +943,7 @@ { t_text *x = (t_text *)z; int width, height, iscomment = (x->te_type == T_TEXT); - float x1, y1, x2, y2; + t_float x1, y1, x2, y2;
/* for number boxes, we know width and height a priori, and should report them here so that graphs can get swelled to fit. */
Modified: branches/pd-extended/0.41/pd/src/m_binbuf.c =================================================================== --- branches/pd-extended/0.41/pd/src/m_binbuf.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/m_binbuf.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -391,9 +391,6 @@ x->b_n = newsize; }
- -#define MSTACKSIZE 2048 - void binbuf_print(t_binbuf *x) { int i, startedpost = 0, newline = 1; @@ -535,13 +532,70 @@ return (gensym(buf2)); }
+#define SMALLMSG 5 +#define HUGEMSG 1000 +#ifdef MSW +#include <malloc.h> +#else +#include <alloca.h> +#endif +#if HAVE_ALLOCA +#define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)((n) < HUGEMSG ? \ + alloca((n) * sizeof(t_atom)) : getbytes((n) * sizeof(t_atom)))) +#define ATOMS_FREEA(x, n) ( \ + ((n) < HUGEMSG || (freebytes((x), (n) * sizeof(t_atom)), 0))) +#else +#define ATOMS_ALLOCA(x, n) ((x) = (t_atom *)getbytes((n) * sizeof(t_atom))) +#define ATOMS_FREEA(x, n) (freebytes((x), (n) * sizeof(t_atom))) +#endif + void binbuf_eval(t_binbuf *x, t_pd *target, int argc, t_atom *argv) { - static t_atom mstack[MSTACKSIZE], *msp = mstack, *ems = mstack+MSTACKSIZE; - t_atom *stackwas = msp; + t_atom smallstack[SMALLMSG], *mstack, *msp; t_atom *at = x->b_vec; int ac = x->b_n; - int nargs; + int nargs, maxnargs = 0; + if (ac <= SMALLMSG) + mstack = smallstack; + else + { +#if 1 + /* count number of args in biggest message. The wierd + treatment of "pd_objectmaker" is because when the message + goes out to objectmaker, commas and semis are passed + on as regular args (see below). We're tacitly assuming here + that the pd_objectmaker target can't come up via a named + destination in the message, only because the original "target" + points there. */ + if (target == &pd_objectmaker) + maxnargs = ac; + else + { + int i, j = (target ? 0 : -1); + for (i = 0; i < ac; i++) + { + if (at[i].a_type == A_SEMI) + j = -1; + else if (at[i].a_type == A_COMMA) + j = 0; + else if (++j > maxnargs) + maxnargs = j; + } + } + if (maxnargs <= SMALLMSG) + mstack = smallstack; + else ATOMS_ALLOCA(mstack, maxnargs); +#else + /* just pessimistically allocate enough to hold everything + at once. This turned out to run slower in a simple benchmark + I tried, perhaps because the extra memory allocation + hurt the cache hit rate. */ + maxnargs = ac; + ATOMS_ALLOCA(mstack, maxnargs); +#endif + + } + msp = mstack; while (1) { t_pd *nexttarget; @@ -601,11 +655,6 @@ { t_symbol *s9; if (!ac) goto gotmess; - if (msp >= ems) - { - error("message stack overflow"); - goto broken; - } switch (at->a_type) { case A_SEMI: @@ -671,31 +720,30 @@ gotmess: if (nargs) { - switch (stackwas->a_type) + switch (mstack->a_type) { case A_SYMBOL: - typedmess(target, stackwas->a_w.w_symbol, nargs-1, stackwas+1); + typedmess(target, mstack->a_w.w_symbol, nargs-1, mstack+1); break; case A_BLOB: /* MP 20070106 blob type */ if (nargs == 1) pd_blob(target, stackwas->a_w.w_blob); else pd_list(target, 0, nargs, stackwas); break; case A_FLOAT: - if (nargs == 1) pd_float(target, stackwas->a_w.w_float); - else pd_list(target, 0, nargs, stackwas); + if (nargs == 1) pd_float(target, mstack->a_w.w_float); + else pd_list(target, 0, nargs, mstack); break; } } - msp = stackwas; + msp = mstack; if (!ac) break; target = nexttarget; at++; ac--; } - - return; -broken: - msp = stackwas; +broken: + if (maxnargs > SMALLMSG) + ATOMS_FREEA(mstack, maxnargs); }
static int binbuf_doopen(char *s, int mode) @@ -967,7 +1015,7 @@ atom_getfloatarg(2, natom, nextmess), atom_getfloatarg(5, natom, nextmess) - atom_getfloatarg(3, natom, nextmess), - (float)sys_defaultfont); + (t_float)sys_defaultfont); } } if (!strcmp(first, "#P")) @@ -1050,7 +1098,7 @@ } else if (!strcmp(second, "slider")) { - float inc = atom_getfloatarg(7, natom, nextmess); + t_float inc = atom_getfloatarg(7, natom, nextmess); if (inc <= 0) inc = 1; binbuf_addv(newb, "ssffsffffffsssfffffffff;",
Modified: branches/pd-extended/0.41/pd/src/m_class.c =================================================================== --- branches/pd-extended/0.41/pd/src/m_class.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/m_class.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -422,7 +422,7 @@ { int offset = (*x)->c_floatsignalin; if (offset > 0) - *(t_sample *)(((char *)x) + offset) = f; + *(t_float *)(((char *)x) + offset) = f; else pd_error(x, "%s: float unexpected for signal input", (*x)->c_name->s_name); @@ -481,12 +481,12 @@
static t_symbol *symhash[HASHSIZE];
-t_symbol *dogensym(char *s, t_symbol *oldsym) +t_symbol *dogensym(const char *s, t_symbol *oldsym) { t_symbol **sym1, *sym2; unsigned int hash1 = 0, hash2 = 0; int length = 0; - char *s2 = s; + const char *s2 = s; while (*s2) { hash1 += *s2; @@ -513,7 +513,7 @@ return (sym2); }
-t_symbol *gensym(char *s) +t_symbol *gensym(const char *s) { return(dogensym(s, 0)); }
Modified: branches/pd-extended/0.41/pd/src/m_glob.c =================================================================== --- branches/pd-extended/0.41/pd/src/m_glob.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/m_glob.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -49,6 +49,12 @@ } #endif
+static void glob_version(t_pd *dummy, float f) +{ + if (f > 0) + error("file format newer than this version of Pd (trying anyway...)"); +} + void max_default(t_pd *x, t_symbol *s, int argc, t_atom *argv) { int i; @@ -113,6 +119,8 @@ class_addmethod(glob_pdobject, (t_method)glob_ping, gensym("ping"), 0); class_addmethod(glob_pdobject, (t_method)glob_savepreferences, gensym("save-preferences"), 0); + class_addmethod(glob_pdobject, (t_method)glob_version, + gensym("version"), A_FLOAT, 0); #ifdef UNIX class_addmethod(glob_pdobject, (t_method)glob_watchdog, gensym("watchdog"), 0);
Modified: branches/pd-extended/0.41/pd/src/m_sched.c =================================================================== --- branches/pd-extended/0.41/pd/src/m_sched.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/m_sched.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -9,6 +9,9 @@ #include "m_pd.h" #include "m_imp.h" #include "s_stuff.h" +#ifdef MSW +#include <windows.h> +#endif
/* LATER consider making this variable. It's now the LCM of all sample rates we expect to see: 32000, 44100, 48000, 88200, 96000. */ @@ -17,7 +20,8 @@ #define THREAD_LOCKING #include "pthread.h"
- +#define SYS_QUIT_QUIT 1 +#define SYS_QUIT_RESTART 2 static int sys_quit; double sys_time; static double sys_time_per_msec = TIMEUNITPERSEC / 1000.; @@ -26,6 +30,11 @@ int sys_usecsincelastsleep(void); int sys_sleepgrain;
+void sched_reopenmeplease(void) /* request from s_audio for deferred reopen */ +{ + sys_quit = SYS_QUIT_RESTART; +} + typedef void (*t_clockmethod)(void *client);
struct _clock @@ -284,7 +293,7 @@ } if (sched_meterson) { - float inmax, outmax; + t_sample inmax, outmax; sys_getmeters(&inmax, &outmax); indb = 0.5 + rmstodb(inmax); outdb = 0.5 + rmstodb(outmax); @@ -309,7 +318,7 @@ sched_diddsp + (int)(sys_dacsr /(double)sys_schedblocksize); }
-void glob_meters(void *dummy, float f) +void glob_meters(void *dummy, t_float f) { if (f == 0) sys_getmeters(0, 0); @@ -328,18 +337,26 @@
void dsp_tick(void);
-static int sched_usedacs = 1; +static int sched_useaudio = SCHED_AUDIO_POLL; static double sched_referencerealtime, sched_referencelogicaltime; double sys_time_per_dsp_tick;
-void sched_set_using_dacs(int flag) +void sched_set_using_audio(int flag) { - sched_usedacs = flag; - if (!flag) + sched_useaudio = flag; + if (flag == SCHED_AUDIO_NONE) { sched_referencerealtime = sys_getrealtime(); sched_referencelogicaltime = clock_getlogicaltime(); } + if (flag == SCHED_AUDIO_CALLBACK && + sched_useaudio != SCHED_AUDIO_CALLBACK) + sys_quit = SYS_QUIT_RESTART; + if (flag != SCHED_AUDIO_CALLBACK && + sched_useaudio == SCHED_AUDIO_CALLBACK) + post("sorry, can't turn off callbacks yet; restart Pd"); + /* not right yet! */ + sys_time_per_dsp_tick = (TIMEUNITPERSEC) * ((double)sys_schedblocksize) / sys_dacsr; } @@ -387,7 +404,7 @@ will now sleep. */ int (*sys_idlehook)(void);
-int m_scheduler( void) +static void m_pollingscheduler( void) { int idlecount = 0; sys_time_per_dsp_tick = (TIMEUNITPERSEC) * @@ -398,7 +415,7 @@ #endif
sys_clearhist(); - if (sys_sleepgrain < 1000) + if (sys_sleepgrain < 100) sys_sleepgrain = sys_schedadvance/4; if (sys_sleepgrain < 100) sys_sleepgrain = 100; @@ -412,7 +429,7 @@
sys_addhist(0); waitfortick: - if (sched_usedacs) + if (sched_useaudio != SCHED_AUDIO_NONE) { #ifdef THREAD_LOCKING /* T.Grill - send_dacs may sleep -> @@ -435,6 +452,11 @@ if (!(idlecount & 31)) { static double idletime; + if (sched_useaudio != SCHED_AUDIO_POLL) + { + bug("m_pollingscheduler\n"); + return; + } /* on 32nd idle, start a clock watch; every 32 ensuing idles, check it */ if (idlecount == 32) @@ -443,7 +465,7 @@ { post("audio I/O stuck... closing audio\n"); sys_close_audio(); - sched_set_using_dacs(0); + sched_set_using_audio(SCHED_AUDIO_NONE); goto waitfortick; } } @@ -477,7 +499,6 @@ { sched_pollformeters(); sys_reportidle(); - #ifdef THREAD_LOCKING sys_unlock(); /* unlock while we idle */ #endif @@ -491,21 +512,62 @@ #ifdef THREAD_LOCKING sys_lock(); #endif - sys_addhist(5); sched_didnothing++; - } }
#ifdef THREAD_LOCKING sys_unlock(); #endif +}
+void sched_audio_callbackfn(void) +{ + sys_setmiditimediff(0, 1e-6 * sys_schedadvance); + sys_addhist(1); + sched_tick(sys_time + sys_time_per_dsp_tick); + sys_addhist(2); + sys_pollmidiqueue(); + sys_addhist(3); + sys_pollgui(); + sys_addhist(5); + sched_pollformeters(); + sys_addhist(0); +} + +static void m_callbackscheduler(void) +{ + sys_initmidiqueue(); + while (!sys_quit) + { +#ifdef MSW + Sleep(1000); +#else + sleep(1); +#endif + if (sys_idlehook) + sys_idlehook(); + } +} + +int m_mainloop(void) +{ + while (sys_quit != SYS_QUIT_QUIT) + { + if (sched_useaudio == SCHED_AUDIO_CALLBACK) + m_callbackscheduler(); + else m_pollingscheduler(); + if (sys_quit == SYS_QUIT_RESTART) + { + sys_quit = 0; + sys_close_audio(); + sys_reopen_audio(); + } + } return (0); }
- /* ------------ thread locking ------------------- */
#ifdef THREAD_LOCKING @@ -536,5 +598,5 @@
void sys_exit(void) { - sys_quit = 1; + sys_quit = SYS_QUIT_QUIT; }
Modified: branches/pd-extended/0.41/pd/src/s_audio.c =================================================================== --- branches/pd-extended/0.41/pd/src/s_audio.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/s_audio.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -32,7 +32,7 @@ #define DEVDESCSIZE 80
static void audio_getdevs(char *indevlist, int *nindevs, - char *outdevlist, int *noutdevs, int *canmulti, + char *outdevlist, int *noutdevs, int *canmulti, int *cancallback, int maxndev, int devdescsize);
/* these are set in this file when opening audio, but then may be reduced, @@ -42,14 +42,14 @@ int sys_advance_samples; /* scheduler advance in samples */ int sys_blocksize = 0; /* audio I/O block size in sample frames */ int sys_audioapi = API_DEFAULT; - +int sys_audioapiopened = -1; /* save last API opened for later closing */ static int sys_meters; /* true if we're metering */ -static float sys_inmax; /* max input amplitude */ -static float sys_outmax; /* max output amplitude */ +static t_sample sys_inmax; /* max input amplitude */ +static t_sample sys_outmax; /* max output amplitude */
/* exported variables */ int sys_schedadvance; /* scheduler advance in microseconds */ -float sys_dacsr; +t_float sys_dacsr;
t_sample *sys_soundout; t_sample *sys_soundin; @@ -68,7 +68,13 @@ static int audio_audiochoutdev[MAXAUDIOOUTDEV]; static int audio_rate; static int audio_advance; +static int audio_callback;
+static int audio_callback_is_open; /* reflects true actual state */ +static int audio_nextinchans, audio_nextoutchans; +void sched_audio_callbackfn(void); +void sched_reopenmeplease(void); + static int audio_isopen(void) { return (audio_state && @@ -79,7 +85,7 @@ void sys_get_audio_params( int *pnaudioindev, int *paudioindev, int *chindev, int *pnaudiooutdev, int *paudiooutdev, int *choutdev, - int *prate, int *padvance) + int *prate, int *padvance, int *pcallback) { int i; *pnaudioindev = audio_naudioindev; @@ -92,12 +98,13 @@ choutdev[i] = audio_audiochoutdev[i]; *prate = audio_rate; *padvance = audio_advance; + *pcallback = audio_callback; }
void sys_save_audio_params( int naudioindev, int *audioindev, int *chindev, int naudiooutdev, int *audiooutdev, int *choutdev, - int rate, int advance) + int rate, int advance, int callback) { int i; audio_naudioindev = naudioindev; @@ -110,6 +117,7 @@ audio_audiochoutdev[i] = choutdev[i]; audio_rate = rate; audio_advance = advance; + audio_callback = callback; }
/* init routines for any API which needs to set stuff up before @@ -135,18 +143,18 @@ { int nblk; int inbytes = (chin ? chin : 2) * - (DEFDACBLKSIZE*sizeof(float)); + (DEFDACBLKSIZE*sizeof(t_sample)); int outbytes = (chout ? chout : 2) * - (DEFDACBLKSIZE*sizeof(float)); + (DEFDACBLKSIZE*sizeof(t_sample));
if (sys_soundin) freebytes(sys_soundin, (sys_inchannels? sys_inchannels : 2) * - (DEFDACBLKSIZE*sizeof(float))); + (DEFDACBLKSIZE*sizeof(t_sample))); if (sys_soundout) freebytes(sys_soundout, (sys_outchannels? sys_outchannels : 2) * - (DEFDACBLKSIZE*sizeof(float))); + (DEFDACBLKSIZE*sizeof(t_sample))); sys_inchannels = chin; sys_outchannels = chout; sys_dacsr = sr; @@ -154,10 +162,10 @@ if (sys_advance_samples < 3 * DEFDACBLKSIZE) sys_advance_samples = 3 * DEFDACBLKSIZE;
- sys_soundin = (t_float *)getbytes(inbytes); + sys_soundin = (t_sample *)getbytes(inbytes); memset(sys_soundin, 0, inbytes);
- sys_soundout = (t_float *)getbytes(outbytes); + sys_soundout = (t_sample *)getbytes(outbytes); memset(sys_soundout, 0, outbytes);
if (sys_verbose) @@ -168,14 +176,14 @@
/* ----------------------- public routines ----------------------- */
- /* open audio devices (after cleaning up the specified device and channel - vectors). The audio devices are "zero based" (i.e. "0" means the first - one.) We also save the cleaned-up device specification so that we - can later re-open audio and/or show the settings on a dialog window. */ + /* set audio device settings (after cleaning up the specified device and + channel vectors). The audio devices are "zero based" (i.e. "0" means the + first one.) We can later re-open audio and/or show the settings on a\ + dialog window. */
-void sys_open_audio(int naudioindev, int *audioindev, int nchindev, +void sys_set_audio_settings(int naudioindev, int *audioindev, int nchindev, int *chindev, int naudiooutdev, int *audiooutdev, int nchoutdev, - int *choutdev, int rate, int advance, int enable) + int *choutdev, int rate, int advance, int callback) { int i, *ip; int defaultchannels = SYS_DEFAULTCH; @@ -184,17 +192,13 @@ int realinchans[MAXAUDIOINDEV], realoutchans[MAXAUDIOOUTDEV];
char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; - int indevs = 0, outdevs = 0, canmulti = 0; + int indevs = 0, outdevs = 0, canmulti = 0, cancallback = 0; audio_getdevs(indevlist, &indevs, outdevlist, &outdevs, &canmulti, - MAXNDEV, DEVDESCSIZE); - + &cancallback, MAXNDEV, DEVDESCSIZE); if (sys_externalschedlib) { return; } - /* if we're already open close it */ - if (sys_inchannels || sys_outchannels) - sys_close_audio();
if (rate < 1) rate = DEFAULTSRATE; @@ -322,73 +326,12 @@ outchans += choutdev[i]; nrealoutdev++; } - /* if no input or output devices seem to have been specified, - this really means just disable audio, which we now do. */ - if (!inchans && !outchans) - enable = 0; sys_schedadvance = advance * 1000; - sys_setchsr(inchans, outchans, rate); sys_log_error(ERR_NOTHING); - if (enable) - { -#ifdef USEAPI_PORTAUDIO - if (sys_audioapi == API_PORTAUDIO) - { - int blksize = (sys_blocksize ? sys_blocksize : 64); - pa_open_audio(inchans, outchans, rate, sys_soundin, sys_soundout, - blksize, sys_advance_samples/blksize, - (naudiooutdev > 0 ? audioindev[0] : 0), - (naudiooutdev > 0 ? audiooutdev[0] : 0)); - } -else -#endif -#ifdef USEAPI_JACK - if (sys_audioapi == API_JACK) - jack_open_audio((nrealindev > 0 ? realinchans[0] : 0), - (nrealoutdev > 0 ? realoutchans[0] : 0), rate); - - else -#endif -#ifdef USEAPI_OSS - if (sys_audioapi == API_OSS) - oss_open_audio(nrealindev, realindev, nrealindev, realinchans, - nrealoutdev, realoutdev, nrealoutdev, realoutchans, rate); - else -#endif -#ifdef USEAPI_ALSA - /* for alsa, only one device is supported; it may - be open for both input and output. */ - if (sys_audioapi == API_ALSA) - alsa_open_audio(nrealindev, audioindev, nrealindev, realinchans, - nrealoutdev, audiooutdev, nrealoutdev, realoutchans, rate); - else -#endif -#ifdef USEAPI_SGI - if (sys_audioapi == API_SGI) - { - xtern int sgi_open_audio(int nindev, int *indev, int nchin, - int *chin, int noutdev, int *outdev, int nchout, int *chout, - int rate); - sgi_open_audio(naudioindev, audioindev, nchindev, chindev, - naudiooutdev, audiooutdev, nchoutdev, choutdev, rate); - } - else -#endif -#ifdef USEAPI_MMIO - if (sys_audioapi == API_MMIO) - mmio_open_audio(nrealindev, audioindev, nrealindev, realinchans, - nrealoutdev, audiooutdev, nrealoutdev, realoutchans, rate); - else -#endif - post("unknown audio API specified"); - } - sys_save_audio_params(naudioindev, audioindev, chindev, - naudiooutdev, audiooutdev, choutdev, sys_dacsr, advance); - if (sys_inchannels == 0 && sys_outchannels == 0) - enable = 0; - audio_state = enable; - sys_vgui("set pd_whichapi %d\n", (audio_isopen() ? sys_audioapi : 0)); - sched_set_using_dacs(enable); + audio_nextinchans = inchans; + audio_nextoutchans = outchans; + sys_save_audio_params(nrealindev, realindev, realinchans, + nrealoutdev, realoutdev, realoutchans, rate, advance, callback); }
void sys_close_audio(void) @@ -400,40 +343,36 @@ if (!audio_isopen()) return; #ifdef USEAPI_PORTAUDIO - if (sys_audioapi == API_PORTAUDIO) + if (sys_audioapiopened == API_PORTAUDIO) pa_close_audio(); else #endif #ifdef USEAPI_JACK - if (sys_audioapi == API_JACK) + if (sys_audioapiopened == API_JACK) jack_close_audio(); else #endif #ifdef USEAPI_OSS - if (sys_audioapi == API_OSS) + if (sys_audioapiopened == API_OSS) oss_close_audio(); else #endif #ifdef USEAPI_ALSA - if (sys_audioapi == API_ALSA) + if (sys_audioapiopened == API_ALSA) alsa_close_audio(); else #endif -#ifdef USEAPI_SGI - if (sys_audioapi == API_SGI) - { - extern void sgi_close_audio(void); - sgi_close_audio(); - } - else -#endif #ifdef USEAPI_MMIO - if (sys_audioapi == API_MMIO) + if (sys_audioapiopened == API_MMIO) mmio_close_audio(); else #endif - post("sys_close_audio: unknown API %d", sys_audioapi); + post("sys_close_audio: unknown API %d", sys_audioapiopened); sys_inchannels = sys_outchannels = 0; + sys_audioapiopened = -1; + sched_set_using_audio(SCHED_AUDIO_NONE); + audio_state = 0; + audio_callback_is_open = 0; }
/* open audio using whatever parameters were last used */ @@ -441,11 +380,73 @@ { int naudioindev, audioindev[MAXAUDIOINDEV], chindev[MAXAUDIOINDEV]; int naudiooutdev, audiooutdev[MAXAUDIOOUTDEV], choutdev[MAXAUDIOOUTDEV]; - int rate, advance; + int rate, advance, callback, outcome = 0; sys_get_audio_params(&naudioindev, audioindev, chindev, - &naudiooutdev, audiooutdev, choutdev, &rate, &advance); - sys_open_audio(naudioindev, audioindev, naudioindev, chindev, - naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate, advance, 1); + &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback); + sys_setchsr(audio_nextinchans, audio_nextoutchans, rate); + if (!naudioindev && !naudiooutdev) + { + sched_set_using_audio(SCHED_AUDIO_NONE); + return; + } +#ifdef USEAPI_PORTAUDIO + if (sys_audioapi == API_PORTAUDIO) + { + int blksize = (sys_blocksize ? sys_blocksize : 64); + outcome = pa_open_audio((naudioindev > 0 ? chindev[0] : 0), + (naudiooutdev > 0 ? choutdev[0] : 0), rate, sys_soundin, + sys_soundout, blksize, sys_advance_samples/blksize, + (naudioindev > 0 ? audioindev[0] : 0), + (naudiooutdev > 0 ? audiooutdev[0] : 0), + (callback ? sched_audio_callbackfn : 0)); + } + else +#endif +#ifdef USEAPI_JACK + if (sys_audioapi == API_JACK) + outcome = jack_open_audio((naudioindev > 0 ? chindev[0] : 0), + (naudioindev > 0 ? choutdev[0] : 0), rate); + + else +#endif +#ifdef USEAPI_OSS + if (sys_audioapi == API_OSS) + outcome = oss_open_audio(naudioindev, audioindev, naudioindev, + chindev, naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate); + else +#endif +#ifdef USEAPI_ALSA + /* for alsa, only one device is supported; it may + be open for both input and output. */ + if (sys_audioapi == API_ALSA) + outcome = alsa_open_audio(naudioindev, audioindev, naudioindev, + chindev, naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate); + else +#endif +#ifdef USEAPI_MMIO + if (sys_audioapi == API_MMIO) + outcome = mmio_open_audio(naudioindev, audioindev, naudioindev, + chindev, naudiooutdev, audiooutdev, naudiooutdev, choutdev, rate); + else +#endif + post("unknown audio API specified"); + if (outcome) /* failed */ + { + audio_state = 0; + sched_set_using_audio(SCHED_AUDIO_NONE); + sys_audioapiopened = -1; + audio_callback_is_open = 0; + } + else + { + /* fprintf(stderr, "started w/callback %d\n", callback); */ + audio_state = 1; + sched_set_using_audio( + (callback ? SCHED_AUDIO_CALLBACK : SCHED_AUDIO_POLL)); + sys_audioapiopened = sys_audioapi; + audio_callback_is_open = callback; + } + sys_vgui("set pd_whichapi %d\n", (outcome == 0 ? sys_audioapi : 0)); }
int sys_send_dacs(void) @@ -453,11 +454,11 @@ if (sys_meters) { int i, n; - float maxsamp; + t_sample maxsamp; for (i = 0, n = sys_inchannels * DEFDACBLKSIZE, maxsamp = sys_inmax; i < n; i++) { - float f = sys_soundin[i]; + t_sample f = sys_soundin[i]; if (f > maxsamp) maxsamp = f; else if (-f > maxsamp) maxsamp = -f; } @@ -465,7 +466,7 @@ for (i = 0, n = sys_outchannels * DEFDACBLKSIZE, maxsamp = sys_outmax; i < n; i++) { - float f = sys_soundout[i]; + t_sample f = sys_soundout[i]; if (f > maxsamp) maxsamp = f; else if (-f > maxsamp) maxsamp = -f; } @@ -492,14 +493,6 @@ return (alsa_send_dacs()); else #endif -#ifdef USEAPI_SGI - if (sys_audioapi == API_SGI) - { - extern int sgi_send_dacs(void); - return (sgi_send_dacs()); - } - else -#endif #ifdef USEAPI_MMIO if (sys_audioapi == API_MMIO) return (mmio_send_dacs()); @@ -509,7 +502,7 @@ return (0); }
-float sys_getsr(void) +t_float sys_getsr(void) { return (sys_dacsr); } @@ -524,7 +517,7 @@ return (sys_inchannels); }
-void sys_getmeters(float *inmax, float *outmax) +void sys_getmeters(t_sample *inmax, t_sample *outmax) { if (inmax) { @@ -542,15 +535,17 @@ }
static void audio_getdevs(char *indevlist, int *nindevs, - char *outdevlist, int *noutdevs, int *canmulti, + char *outdevlist, int *noutdevs, int *canmulti, int *cancallback, int maxndev, int devdescsize) { audio_init(); + *cancallback = 0; /* may be overridden by specific API implementation */ #ifdef USEAPI_PORTAUDIO if (sys_audioapi == API_PORTAUDIO) { pa_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, maxndev, devdescsize); + *cancallback = 1; } else #endif @@ -578,17 +573,6 @@ } else #endif -#ifdef USEAPI_SGI - if (sys_audioapi == API_SGI) - { - extern void sgi_getdevs(char *indevlist, int *nindevs, - char *outdevlist, int *noutdevs, int *canmulti, - int maxndev, int devdescsize); - sgi_getdevs(indevlist, nindevs, outdevlist, noutdevs, canmulti, - maxndev, devdescsize); - } - else -#endif #ifdef USEAPI_MMIO if (sys_audioapi == API_MMIO) { @@ -614,10 +598,10 @@ static void sys_listaudiodevs(void ) { char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; - int nindevs = 0, noutdevs = 0, i, canmulti = 0; + int nindevs = 0, noutdevs = 0, i, canmulti = 0, cancallback = 0;
audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, - MAXNDEV, DEVDESCSIZE); + &cancallback, MAXNDEV, DEVDESCSIZE);
if (!nindevs) post("no audio input devices found"); @@ -656,26 +640,26 @@ audioinchan1, audioinchan2, audioinchan3, audioinchan4, audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4, audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4; - int rate, advance; + int rate, advance, callback; /* these are all the devices on your system: */ char indevlist[MAXNDEV*DEVDESCSIZE], outdevlist[MAXNDEV*DEVDESCSIZE]; - int nindevs = 0, noutdevs = 0, canmulti = 0, i; + int nindevs = 0, noutdevs = 0, canmulti = 0, cancallback = 0, i;
audio_getdevs(indevlist, &nindevs, outdevlist, &noutdevs, &canmulti, - MAXNDEV, DEVDESCSIZE); + &cancallback, MAXNDEV, DEVDESCSIZE);
sys_gui("global audio_indevlist; set audio_indevlist {}\n"); for (i = 0; i < nindevs; i++) - sys_vgui("lappend audio_indevlist "%s"\n", + sys_vgui("lappend audio_indevlist {%s}\n", indevlist + i * DEVDESCSIZE);
sys_gui("global audio_outdevlist; set audio_outdevlist {}\n"); for (i = 0; i < noutdevs; i++) - sys_vgui("lappend audio_outdevlist "%s"\n", + sys_vgui("lappend audio_outdevlist {%s}\n", outdevlist + i * DEVDESCSIZE);
sys_get_audio_params(&naudioindev, audioindev, chindev, - &naudiooutdev, audiooutdev, choutdev, &rate, &advance); + &naudiooutdev, audiooutdev, choutdev, &rate, &advance, &callback);
/* post("naudioindev %d naudiooutdev %d longform %f", naudioindev, naudiooutdev, flongform); */ @@ -702,16 +686,18 @@ "pdtk_audio_dialog %%s \ %d %d %d %d %d %d %d %d \ %d %d %d %d %d %d %d %d \ -%d %d %d %d\n", +%d %d %d %d %d\n", audioindev1, audioindev2, audioindev3, audioindev4, audioinchan1, audioinchan2, audioinchan3, audioinchan4, audiooutdev1, audiooutdev2, audiooutdev3, audiooutdev4, audiooutchan1, audiooutchan2, audiooutchan3, audiooutchan4, - rate, advance, canmulti, (flongform != 0)); + rate, advance, canmulti, (cancallback ? callback : -1), + (flongform != 0)); gfxstub_deleteforkey(0); gfxstub_new(&glob_pdobject, (void *)glob_audio_properties, buf); }
+extern int pa_foo; /* new values from dialog window */ void glob_audio_dialog(t_pd *dummy, t_symbol *s, int argc, t_atom *argv) { @@ -724,7 +710,7 @@ /* the new values the dialog came back with: */ int newrate = atom_getintarg(16, argc, argv); int newadvance = atom_getintarg(17, argc, argv); - int statewas; + int newcallback = atom_getintarg(18, argc, argv);
for (i = 0; i < 4; i++) { @@ -756,11 +742,17 @@ noutdev++; } } - - sys_close_audio(); - sys_open_audio(nindev, newaudioindev, nindev, newaudioinchan, + + if (newcallback < 0) + newcallback = 0; + if (!audio_callback_is_open && !newcallback) + sys_close_audio(); + sys_set_audio_settings(nindev, newaudioindev, nindev, newaudioinchan, noutdev, newaudiooutdev, noutdev, newaudiooutchan, - newrate, newadvance, 1); + newrate, newadvance, (newcallback >= 0 ? newcallback : 0)); + if (!audio_callback_is_open && !newcallback) + sys_reopen_audio(); + else sched_reopenmeplease(); }
void sys_listdevs(void ) @@ -785,12 +777,6 @@ sys_listaudiodevs(); else #endif -#ifdef USEAPI_SGI - extern void sgi_listaudiodevs(void); - if (sys_audioapi == API_SGI) - sgi_listaudiodevs(); - else -#endif #ifdef USEAPI_MMIO if (sys_audioapi == API_MMIO) sys_listaudiodevs(); @@ -843,8 +829,6 @@ else if (audio_isopen()) { sys_close_audio(); - audio_state = 0; - sched_set_using_dacs(0); } }
@@ -859,12 +843,8 @@ else { if (audio_isopen()) - { sys_close_audio(); - sched_set_using_dacs(0); - } } - audio_state = onoff; }
void sys_get_audio_apis(char *buf) @@ -891,10 +871,7 @@ #else sprintf(buf + strlen(buf), "{portaudio %d} ", API_PORTAUDIO); #endif -#ifdef USEAPI_SGI - sprintf(buf + strlen(buf), "{SGI %d} ", API_SGI); n++; #endif -#endif n++; #endif #ifdef USEAPI_JACK @@ -904,7 +881,6 @@ /* then again, if only one API (or none) we don't offer any choice. */ if (n < 2) strcpy(buf, "{}"); - }
#ifdef USEAPI_ALSA
Modified: branches/pd-extended/0.41/pd/src/s_loader.c =================================================================== --- branches/pd-extended/0.41/pd/src/s_loader.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/s_loader.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -28,6 +28,9 @@ #endif #include "m_pd.h" #include "s_stuff.h" +#ifdef _MSC_VER /* This is only for Microsoft's compiler, not cygwin, e.g. */ +#define snprintf sprintf_s +#endif
typedef void (*t_xxx)(void);
@@ -43,7 +46,7 @@ static char sys_dllextent[] = ".b_i386", sys_dllextent2[] = ".pd_freebsd"; #endif #ifdef __linux__ -#ifdef __ia64__ +#ifdef __x86_64__ static char sys_dllextent[] = ".l_ia64", sys_dllextent2[] = ".pd_linux"; #else static char sys_dllextent[] = ".l_i386", sys_dllextent2[] = ".pd_linux"; @@ -132,7 +135,7 @@ symname[i] = 0; if (hexmunge) { - memmove(symname+6, symname, strlen(symname+1)); + memmove(symname+6, symname, strlen(symname)+1); strncpy(symname, "setup_", 6); } else strcat(symname, "_setup"); @@ -243,3 +246,37 @@ return ok; }
+int sys_run_scheduler(const char *externalschedlibname, + const char *sys_extraflagsstring) +{ + typedef int (*t_externalschedlibmain)(const char *); + t_externalschedlibmain externalmainfunc; + char filename[MAXPDSTRING]; + snprintf(filename, sizeof(filename), "%s.%s", externalschedlibname, + sys_dllextent); + sys_bashfilename(filename, filename); +#ifdef MSW + { + HINSTANCE ntdll = LoadLibrary(filename); + if (!ntdll) + { + post("%s: couldn't load external scheduler lib ", filename); + return (0); + } + externalmainfunc = + (t_externalschedlibmain)GetProcAddress(ntdll, "main"); + } +#else + { + void *dlobj = dlopen(filename, RTLD_NOW | RTLD_GLOBAL); + if (!dlobj) + { + post("%s: %s", filename, dlerror()); + return (0); + } + externalmainfunc = (t_externalschedlibmain)dlsym(dlobj, + "pd_extern_sched"); + } +#endif + return((*externalmainfunc)(sys_extraflagsstring)); +}
Modified: branches/pd-extended/0.41/pd/src/s_midi.c =================================================================== --- branches/pd-extended/0.41/pd/src/s_midi.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/s_midi.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -245,6 +245,20 @@ sys_queuemidimess(portno, 1, 0xf8, 0,0); }
+void outmidi_byte(int portno, int value) +{ +#ifdef USEAPI_ALSA + if (sys_midiapi == API_ALSA) + { + sys_alsa_putmidibyte(portno, value); + } + else +#endif + { + sys_putmidibyte(portno, value); + } +} + /* ------------------------- MIDI input queue handling ------------------ */ typedef struct midiparser { @@ -664,12 +678,12 @@
sys_gui("global midi_indevlist; set midi_indevlist {none}\n"); for (i = 0; i < nindevs; i++) - sys_vgui("lappend midi_indevlist "%s"\n", + sys_vgui("lappend midi_indevlist {%s}\n", indevlist + i * DEVDESCSIZE);
sys_gui("global midi_outdevlist; set midi_outdevlist {none}\n"); for (i = 0; i < noutdevs; i++) - sys_vgui("lappend midi_outdevlist "%s"\n", + sys_vgui("lappend midi_outdevlist {%s}\n", outdevlist + i * DEVDESCSIZE);
sys_get_midi_params(&nindev, midiindev, &noutdev, midioutdev);
Modified: branches/pd-extended/0.41/pd/src/s_midi_alsa.c =================================================================== --- branches/pd-extended/0.41/pd/src/s_midi_alsa.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/s_midi_alsa.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -51,8 +51,16 @@ int client; int i; snd_seq_client_info_t *alsainfo; + /* do we want to connect pd automatically with other devices ?; see below! */ + /* LATER: think about a flag to enable/disable automatic connection + * (sometimes it could be a pain) + */ + int autoconnect = 1; alsa_nmidiin = 0; alsa_nmidiout = 0; + + if (nmidiout == 0 && nmidiin == 0) return; + if(nmidiin>MAXMIDIINDEV ) { post("midi input ports reduced to maximum %d", MAXMIDIINDEV); @@ -77,25 +85,28 @@ post("couldn't open alsa sequencer"); return; } - for (i=0;i<nmidiout;i++) + for (i=0;i<nmidiin;i++) { int port; sprintf(portname,"Pure Data Midi-In %d",i+1); - port = snd_seq_create_simple_port(midi_handle,portname,SND_SEQ_PORT_CAP_WRITE |SND_SEQ_PORT_CAP_SUBS_WRITE , SND_SEQ_PORT_TYPE_APPLICATION); + port = snd_seq_create_simple_port(midi_handle,portname, + SND_SEQ_PORT_CAP_WRITE |SND_SEQ_PORT_CAP_SUBS_WRITE, + SND_SEQ_PORT_TYPE_APPLICATION); alsa_midiinfd[i] = port; if (port < 0) goto error; }
- for (i=0;i<nmidiin;i++) + for (i=0;i<nmidiout;i++) { int port; sprintf(portname,"Pure Data Midi-Out %d",i+1); - port = snd_seq_create_simple_port(midi_handle,portname, SND_SEQ_PORT_CAP_SUBS_READ | SND_SEQ_PORT_CAP_READ, SND_SEQ_PORT_TYPE_APPLICATION); + port = snd_seq_create_simple_port(midi_handle,portname, + SND_SEQ_PORT_CAP_READ | SND_SEQ_PORT_CAP_SUBS_READ, + SND_SEQ_PORT_TYPE_APPLICATION); alsa_midioutfd[i] = port; if (port < 0) goto error; }
- if (nmidiout == 0 && nmidiin == 0) return; snd_seq_client_info_malloc(&alsainfo); snd_seq_get_client_info(midi_handle,alsainfo); snd_seq_client_info_set_name(alsainfo,"Pure Data"); @@ -107,8 +118,67 @@ snd_midi_event_new(20,&midiev); alsa_nmidiout = nmidiout; alsa_nmidiin = nmidiin; + + /* JMZ: connect all available devices to pd */ + if (autoconnect) + { + + snd_seq_client_info_t *cinfo; + snd_seq_port_info_t *pinfo; + + snd_seq_port_subscribe_t *subs; + snd_seq_addr_t other, topd, frompd; + /* since i don't know how to connect multiple ports + * (connect everything to each port, modulo,...), + * i only fully connect where we have only one single port + */ + if(alsa_nmidiin) + { + topd.client =client; + topd.port =alsa_midiinfd[0]; + } + if(alsa_nmidiout) + { + frompd.client =client; + frompd.port =alsa_midioutfd[0]; + } + + snd_seq_port_subscribe_alloca(&subs); + + snd_seq_client_info_alloca(&cinfo); + snd_seq_port_info_alloca(&pinfo); + snd_seq_client_info_set_client(cinfo, -1); + while (snd_seq_query_next_client(midi_handle, cinfo) >= 0) + { + /* reset query info */ + int client_id=snd_seq_client_info_get_client(cinfo); + + if((SND_SEQ_CLIENT_SYSTEM != client_id)&&(client != client_id)) + { /* skipping port 0 and ourself */ + snd_seq_port_info_set_client(pinfo, client_id); + snd_seq_port_info_set_port(pinfo, -1); + while (snd_seq_query_next_port(midi_handle, pinfo) >= 0) + { + other.client=client_id; + other.port =snd_seq_port_info_get_port(pinfo); + if(1==alsa_nmidiin) /* only autoconnect 1st port */ + { + snd_seq_port_subscribe_set_sender(subs, &other); + snd_seq_port_subscribe_set_dest(subs, &topd); + snd_seq_subscribe_port(midi_handle, subs); + } + if(1==alsa_nmidiout) /* only autoconnect 1st port */ + { + snd_seq_port_subscribe_set_sender(subs, &frompd); + snd_seq_port_subscribe_set_dest(subs, &other); + snd_seq_subscribe_port(midi_handle, subs); + } + } + } + } + } return; - error: + error: sys_setalarm(1000000); post("couldn't open alsa MIDI output device"); return; @@ -173,10 +243,8 @@ { // repack into 1 byte char and put somewhere to point at unsigned char data = (unsigned char)byte; - unsigned char *dataptr = malloc(1); - memcpy(dataptr,&byte,1);
- snd_seq_ev_set_sysex(&ev,1,dataptr); //...set_variable *should* have worked but didn't + snd_seq_ev_set_sysex(&ev,1,&data); //...set_variable *should* have worked but didn't snd_seq_ev_set_direct(&ev); snd_seq_ev_set_subs(&ev); snd_seq_ev_set_source(&ev,alsa_midioutfd[portno]);
Modified: branches/pd-extended/0.41/pd/src/s_midi_pm.c =================================================================== --- branches/pd-extended/0.41/pd/src/s_midi_pm.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/s_midi_pm.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -23,7 +23,6 @@ #include "portaudio.h" #include "portmidi.h" #include "porttime.h" -#include "pminternal.h"
static PmStream *mac_midiindevlist[MAXMIDIINDEV]; static PmStream *mac_midioutdevlist[MAXMIDIOUTDEV]; @@ -142,7 +141,7 @@ writemidi4(mac_midioutdevlist[portno], byte, 0, 0, 0); else if (byte == 0xf0) { - mess[0] = 0xf7; + mess[0] = 0xf0; nbytes = 1; sysex = 1; } @@ -211,6 +210,38 @@ } }
+/* this is non-zero if we are in the middle of transmitting sysex */ + +int nd_sysex_mode=0; + +/* send in 4 bytes of sysex data. if one of the bytes is 0xF7 (sysex end) stop and unset nd_sysex_mode */ +void nd_sysex_inword(int midiindev, int status, int data1, int data2, int data3) +{ + if (nd_sysex_mode) { + sys_midibytein(midiindev, status); + if (status == 0xF7) + nd_sysex_mode = 0; + } + + if (nd_sysex_mode) { + sys_midibytein(midiindev, data1); + if (data1 == 0xF7) + nd_sysex_mode = 0; + } + + if (nd_sysex_mode) { + sys_midibytein(midiindev, data2); + if (data2 == 0xF7) + nd_sysex_mode = 0; + } + + if (nd_sysex_mode) { + sys_midibytein(midiindev, data3); + if (data3 == 0xF7) + nd_sysex_mode = 0; + } +} + void sys_poll_midi(void) { int i, nmess; @@ -223,6 +254,7 @@ int status = Pm_MessageStatus(buffer.message); int data1 = Pm_MessageData1(buffer.message); int data2 = Pm_MessageData2(buffer.message); + int data3 = ((buffer.message >> 24) & 0xFF); int msgtype = (status >> 4) - 8; switch (msgtype) { @@ -241,8 +273,12 @@ sys_midibytein(i, data1); break; case 7: - sys_midibytein(i, status); + nd_sysex_mode=1; + nd_sysex_inword(i, status, data1, data2, data3); break; + default: + if (nd_sysex_mode) + nd_sysex_inword(i, status, data1, data2, data3); } } }
Modified: branches/pd-extended/0.41/pd/src/s_print.c =================================================================== --- branches/pd-extended/0.41/pd/src/s_print.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/s_print.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -83,7 +83,7 @@ } }
-void postfloat(float f) +void postfloat(t_float f) { char buf[80]; t_atom a; @@ -118,7 +118,7 @@ int i; if(level>sys_verbose)return; dopost("verbose("); - postfloat((float)level); + postfloat((t_float)level); dopost("):");
va_start(ap, fmt);
Modified: branches/pd-extended/0.41/pd/src/t_tkcmd.c =================================================================== --- branches/pd-extended/0.41/pd/src/t_tkcmd.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/t_tkcmd.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -429,6 +429,7 @@ #endif
#ifdef HAVE_UNISTD_H + sprintf(cmdbuf, ""%s" -guiport %d\n", pdbuf, portno); childpid = fork(); if (childpid < 0) { @@ -438,7 +439,6 @@ } else if (!childpid) /* we're the child */ { - sprintf(cmdbuf, ""%s" -guiport %d\n", pdbuf, portno); #ifdef DEBUGCONNECT fprintf(debugfd, "%s", cmdbuf); fflush(debugfd); @@ -639,19 +639,11 @@ { const char *argv = Tcl_GetVar(interp, "argv", 0); int portno, argno = 0; - /* argument passing seems to be different in MSW as opposed to - unix-likes. Here we check if we got sent a "port number" as an - argument. If so. we're to connect to a previously running pd (i.e., - pd got started first). If not, we start Pd from here. */ -#ifdef MSW if (argv && (portno = atoi(argv)) > 1) -#else - char *firstspace; - if (argv && (firstspace = strchr(argv, ' ')) && (portno = atoi(firstspace)) > 1) -#endif pdgui_setsock(portno); #ifdef DEBUGCONNECT - debugfd = fopen("/Users/msp/bratwurst", "w"); + pd_portno = portno; + debugfd = fopen("/tmp/bratwurst", "w"); fprintf(debugfd, "turning stderr back on\n"); fflush(debugfd); dup2(fileno(debugfd), 2);
Modified: branches/pd-extended/0.41/pd/src/x_arithmetic.c =================================================================== --- branches/pd-extended/0.41/pd/src/x_arithmetic.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/x_arithmetic.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -575,8 +575,8 @@
static void tan_float(t_object *x, t_float f) { - float c = cosf(f); - float t = (c == 0 ? 0 : sinf(f)/c); + t_float c = cosf(f); + t_float t = (c == 0 ? 0 : sinf(f)/c); outlet_float(x->ob_outlet, t); }
@@ -599,15 +599,12 @@ typedef struct _atan2 { t_object x_ob; - float x_f; + t_float x_f; } t_atan2;
static void *atan2_new(void) { t_atan2 *x = (t_atan2 *)pd_new(atan2_class); - static int warned; - if (!warned) - post("warning: atan2 inlets switched from Pd 0.37 to 0.38"), warned=1; floatinlet_new(&x->x_ob, &x->x_f); x->x_f = 0; outlet_new(&x->x_ob, &s_float); @@ -616,7 +613,7 @@
static void atan2_float(t_atan2 *x, t_float f) { - float r = (f == 0 && x->x_f == 0 ? 0 : atan2f(f, x->x_f)); + t_float r = (f == 0 && x->x_f == 0 ? 0 : atan2f(f, x->x_f)); outlet_float(x->x_ob.ob_outlet, r); }
@@ -631,7 +628,7 @@
static void sqrt_float(t_object *x, t_float f) { - float r = (f > 0 ? sqrtf(f) : 0); + t_float r = (f > 0 ? sqrtf(f) : 0); outlet_float(x->ob_outlet, r); }
@@ -646,7 +643,7 @@
static void log_float(t_object *x, t_float f) { - float r = (f > 0 ? logf(f) : -1000); + t_float r = (f > 0 ? logf(f) : -1000); outlet_float(x->ob_outlet, r); }
@@ -663,7 +660,7 @@ #define MAXLOG 87.3365 static void exp_float(t_object *x, t_float f) { - float g; + t_float g; if (f > MAXLOG) f = MAXLOG; g = expf(f); outlet_float(x->ob_outlet, g); @@ -690,9 +687,9 @@ typedef struct _clip { t_object x_ob; - float x_f1; - float x_f2; - float x_f3; + t_float x_f1; + t_float x_f2; + t_float x_f3; } t_clip;
static void *clip_new(t_floatarg f1, t_floatarg f2)
Modified: branches/pd-extended/0.41/pd/src/x_connective.c =================================================================== --- branches/pd-extended/0.41/pd/src/x_connective.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/x_connective.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -506,7 +506,7 @@ int nelement; if (x->x_type == A_FLOAT) { - float f; + t_float f; if (!argc) return; f = atom_getfloat(argv); for (nelement = x->x_nelement, e = x->x_vec; nelement--; e++) @@ -1056,7 +1056,7 @@ typedef struct _spigot { t_object x_obj; - float x_state; + t_float x_state; } t_spigot;
static void *spigot_new(t_floatarg f) @@ -1117,7 +1117,7 @@ { t_object x_ob; t_outlet *x_out2; - float x_y; + t_float x_y; } t_moses;
static void *moses_new(t_floatarg f) @@ -1173,6 +1173,8 @@
static void until_float(t_until *x, t_float f) { + if (f < 0) + f = 0; x->x_run = 1; x->x_count = f; while (x->x_run && x->x_count)
Modified: branches/pd-extended/0.41/pd/src/x_list.c =================================================================== --- branches/pd-extended/0.41/pd/src/x_list.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/x_list.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -54,6 +54,7 @@ { t_pd l_pd; /* object to point inlets to */ int l_n; /* number of items */ + int l_npointer; /* number of pointers */ t_listelem *l_vec; /* pointer to items */ } t_alist;
@@ -99,7 +100,7 @@ static void alist_init(t_alist *x) { x->l_pd = alist_class; - x->l_n = 0; + x->l_n = x->l_npointer = 0; x->l_vec = 0; }
@@ -126,11 +127,16 @@ return; } x->l_n = argc; + x->l_npointer = 0; for (i = 0; i < argc; i++) { x->l_vec[i].l_a = argv[i]; if (x->l_vec[i].l_a.a_type == A_POINTER) + { + x->l_npointer++; gpointer_copy(x->l_vec[i].l_a.a_w.w_gpointer, &x->l_vec[i].l_p); + x->l_vec[i].l_a.a_w.w_gpointer = &x->l_vec[i].l_p; + } } }
@@ -145,12 +151,17 @@ return; } x->l_n = argc+1; + x->l_npointer = 0; SETSYMBOL(&x->l_vec[0].l_a, s); for (i = 0; i < argc; i++) { x->l_vec[i+1].l_a = argv[i]; if (x->l_vec[i+1].l_a.a_type == A_POINTER) + { + x->l_npointer++; gpointer_copy(x->l_vec[i+1].l_a.a_w.w_gpointer, &x->l_vec[i+1].l_p); + x->l_vec[i].l_a.a_w.w_gpointer = &x->l_vec[i].l_p; + } } }
@@ -161,6 +172,29 @@ to[i] = x->l_vec[i].l_a; }
+ +static void alist_clone(t_alist *x, t_alist *y) +{ + int i; + y->l_pd = alist_class; + y->l_n = x->l_n; + y->l_npointer = x->l_npointer; + if (!(y->l_vec = (t_listelem *)getbytes(y->l_n * sizeof(*y->l_vec)))) + { + y->l_n = 0; + error("list_alloc: out of memory"); + } + else for (i = 0; i < x->l_n; i++) + { + y->l_vec[i].l_a = x->l_vec[i].l_a; + if (y->l_vec[i].l_a.a_type == A_POINTER) + { + gpointer_copy(y->l_vec[i].l_a.a_w.w_gpointer, &y->l_vec[i].l_p); + y->l_vec[i].l_a.a_w.w_gpointer = &y->l_vec[i].l_p; + } + } +} + static void alist_setup(void) { alist_class = class_new(gensym("list inlet"), @@ -196,8 +230,19 @@ int n, outc = x->x_alist.l_n + argc; ATOMS_ALLOCA(outv, outc); atoms_copy(argc, argv, outv); - alist_toatoms(&x->x_alist, outv+argc); - outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); + if (x->x_alist.l_npointer) + { + t_alist y; + alist_clone(&x->x_alist, &y); + alist_toatoms(&y, outv+argc); + outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); + alist_clear(&y); + } + else + { + alist_toatoms(&x->x_alist, outv+argc); + outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); + } ATOMS_FREEA(outv, outc); }
@@ -209,8 +254,19 @@ ATOMS_ALLOCA(outv, outc); SETSYMBOL(outv, s); atoms_copy(argc, argv, outv + 1); - alist_toatoms(&x->x_alist, outv + 1 + argc); - outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); + if (x->x_alist.l_npointer) + { + t_alist y; + alist_clone(&x->x_alist, &y); + alist_toatoms(&y, outv + 1 + argc); + outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); + alist_clear(&y); + } + else + { + alist_toatoms(&x->x_alist, outv + 1 + argc); + outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); + } ATOMS_FREEA(outv, outc); }
@@ -255,22 +311,46 @@ t_atom *outv; int n, outc = x->x_alist.l_n + argc; ATOMS_ALLOCA(outv, outc); - alist_toatoms(&x->x_alist, outv); atoms_copy(argc, argv, outv + x->x_alist.l_n); - outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); + if (x->x_alist.l_npointer) + { + t_alist y; + alist_clone(&x->x_alist, &y); + alist_toatoms(&y, outv); + outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); + alist_clear(&y); + } + else + { + alist_toatoms(&x->x_alist, outv); + outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); + } ATOMS_FREEA(outv, outc); }
+ + static void list_prepend_anything(t_list_prepend *x, t_symbol *s, int argc, t_atom *argv) { t_atom *outv; int n, outc = x->x_alist.l_n + argc + 1; ATOMS_ALLOCA(outv, outc); - alist_toatoms(&x->x_alist, outv); SETSYMBOL(outv + x->x_alist.l_n, s); atoms_copy(argc, argv, outv + x->x_alist.l_n + 1); - outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); + if (x->x_alist.l_npointer) + { + t_alist y; + alist_clone(&x->x_alist, &y); + alist_toatoms(&y, outv); + outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); + alist_clear(&y); + } + else + { + alist_toatoms(&x->x_alist, outv); + outlet_list(x->x_obj.ob_outlet, &s_list, outc, outv); + } ATOMS_FREEA(outv, outc); }
@@ -408,13 +488,13 @@ static void list_length_list(t_list_length *x, t_symbol *s, int argc, t_atom *argv) { - outlet_float(x->x_obj.ob_outlet, (float)argc); + outlet_float(x->x_obj.ob_outlet, (t_float)argc); }
static void list_length_anything(t_list_length *x, t_symbol *s, int argc, t_atom *argv) { - outlet_float(x->x_obj.ob_outlet, (float)argc+1); + outlet_float(x->x_obj.ob_outlet, (t_float)argc+1); }
static void list_length_setup(void)
Modified: branches/pd-extended/0.41/pd/src/x_midi.c =================================================================== --- branches/pd-extended/0.41/pd/src/x_midi.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/x_midi.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -12,7 +12,9 @@ void outmidi_aftertouch(int portno, int channel, int value); void outmidi_polyaftertouch(int portno, int channel, int pitch, int value); void outmidi_mclk(int portno); +void outmidi_byte(int portno, int value);
+ /* ----------------------- midiin and sysexin ------------------------- */
static t_symbol *midiin_sym, *sysexin_sym; @@ -32,8 +34,8 @@ x->x_outlet1 = outlet_new(&x->x_obj, &s_float); x->x_outlet2 = outlet_new(&x->x_obj, &s_float); pd_bind(&x->x_obj.ob_pd, midiin_sym); -#ifndef __linux__ - pd_error(x, "midiin: works under Linux only"); +#ifdef WIN32 + pd_error(x, "midiin: windows: not supported"); #endif return (x); } @@ -55,8 +57,8 @@ x->x_outlet1 = outlet_new(&x->x_obj, &s_float); x->x_outlet2 = outlet_new(&x->x_obj, &s_float); pd_bind(&x->x_obj.ob_pd, sysexin_sym); -#ifndef __linux__ - pd_error(x, "sysexin: works under Linux only"); +#ifdef WIN32 + pd_error(x, "sysexin: windows: not supported"); #endif return (x); } @@ -133,9 +135,9 @@
static void notein_list(t_notein *x, t_symbol *s, int argc, t_atom *argv) { - float pitch = atom_getfloatarg(0, argc, argv); - float velo = atom_getfloatarg(1, argc, argv); - float channel = atom_getfloatarg(2, argc, argv); + t_float pitch = atom_getfloatarg(0, argc, argv); + t_float velo = atom_getfloatarg(1, argc, argv); + t_float channel = atom_getfloatarg(2, argc, argv); if (x->x_channel != 0) { if (channel != x->x_channel) return; @@ -274,8 +276,8 @@
static void pgmin_list(t_pgmin *x, t_symbol *s, int argc, t_atom *argv) { - float value = atom_getfloatarg(0, argc, argv); - float channel = atom_getfloatarg(1, argc, argv); + t_float value = atom_getfloatarg(0, argc, argv); + t_float channel = atom_getfloatarg(1, argc, argv); if (x->x_channel != 0) { if (channel != x->x_channel) return; @@ -540,8 +542,8 @@
static void midiclkin_list(t_midiclkin *x, t_symbol *s, int argc, t_atom *argv) { - float value = atom_getfloatarg(0, argc, argv); - float count = atom_getfloatarg(1, argc, argv); + t_float value = atom_getfloatarg(0, argc, argv); + t_float count = atom_getfloatarg(1, argc, argv); outlet_float(x->x_outlet2, count); outlet_float(x->x_outlet1, value); } @@ -564,9 +566,9 @@ void inmidi_clk(double timing) {
- static float prev = 0; - static float count = 0; - float cur,diff; + static t_float prev = 0; + static t_float count = 0; + t_float cur,diff;
if (midiclkin_sym->s_thing) { @@ -615,8 +617,8 @@ static void midirealtimein_list(t_midirealtimein *x, t_symbol *s, int argc, t_atom *argv) { - float portno = atom_getfloatarg(0, argc, argv); - float byte = atom_getfloatarg(1, argc, argv); + t_float portno = atom_getfloatarg(0, argc, argv); + t_float byte = atom_getfloatarg(1, argc, argv);
outlet_float(x->x_outlet2, portno); outlet_float(x->x_outlet1, byte); @@ -674,7 +676,7 @@
static void midiout_float(t_midiout *x, t_floatarg f) { - sys_putmidibyte(x->x_portno - 1, f); + outmidi_byte(x->x_portno - 1, f); }
static void midiout_setup(void) @@ -1058,7 +1060,7 @@
typedef struct voice { - float v_pitch; + t_float v_pitch; int v_used; unsigned long v_serial; } t_voice; @@ -1068,14 +1070,14 @@ t_object x_obj; int x_n; t_voice *x_vec; - float x_vel; + t_float x_vel; t_outlet *x_pitchout; t_outlet *x_velout; unsigned long x_serial; int x_steal; } t_poly;
-static void *poly_new(float fnvoice, float fsteal) +static void *poly_new(t_float fnvoice, t_float fsteal) { int i, n = fnvoice; t_poly *x = (t_poly *)pd_new(poly_class);
Modified: branches/pd-extended/0.41/pd/src/x_misc.c =================================================================== --- branches/pd-extended/0.41/pd/src/x_misc.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/x_misc.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -29,8 +29,11 @@ #endif
#if defined (__APPLE__) || defined (__FreeBSD__) -#define HZ CLK_TCK +#define CLOCKHZ CLK_TCK #endif +#if defined (__linux__) +#define CLOCKHZ sysconf(_SC_CLK_TCK) +#endif
/* -------------------------- random ------------------------------ */ /* this is strictly homebrew and untested. */ @@ -74,7 +77,7 @@ outlet_float(x->x_obj.ob_outlet, nval); }
-static void random_seed(t_random *x, float f, float glob) +static void random_seed(t_random *x, t_float f, t_float glob) { x->x_state = f; } @@ -292,16 +295,16 @@ static void cputime_bang2(t_cputime *x) { #ifdef HAVE_UNISTD_H - float elapsedcpu; + t_float elapsedcpu; struct tms newcputime; times(&newcputime); elapsedcpu = 1000 * ( newcputime.tms_utime + newcputime.tms_stime - - x->x_setcputime.tms_utime - x->x_setcputime.tms_stime) / HZ; + x->x_setcputime.tms_utime - x->x_setcputime.tms_stime) / CLOCKHZ; outlet_float(x->x_obj.ob_outlet, elapsedcpu); #endif #ifdef MSW - float elapsedcpu; + t_float elapsedcpu; FILETIME ignorethis, ignorethat; LARGE_INTEGER usertime, kerneltime; BOOL retval;
Modified: branches/pd-extended/0.41/pd/src/x_qlist.c =================================================================== --- branches/pd-extended/0.41/pd/src/x_qlist.c 2009-01-10 01:15:48 UTC (rev 10495) +++ branches/pd-extended/0.41/pd/src/x_qlist.c 2009-01-10 02:18:04 UTC (rev 10496) @@ -22,9 +22,9 @@ void *x_binbuf; int x_onset; /* playback position */ t_clock *x_clock; - float x_tempo; + t_float x_tempo; double x_whenclockset; - float x_clockdelay; + t_float x_clockdelay; t_symbol *x_dir; t_canvas *x_canvas; int x_reentered; @@ -104,7 +104,8 @@ if (ap->a_type != A_SYMBOL) continue; else if (!(target = ap->a_w.w_symbol->s_thing)) { - error("qlist: %s: no such object", ap->a_w.w_symbol->s_name); + pd_error(x, "qlist: %s: no such object", + ap->a_w.w_symbol->s_name); continue; } ap++; @@ -184,10 +185,10 @@ if (!strcmp(format->s_name, "cr")) cr = 1; else if (*format->s_name) - error("qlist_read: unknown flag: %s", format->s_name); + pd_error(x, "qlist_read: unknown flag: %s", format->s_name);
if (binbuf_read_via_canvas(x->x_binbuf, filename->s_name, x->x_canvas, cr)) - error("%s: read failed", filename->s_name); + pd_error(x, "%s: read failed", filename->s_name); x->x_onset = 0x7fffffff; x->x_reentered = 1; } @@ -201,9 +202,9 @@ if (!strcmp(format->s_name, "cr")) cr = 1; else if (*format->s_name) - error("qlist_read: unknown flag: %s", format->s_name); + pd_error(x, "qlist_read: unknown flag: %s", format->s_name); if (binbuf_write(x->x_binbuf, buf, "", cr)) - error("%s: write failed", filename->s_name); + pd_error(x, "%s: write failed", filename->s_name); }
static void qlist_print(t_qlist *x) @@ -214,14 +215,14 @@
static void qlist_tempo(t_qlist *x, t_float f) { - float newtempo; + t_float newtempo; if (f < 1e-20) f = 1e-20; else if (f > 1e20) f = 1e20; newtempo = 1./f; if (x->x_whenclockset != 0) { - float elapsed = clock_gettimesince(x->x_whenclockset); - float left = x->x_clockdelay - elapsed; + t_float elapsed = clock_gettimesince(x->x_whenclockset); + t_float left = x->x_clockdelay - elapsed; if (left < 0) left = 0; left *= newtempo / x->x_tempo; clock_delay(x->x_clock, left);
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.