speakdate stuff.
Robert Nicholson (robert@steffi.dircon.co.uk)
Sat, 4 Feb 1995 17:58:14 +0100
Well I've found that in order to get speakdate.pl working under SunOS
you have to use the following...
$cmd = "say -r 8000 \"$msg\" -u - "
. "| autopvf | pvfamp $amp | pvftoadpcm3";
Does anybody else have problems with pvfcut running out of memory when
you try to use it where it use to be?
I suspect this is a bug in either the way it's been compiled or
written... IT shouldn't be saying that on my Sun at the moment.
It seems I was right...
SunOS's realloc, according to the man page, doesn't like being called
on a block that hasn't been previously malloced.
observe.
int
pvfcut _P2((argc, argv), int argc, char **argv ) {
FILE *in=stdin, *out=stdout;
int arg=1;
int len=0, lmax=0, *buf=0;
int i;
int head=0, tail=0;
if(argc<2 || argc>3) USAGE("[<head>] <tail>");
if(argc==3) head=(int)(RATE * atof(argv[arg++]));
tail=(int)(RATE * atof(argv[arg++]));
while(1) {
int d;
d=zget(in);
if(feof(in)) break;
if(len>=lmax) {
printf("len is %d lmax is %d\n",len,lmax);
lmax+=BLK;
buf=malloc(0); /* needs to be malloced first */
buf=(int*) realloc(buf, lmax*sizeof(int));
if(!buf) ERRORRETURN("out of memory");
}
buf[len++]=d;
}
for(i=head; i<len-tail; i++) {
int d;
if(i>=0 && i<len) d=buf[i];
else d=0;
zput(d, out);
}
return 0;
}
All occurences need a either a condition call to malloc of what I've
done above seems logical.
There are three occurences of this "construct" in pvfutil.c
Cheers.