Update of /cvsroot/pure-data/pd/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1693
Modified Files: Tag: devel_0_37 d_soundfile.c g_array.c notes.txt s_audio_jack.c s_audio_mmio.c s_inter.c Log Message: merged in version 0.37.1
Index: notes.txt =================================================================== RCS file: /cvsroot/pure-data/pd/src/notes.txt,v retrieving revision 1.1.1.4.2.5 retrieving revision 1.1.1.4.2.6 diff -C2 -d -r1.1.1.4.2.5 -r1.1.1.4.2.6 *** notes.txt 14 Jan 2004 15:45:39 -0000 1.1.1.4.2.5 --- notes.txt 6 May 2004 08:28:12 -0000 1.1.1.4.2.6 *************** *** 1,15 **** ---------------- dolist --------------------
! fix for 0.37: ! pd exit, bad filedesc ! Make install makes an externs, and anyway, doesn't put help files in extra read xx.txt in "bad" gives warnings ! mess with RME ALSA some more; ALSA readn doesn't work yet. test MIDI I/O on all platforms, inc. sysex... ! windows quit doesn't confirm on Windows? ! check Pd in OSX 10.3 ! OSS seems not to detect FIFO out of kilter ! ! 0.38: %x to %lx in all "tags" to make 64-bit safe plug-in support --- 1,10 ---- ---------------- dolist --------------------
! 0.38: read xx.txt in "bad" gives warnings ! mess with RME ALSA some more; ALSA readn doesn't work yet; use mmap? test MIDI I/O on all platforms, inc. sysex... ! document env~ second argument (and why is it no less than 1/10 of first???) ! make watchdog work for MACOSX %x to %lx in all "tags" to make 64-bit safe plug-in support *************** *** 20,23 **** --- 15,19 ---- signal inlets to sense signals; fix +~ etc, vcf~, biquad~, and make a vcfb~
+ makefile to set SETUID bit on install? loading e-mailed patches without removing headers crashes pd *************** *** 48,51 **** --- 44,49 ----
problems: + writesf -- "open" without "0" misses closing the previous file. + Also writesf~ acts differently if DSP is off when "open" is sent? qlist - 'next 1' seems not to work arrays of non-existent templates crash
Index: g_array.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/g_array.c,v retrieving revision 1.1.1.3.2.2 retrieving revision 1.1.1.3.2.3 diff -C2 -d -r1.1.1.3.2.2 -r1.1.1.3.2.3 *** g_array.c 12 Sep 2003 20:55:31 -0000 1.1.1.3.2.2 --- g_array.c 6 May 2004 08:28:12 -0000 1.1.1.3.2.3 *************** *** 971,975 **** maxv = -v; } ! if (maxv >= 0) { renormer = f / maxv; --- 971,975 ---- maxv = -v; } ! if (maxv > 0) { renormer = f / maxv;
Index: d_soundfile.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/d_soundfile.c,v retrieving revision 1.1.1.2.2.2 retrieving revision 1.1.1.2.2.3 diff -C2 -d -r1.1.1.2.2.2 -r1.1.1.2.2.3 *** d_soundfile.c 22 Feb 2004 17:36:50 -0000 1.1.1.2.2.2 --- d_soundfile.c 6 May 2004 08:28:12 -0000 1.1.1.2.2.3 *************** *** 186,191 **** /******************** soundfile access routines **********************/
- void readsf_banana( void); /* debugging */ - /* This routine opens a file, looks for either a nextstep or "wave" header, * seeks to end of it, and fills in bytes per sample and number of channels. --- 186,189 ---- *************** *** 373,376 **** --- 371,377 ---- if (sysrtn != nchannels * bytespersamp * skipframes + headersize) return (-1); + bytelimit -= nchannels * bytespersamp * skipframes; + if (bytelimit < 0) + bytelimit = 0; /* copy sample format back to caller */ *p_bigendian = bigendian; *************** *** 579,582 **** --- 580,584 ---- bigendian = garray_ambigendian(); } + else bigendian = endianness; swap = (bigendian != garray_ambigendian()); if (!argc || argv->a_type != A_SYMBOL) *************** *** 1018,1023 **** framesinfile = maxsize; } ! if (framesinfile > bytelimit / bytespersamp) ! framesinfile = bytelimit / bytespersamp; finalsize = framesinfile; for (i = 0; i < argc; i++) --- 1020,1025 ---- framesinfile = maxsize; } ! if (framesinfile > bytelimit / (channels * bytespersamp)) ! framesinfile = bytelimit / (channels * bytespersamp); finalsize = framesinfile; for (i = 0; i < argc; i++) *************** *** 1038,1043 **** } if (!finalsize) finalsize = 0x7fffffff; ! if (finalsize > bytelimit / bytespersamp) ! finalsize = bytelimit / bytespersamp; fp = fdopen(fd, "rb"); bufframes = SAMPBUFSIZE / (channels * bytespersamp); --- 1040,1045 ---- } if (!finalsize) finalsize = 0x7fffffff; ! if (finalsize > bytelimit / (channels * bytespersamp)) ! finalsize = bytelimit / (channels * bytespersamp); fp = fdopen(fd, "rb"); bufframes = SAMPBUFSIZE / (channels * bytespersamp); *************** *** 1306,1311 **** write(2, s, strlen(s)); } ! #else ! #define pute(x) #endif
--- 1308,1312 ---- write(2, s, strlen(s)); } ! #define DEBUG_SOUNDFILE #endif
*************** *** 1326,1340 **** }
- void readsf_banana( void) - { - struct timeval timout; - timout.tv_sec = 0; - timout.tv_usec = 200000; - pute("banana1\n"); - select(0, 0, 0, 0, &timout); - pute("banana2\n"); - } - - #define sfread_cond_wait(a,b) readsf_fakewait(b) #define sfread_cond_signal(a) --- 1327,1330 ---- *************** *** 1344,1348 **** --- 1334,1340 ---- { t_readsf *x = zz; + #ifdef DEBUG_SOUNDFILE pute("1\n"); + #endif pthread_mutex_lock(&x->x_mutex); while (1) *************** *** 1350,1360 **** --- 1342,1358 ---- int fd, fifohead; char *buf; + #ifdef DEBUG_SOUNDFILE pute("0\n"); + #endif if (x->x_requestcode == REQUEST_NOTHING) { + #ifdef DEBUG_SOUNDFILE pute("wait 2\n"); + #endif sfread_cond_signal(&x->x_answercondition); sfread_cond_wait(&x->x_requestcondition, &x->x_mutex); + #ifdef DEBUG_SOUNDFILE pute("3\n"); + #endif } else if (x->x_requestcode == REQUEST_OPEN) *************** *** 1375,1379 **** --- 1373,1379 ---- /* alter the request code so that an ensuing "open" will get noticed. */ + #ifdef DEBUG_SOUNDFILE pute("4\n"); + #endif x->x_requestcode = REQUEST_BUSY; x->x_fileerror = 0; *************** *** 1397,1401 **** --- 1397,1403 ---- pthread_mutex_lock(&x->x_mutex);
+ #ifdef DEBUG_SOUNDFILE pute("5\n"); + #endif /* copy back into the instance structure. */ x->x_bytespersample = bytespersample; *************** *** 1408,1414 **** --- 1410,1418 ---- x->x_fileerror = errno; x->x_eof = 1; + #ifdef DEBUG_SOUNDFILE pute("open failed\n"); pute(filename); pute(dirname); + #endif goto lost; } *************** *** 1416,1420 **** --- 1420,1426 ---- if (x->x_requestcode != REQUEST_BUSY) goto lost; + #ifdef DEBUG_SOUNDFILE pute("6\n"); + #endif x->x_fifohead = 0; /* set fifosize from bufsize. fifosize must be a *************** *** 1430,1434 **** --- 1436,1442 ---- sprintf(boo, "fifosize %d\n", x->x_fifosize); + #ifdef DEBUG_SOUNDFILE pute(boo); + #endif x->x_sigcountdown = x->x_sigperiod = (x->x_fifosize / *************** *** 1440,1444 **** --- 1448,1454 ---- { int fifosize = x->x_fifosize; + #ifdef DEBUG_SOUNDFILE pute("77\n"); + #endif if (x->x_eof) break; *************** *** 1460,1473 **** --- 1470,1491 ---- sprintf(boo, "head %d, tail %d, size %d\n", x->x_fifohead, x->x_fifotail, wantbytes); + #ifdef DEBUG_SOUNDFILE pute(boo); + #endif } else { + #ifdef DEBUG_SOUNDFILE pute("wait 7a ...\n"); + #endif sfread_cond_signal(&x->x_answercondition); + #ifdef DEBUG_SOUNDFILE pute("signalled\n"); + #endif sfread_cond_wait(&x->x_requestcondition, &x->x_mutex); + #ifdef DEBUG_SOUNDFILE pute("7a done\n"); + #endif continue; } *************** *** 1480,1493 **** --- 1498,1519 ---- if (wantbytes < READSIZE) { + #ifdef DEBUG_SOUNDFILE pute("wait 7...\n"); + #endif sfread_cond_signal(&x->x_answercondition); sfread_cond_wait(&x->x_requestcondition, &x->x_mutex); + #ifdef DEBUG_SOUNDFILE pute("7 done\n"); + #endif continue; } else wantbytes = READSIZE; + if (wantbytes > x->x_bytelimit) + wantbytes = x->x_bytelimit; } + #ifdef DEBUG_SOUNDFILE pute("8\n"); + #endif fd = x->x_fd; buf = x->x_buf; *************** *** 1500,1504 **** --- 1526,1532 ---- if (sysrtn < 0) { + #ifdef DEBUG_SOUNDFILE pute("fileerror\n"); + #endif x->x_fileerror = errno; break; *************** *** 1521,1527 **** --- 1549,1557 ---- x->x_fifohead = 0; } + #ifdef DEBUG_SOUNDFILE sprintf(boo, "after: head %d, tail %d\n", x->x_fifohead, x->x_fifotail); pute(boo); + #endif /* signal parent in case it's waiting for data */ sfread_cond_signal(&x->x_answercondition); *************** *** 1574,1581 **** --- 1604,1615 ---- else { + #ifdef DEBUG_SOUNDFILE pute("13\n"); + #endif } } + #ifdef DEBUG_SOUNDFILE pute("thread exit\n"); + #endif pthread_mutex_unlock(&x->x_mutex); return (0); *************** *** 1648,1659 **** --- 1682,1698 ---- x->x_fifohead < x->x_fifotail + wantbytes-1) { + #ifdef DEBUG_SOUNDFILE pute("wait...\n"); + #endif sfread_cond_signal(&x->x_requestcondition); sfread_cond_wait(&x->x_answercondition, &x->x_mutex); + #ifdef DEBUG_SOUNDFILE pute("done\n"); + #endif } if (x->x_eof && x->x_fifohead >= x->x_fifotail && x->x_fifohead < x->x_fifotail + wantbytes-1) { + int xfersize; if (x->x_fileerror) { *************** *** 1665,1671 **** clock_delay(x->x_clock, 0); x->x_state = STATE_IDLE; sfread_cond_signal(&x->x_requestcondition); pthread_mutex_unlock(&x->x_mutex); ! goto idle; }
--- 1704,1726 ---- clock_delay(x->x_clock, 0); x->x_state = STATE_IDLE; + + /* if there's a partial buffer left, copy it out. */ + xfersize = (x->x_fifohead - x->x_fifotail + 1) / + (sfchannels * bytespersample); + if (xfersize) + { + soundfile_xferin(sfchannels, noutlets, x->x_outvec, 0, + (unsigned char *)(x->x_buf + x->x_fifotail), xfersize, + bytespersample, bigendian); + vecsize -= xfersize; + } + /* then zero out the (rest of the) output */ + for (i = 0; i < noutlets; i++) + for (j = vecsize, fp = x->x_outvec[i] + xfersize; j--; ) + *fp++ = 0; + sfread_cond_signal(&x->x_requestcondition); pthread_mutex_unlock(&x->x_mutex); ! return (w+2); }
*************** *** 1831,1845 **** --- 1886,1908 ---- { t_writesf *x = zz; + #ifdef DEBUG_SOUNDFILE pute("1\n"); + #endif pthread_mutex_lock(&x->x_mutex); while (1) { + #ifdef DEBUG_SOUNDFILE pute("0\n"); + #endif if (x->x_requestcode == REQUEST_NOTHING) { + #ifdef DEBUG_SOUNDFILE pute("wait 2\n"); + #endif sfread_cond_signal(&x->x_answercondition); sfread_cond_wait(&x->x_requestcondition, &x->x_mutex); + #ifdef DEBUG_SOUNDFILE pute("3\n"); + #endif } else if (x->x_requestcode == REQUEST_OPEN) *************** *** 1863,1867 **** --- 1926,1932 ---- /* alter the request code so that an ensuing "open" will get noticed. */ + #ifdef DEBUG_SOUNDFILE pute("4\n"); + #endif x->x_requestcode = REQUEST_BUSY; x->x_fileerror = 0; *************** *** 1883,1888 **** garray_ambigendian() != bigendian, samplerate); pthread_mutex_lock(&x->x_mutex); ! pute("5\n");
if (fd < 0) --- 1948,1954 ---- garray_ambigendian() != bigendian, samplerate); pthread_mutex_lock(&x->x_mutex); ! #ifdef DEBUG_SOUNDFILE pute("5\n"); + #endif
if (fd < 0) *************** *** 1891,1896 **** --- 1957,1964 ---- x->x_eof = 1; x->x_fileerror = errno; + #ifdef DEBUG_SOUNDFILE pute("open failed\n"); pute(filename); + #endif x->x_requestcode = REQUEST_NOTHING; continue; *************** *** 1899,1903 **** --- 1967,1973 ---- if (x->x_requestcode != REQUEST_BUSY) continue; + #ifdef DEBUG_SOUNDFILE pute("6\n"); + #endif x->x_fd = fd; x->x_fifotail = 0; *************** *** 1912,1916 **** --- 1982,1988 ---- int fifosize = x->x_fifosize, fifotail; char *buf = x->x_buf; + #ifdef DEBUG_SOUNDFILE pute("77\n"); + #endif
/* if the head is < the tail, we can immediately write *************** *** 1930,1942 **** --- 2002,2022 ---- else { + #ifdef DEBUG_SOUNDFILE pute("wait 7a ...\n"); + #endif sfread_cond_signal(&x->x_answercondition); + #ifdef DEBUG_SOUNDFILE pute("signalled\n"); + #endif sfread_cond_wait(&x->x_requestcondition, &x->x_mutex); + #ifdef DEBUG_SOUNDFILE pute("7a done\n"); + #endif continue; } + #ifdef DEBUG_SOUNDFILE pute("8\n"); + #endif fifotail = x->x_fifotail; fd = x->x_fd; *************** *** 1949,1953 **** --- 2029,2035 ---- if (sysrtn < writebytes) { + #ifdef DEBUG_SOUNDFILE pute("fileerror\n"); + #endif x->x_fileerror = errno; break; *************** *** 1963,1967 **** --- 2045,2051 ---- sprintf(boo, "after: head %d, tail %d\n", x->x_fifohead, x->x_fifotail); + #ifdef DEBUG_SOUNDFILE pute(boo); + #endif /* signal parent in case it's waiting for data */ sfread_cond_signal(&x->x_answercondition); *************** *** 1998,2005 **** --- 2082,2093 ---- else { + #ifdef DEBUG_SOUNDFILE pute("13\n"); + #endif } } + #ifdef DEBUG_SOUNDFILE pute("thread exit\n"); + #endif pthread_mutex_unlock(&x->x_mutex); return (0); *************** *** 2067,2074 **** --- 2155,2166 ---- x->x_fifotail < x->x_fifohead + wantbytes + 1) { + #ifdef DEBUG_SOUNDFILE pute("wait...\n"); + #endif sfread_cond_signal(&x->x_requestcondition); sfread_cond_wait(&x->x_answercondition, &x->x_mutex); + #ifdef DEBUG_SOUNDFILE pute("done\n"); + #endif }
*************** *** 2082,2086 **** --- 2174,2180 ---- if ((--x->x_sigcountdown) <= 0) { + #ifdef DEBUG_SOUNDFILE pute("signal 1\n"); + #endif sfread_cond_signal(&x->x_requestcondition); x->x_sigcountdown = x->x_sigperiod; *************** *** 2107,2111 **** --- 2201,2207 ---- x->x_state = STATE_IDLE; x->x_requestcode = REQUEST_CLOSE; + #ifdef DEBUG_SOUNDFILE pute("signal 2\n"); + #endif sfread_cond_signal(&x->x_requestcondition); pthread_mutex_unlock(&x->x_mutex);
Index: s_inter.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_inter.c,v retrieving revision 1.1.1.3.2.11 retrieving revision 1.1.1.3.2.12 diff -C2 -d -r1.1.1.3.2.11 -r1.1.1.3.2.12 *** s_inter.c 31 Mar 2004 13:19:10 -0000 1.1.1.3.2.11 --- s_inter.c 6 May 2004 08:28:12 -0000 1.1.1.3.2.12 *************** *** 682,686 **** --- 682,690 ---- p1 = sched_get_priority_min(SCHED_FIFO); p2 = sched_get_priority_max(SCHED_FIFO); + #ifdef USEAPI_JACK + p3 = (higher ? p1 + 7 : p1 + 5); + #else p3 = (higher ? p2 - 1 : p2 - 3); + #endif par.sched_priority = p3; if (sched_setscheduler(0,SCHED_FIFO,&par) != -1) *************** *** 746,750 **** signal(SIGBUS, sys_exithandler); signal(SIGSEGV, sys_exithandler); */ ! signal(SIGPIPE, sys_exithandler); signal(SIGALRM, SIG_IGN); signal(SIGTERM, SIG_IGN); --- 750,754 ---- signal(SIGBUS, sys_exithandler); signal(SIGSEGV, sys_exithandler); */ ! signal(SIGPIPE, SIG_IGN); signal(SIGALRM, SIG_IGN); signal(SIGTERM, SIG_IGN);
Index: s_audio_mmio.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio_mmio.c,v retrieving revision 1.1.1.1.2.3 retrieving revision 1.1.1.1.2.4 diff -C2 -d -r1.1.1.1.2.3 -r1.1.1.1.2.4 *** s_audio_mmio.c 22 Feb 2004 17:36:51 -0000 1.1.1.1.2.3 --- s_audio_mmio.c 6 May 2004 08:28:12 -0000 1.1.1.1.2.4 *************** *** 71,75 **** }
! static void wave_prep(t_sbuf *bp) { WAVEHDR *wh; --- 71,75 ---- }
! static void wave_prep(t_sbuf *bp, int setdone) { WAVEHDR *wh; *************** *** 111,114 **** --- 111,117 ---- wh->lpNext = 0; wh->reserved = 0; + /* optionally (for writing) set DONE flag as if we had queued them */ + if (setdone) + wh->dwFlags = WHDR_DONE; }
*************** *** 139,144 **** { for (i = nindevsprepped; i < nt_nwavein; i++) ! for (j = 0; j < nt_naudiobuffer; j++) ! wave_prep(&ntsnd_invec[i][j]); nindevsprepped = nt_nwavein; } --- 142,147 ---- { for (i = nindevsprepped; i < nt_nwavein; i++) ! for (j = 0; j < naudioprepped; j++) ! wave_prep(&ntsnd_invec[i][j], 0); nindevsprepped = nt_nwavein; } *************** *** 146,151 **** { for (i = noutdevsprepped; i < nt_nwaveout; i++) ! for (j = 0; j < nt_naudiobuffer; j++) ! wave_prep(&ntsnd_outvec[i][j]); noutdevsprepped = nt_nwaveout; } --- 149,154 ---- { for (i = noutdevsprepped; i < nt_nwaveout; i++) ! for (j = 0; j < naudioprepped; j++) ! wave_prep(&ntsnd_outvec[i][j], 1); noutdevsprepped = nt_nwaveout; } *************** *** 155,161 **** { for (i = 0; i < nt_nwavein; i++) ! wave_prep(&ntsnd_invec[i][j]); for (i = 0; i < nt_nwaveout; i++) ! wave_prep(&ntsnd_outvec[i][j]); } naudioprepped = nt_naudiobuffer; --- 158,164 ---- { for (i = 0; i < nt_nwavein; i++) ! wave_prep(&ntsnd_invec[i][j], 0); for (i = 0; i < nt_nwaveout; i++) ! wave_prep(&ntsnd_outvec[i][j], 1); } naudioprepped = nt_naudiobuffer;
Index: s_audio_jack.c =================================================================== RCS file: /cvsroot/pure-data/pd/src/s_audio_jack.c,v retrieving revision 1.1.2.7 retrieving revision 1.1.2.8 diff -C2 -d -r1.1.2.7 -r1.1.2.8 *** s_audio_jack.c 24 Feb 2004 10:00:56 -0000 1.1.2.7 --- s_audio_jack.c 6 May 2004 08:28:12 -0000 1.1.2.8 *************** *** 233,236 **** --- 233,237 ---- if (!jack_client) { // jack spits out enough messages already, do not warn + sys_inchannels = sys_outchannels = 0; return 1; } *************** *** 297,301 **** if (new_jack) { if (jack_activate (jack_client)) { ! fprintf (stderr, "cannot activate client"); return 1; } --- 298,303 ---- if (new_jack) { if (jack_activate (jack_client)) { ! fprintf (stderr, "cannot activate client\n"); ! sys_inchannels = sys_outchannels = 0; return 1; }