Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21489
Modified Files: Tag: devel_0_37 d_soundfile.c Log Message: fixed bug with with multiple arrays and threadlock for outlets
Index: d_soundfile.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/d_soundfile.c,v retrieving revision 1.1.1.2.2.13 retrieving revision 1.1.1.2.2.14 diff -C2 -d -r1.1.1.2.2.13 -r1.1.1.2.2.14 *** d_soundfile.c 25 Jun 2004 13:48:08 -0000 1.1.1.2.2.13 --- d_soundfile.c 26 Jun 2004 19:51:44 -0000 1.1.1.2.2.14 *************** *** 1375,1378 **** --- 1375,1380 ---- bufframes = SAMPBUFSIZE / (channels * bytespersamp);
+ post("allocating (argc: %d)",argc); + /* allocate memory for new array */ if (resize) *************** *** 1396,1399 **** --- 1398,1402 ---- goto done; } + post("nvec[%d]=%x, size %d",i,nvecs[i],vecsize[i]); } else *************** *** 1417,1422 **** --- 1420,1428 ---- goto done; } + post("nvec[%d]=%x, size %d",i,nvecs[i],vecsize[i]); }
+ post("allocated"); + for (itemsread = 0; itemsread < finalsize; ) { *************** *** 1430,1440 **** }
- /* zero out vectors in excess of number of channels */ - for (i = channels; i < argc; i++) - { - for (j = 0; j < vecsize[i]; j++) - nvecs[j] = 0; - } - /* zero out remaining elements of vectors */ for (i = 0; i < argc; i++) --- 1436,1439 ---- *************** *** 1444,1447 **** --- 1443,1455 ---- }
+ /* zero out vectors in excess of number of channels */ + + for (i = channels; i < argc; i++) + { + for (j = 0; j < vecsize[i]; j++) + nvecs[i][j] = 0; + } + + /* lock the system and reset the garrays */ sys_lock(); *************** *** 1493,1497 **** --- 1501,1507 ---- if (fd >= 0) close (fd); + sys_lock(); outlet_float(x->x_obj.ob_outlet, (float)itemsread); + sys_unlock(); }
*************** *** 1616,1620 **** --- 1626,1632 ---- long bozo = soundfiler_t_dowrite(x, x->x_canvas, argc, argv); + sys_lock(); outlet_float(x->x_obj.ob_outlet, (float)bozo); + sys_lock(); }
*************** *** 1732,1736 **** --- 1744,1750 ----
freebytes (vec, was * elemsize); + sys_lock(); outlet_float(y->x_obj.ob_outlet, (float)atom_getintarg(1,argc,argv)); + sys_unlock(); return;
*************** *** 1837,1841 **** --- 1851,1857 ----
freebytes (vec, size * elemsize); + sys_lock(), outlet_float(y->x_obj.ob_outlet, size); + sys_unlock(); return;