[PD-cvs] pd/src d_soundfile.c, 1.4.4.11.2.10.2.20, 1.4.4.11.2.10.2.21
Mathieu Bouchard
matju at users.sourceforge.net
Thu Jul 19 09:07:36 CEST 2007
Update of /cvsroot/pure-data/pd/src
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17910
Modified Files:
Tag: desiredata
d_soundfile.c
Log Message:
replaced pd_error() by error()
Index: d_soundfile.c
===================================================================
RCS file: /cvsroot/pure-data/pd/src/d_soundfile.c,v
retrieving revision 1.4.4.11.2.10.2.20
retrieving revision 1.4.4.11.2.10.2.21
diff -C2 -d -r1.4.4.11.2.10.2.20 -r1.4.4.11.2.10.2.21
*** d_soundfile.c 19 Jul 2007 04:24:20 -0000 1.4.4.11.2.10.2.20
--- d_soundfile.c 19 Jul 2007 07:07:34 -0000 1.4.4.11.2.10.2.21
***************
*** 411,415 ****
if (bytespersamp == 4) {
if (filetype == FORMAT_AIFF) {
! pd_error(obj, "AIFF floating-point file format unavailable");
goto usage;
}
--- 411,415 ----
if (bytespersamp == 4) {
if (filetype == FORMAT_AIFF) {
! error("AIFF floating-point file format unavailable");
goto usage;
}
***************
*** 418,425 ****
if (filetype == FORMAT_WAVE) {
bigendian = 0;
! if (endianness == 1) pd_error(obj, "WAVE file forced to little endian");
} else if (filetype == FORMAT_AIFF) {
bigendian = 1;
! if (endianness == 0) pd_error(obj, "AIFF file forced to big endian");
} else if (endianness == -1) {
bigendian = garray_ambigendian();
--- 418,425 ----
if (filetype == FORMAT_WAVE) {
bigendian = 0;
! if (endianness == 1) error("WAVE file forced to little endian");
} else if (filetype == FORMAT_AIFF) {
bigendian = 1;
! if (endianness == 0) error("AIFF file forced to big endian");
} else if (endianness == -1) {
bigendian = garray_ambigendian();
***************
*** 522,526 ****
if (itemswritten < nframes) {
if (nframes < 0x7fffffff)
! pd_error(obj, "soundfiler_write: %d out of %d bytes written", itemswritten, nframes);
/* try to fix size fields in header */
if (filetype == FORMAT_WAVE) {
--- 522,526 ----
if (itemswritten < nframes) {
if (nframes < 0x7fffffff)
! error("soundfiler_write: %d out of %d bytes written", itemswritten, nframes);
/* try to fix size fields in header */
if (filetype == FORMAT_WAVE) {
***************
*** 799,803 ****
garrays[i] = (t_garray *)pd_findbyclass(argv[i].a_symbol, garray_class);
if (!garrays[i]) {
! pd_error(x, "%s: no such table", argv[i].a_symbol->name);
goto done;
} else if (!garray_getfloatarray(garrays[i], &vecsize[i], &vecs[i]))
--- 799,803 ----
garrays[i] = (t_garray *)pd_findbyclass(argv[i].a_symbol, garray_class);
if (!garrays[i]) {
! error("%s: no such table", argv[i].a_symbol->name);
goto done;
} else if (!garray_getfloatarray(garrays[i], &vecsize[i], &vecs[i]))
***************
*** 811,815 ****
fd = open_soundfile(canvas_getdir(x->canvas)->name, filename, headersize, &bytespersamp, &bigendian, &channels, &bytelimit, skipframes);
if (fd < 0) {
! pd_error(x, "soundfiler_read: %s: %s", filename, (errno == EIO ? "unknown or bad header format" : strerror(errno)));
goto done;
}
--- 811,815 ----
fd = open_soundfile(canvas_getdir(x->canvas)->name, filename, headersize, &bytespersamp, &bigendian, &channels, &bytelimit, skipframes);
if (fd < 0) {
! error("soundfiler_read: %s: %s", filename, (errno == EIO ? "unknown or bad header format" : strerror(errno)));
goto done;
}
***************
*** 819,827 ****
poswas = lseek(fd, 0, SEEK_CUR);
eofis = lseek(fd, 0, SEEK_END);
! if (poswas < 0 || eofis < 0) {pd_error(x, "lseek failed"); goto done;}
lseek(fd, poswas, SEEK_SET);
framesinfile = (eofis - poswas) / (channels * bytespersamp);
if (framesinfile > maxsize) {
! pd_error(x, "soundfiler_read: truncated to %d elements", maxsize);
framesinfile = maxsize;
}
--- 819,827 ----
poswas = lseek(fd, 0, SEEK_CUR);
eofis = lseek(fd, 0, SEEK_END);
! if (poswas < 0 || eofis < 0) {error("lseek failed"); goto done;}
lseek(fd, poswas, SEEK_SET);
framesinfile = (eofis - poswas) / (channels * bytespersamp);
if (framesinfile > maxsize) {
! error("soundfiler_read: truncated to %d elements", maxsize);
framesinfile = maxsize;
}
***************
*** 844,848 ****
/* if we are out of memory, free it again and quit */
if (nvecs[i]==0) {
! pd_error(x, "resize failed");
/* if the resizing fails, we'll have to free all arrays again */
for (j=0; j!=i;++j) freealignedbytes (nvecs[i],finalsize * sizeof(t_float));
--- 844,848 ----
/* if we are out of memory, free it again and quit */
if (nvecs[i]==0) {
! error("resize failed");
/* if the resizing fails, we'll have to free all arrays again */
for (j=0; j!=i;++j) freealignedbytes (nvecs[i],finalsize * sizeof(t_float));
***************
*** 855,859 ****
/* if we are out of memory, free it again and quit */
if (nvecs[i]==0) {
! pd_error(x, "resize failed");
/* if the resizing fails, we'll have to free all arrays again */
for (j=0; j!=i;++j) freealignedbytes (nvecs[i],vecsize[i] * sizeof(t_float));
--- 855,859 ----
/* if we are out of memory, free it again and quit */
if (nvecs[i]==0) {
! error("resize failed");
/* if the resizing fails, we'll have to free all arrays again */
for (j=0; j!=i;++j) freealignedbytes (nvecs[i],vecsize[i] * sizeof(t_float));
***************
*** 899,903 ****
goto done;
usage:
! pd_error(x, "usage: read [flags] filename tablename...");
post("flags: -skip <n> -nframes <n> -resize -maxsize <n> ...");
post("-raw <headerbytes> <channels> <bytespersamp> <endian (b, l, or n)>.");
--- 899,903 ----
goto done;
usage:
! error("usage: read [flags] filename tablename...");
post("flags: -skip <n> -nframes <n> -resize -maxsize <n> ...");
post("-raw <headerbytes> <channels> <bytespersamp> <endian (b, l, or n)>.");
***************
*** 968,972 ****
if (argv[i].a_type != A_SYMBOL) goto usage;
if (!(garrays[i] = (t_garray *)pd_findbyclass(argv[i].a_symbol, garray_class))) {
! pd_error(obj, "%s: no such table", argv[i].a_symbol->name);
goto fail;
}
--- 968,972 ----
if (argv[i].a_type != A_SYMBOL) goto usage;
if (!(garrays[i] = (t_garray *)pd_findbyclass(argv[i].a_symbol, garray_class))) {
! error("%s: no such table", argv[i].a_symbol->name);
goto fail;
}
***************
*** 981,985 ****
}
if (nframes <= 0) {
! pd_error(obj, "soundfiler_write: no samples at onset %ld", onset);
goto fail;
}
--- 981,985 ----
}
if (nframes <= 0) {
! error("soundfiler_write: no samples at onset %ld", onset);
goto fail;
}
***************
*** 1016,1020 ****
return itemswritten;
usage:
! pd_error(obj, "usage: write [flags] filename tablename...");
post("flags: -skip <n> -nframes <n> -bytes <n> -wave -aiff -nextstep ...");
post("-big -little -normalize");
--- 1016,1020 ----
return itemswritten;
usage:
! error("usage: write [flags] filename tablename...");
post("flags: -skip <n> -nframes <n> -bytes <n> -wave -aiff -nextstep ...");
post("-big -little -normalize");
***************
*** 1046,1050 ****
t_garray *x = (t_garray *)pd_findbyclass(argv[0].a_symbol, garray_class);
if (!(x)) {
! pd_error(y, "%s: no such table", argv[0].a_symbol->name);
goto usage;
}
--- 1046,1050 ----
t_garray *x = (t_garray *)pd_findbyclass(argv[0].a_symbol, garray_class);
if (!(x)) {
! error("%s: no such table", argv[0].a_symbol->name);
goto usage;
}
***************
*** 1066,1070 ****
}
if (!nvec) {
! pd_error(x, "array resize failed: out of memory");
mlockall(MCL_FUTURE);
return;
--- 1066,1070 ----
}
if (!nvec) {
! error("array resize failed: out of memory");
mlockall(MCL_FUTURE);
return;
***************
*** 1090,1094 ****
return;
usage:
! pd_error(x, "usage: resize tablename size");
}
--- 1090,1094 ----
return;
usage:
! error("usage: resize tablename size");
}
***************
*** 1108,1112 ****
t_garray * x = (t_garray *)pd_findbyclass(argv[0].a_symbol, garray_class);
if (!(x)) {
! pd_error(y, "%s: no such table", argv[0].a_symbol->name);
goto usage;
}
--- 1108,1112 ----
t_garray * x = (t_garray *)pd_findbyclass(argv[0].a_symbol, garray_class);
if (!(x)) {
! error("%s: no such table", argv[0].a_symbol->name);
goto usage;
}
***************
*** 1121,1125 ****
nvec = (char *)getalignedbytes(size * elemsize);
if (!nvec) {
! pd_error(x, "array resize failed: out of memory");
mlockall(MCL_FUTURE);
return;
--- 1121,1125 ----
nvec = (char *)getalignedbytes(size * elemsize);
if (!nvec) {
! error("array resize failed: out of memory");
mlockall(MCL_FUTURE);
return;
***************
*** 1145,1149 ****
return;
usage:
! pd_error(x, "usage: const tablename value");
}
--- 1145,1149 ----
return;
usage:
! error("usage: const tablename value");
}
***************
*** 1205,1209 ****
garrays[i] = (t_garray *)pd_findbyclass(argv[i].a_symbol, garray_class);
if (!garrays) {
! pd_error(x, "%s: no such table", argv[i].a_symbol->name);
goto done;
} else if (!garray_getfloatarray(garrays[i], &vecsize, &vecs[i]))
--- 1205,1209 ----
garrays[i] = (t_garray *)pd_findbyclass(argv[i].a_symbol, garray_class);
if (!garrays) {
! error("%s: no such table", argv[i].a_symbol->name);
goto done;
} else if (!garray_getfloatarray(garrays[i], &vecsize, &vecs[i]))
***************
*** 1217,1221 ****
fd = open_soundfile_via_canvas(x->canvas, filename, headersize, &bytespersamp, &bigendian, &channels, &bytelimit, skipframes);
if (fd < 0) {
! pd_error(x, "soundfiler_read: %s: %s", filename, (errno == EIO ? "unknown or bad header format" : strerror(errno)));
goto done;
}
--- 1217,1221 ----
fd = open_soundfile_via_canvas(x->canvas, filename, headersize, &bytespersamp, &bigendian, &channels, &bytelimit, skipframes);
if (fd < 0) {
! error("soundfiler_read: %s: %s", filename, (errno == EIO ? "unknown or bad header format" : strerror(errno)));
goto done;
}
***************
*** 1225,1233 ****
poswas = lseek(fd, 0, SEEK_CUR);
eofis = lseek(fd, 0, SEEK_END);
! if (poswas < 0 || eofis < 0) {pd_error(x, "lseek failed"); goto done;}
lseek(fd, poswas, SEEK_SET);
framesinfile = (eofis - poswas) / (channels * bytespersamp);
if (framesinfile > maxsize) {
! pd_error(x, "soundfiler_read: truncated to %d elements", maxsize);
framesinfile = maxsize;
}
--- 1225,1233 ----
poswas = lseek(fd, 0, SEEK_CUR);
eofis = lseek(fd, 0, SEEK_END);
! if (poswas < 0 || eofis < 0) {error("lseek failed"); goto done;}
lseek(fd, poswas, SEEK_SET);
framesinfile = (eofis - poswas) / (channels * bytespersamp);
if (framesinfile > maxsize) {
! error("soundfiler_read: truncated to %d elements", maxsize);
framesinfile = maxsize;
}
***************
*** 1241,1245 ****
garray_getfloatarray(garrays[i], &vecsize, &vecs[i]);
/* if the resize failed, garray_resize reported the error */
! if (vecsize != framesinfile) {pd_error(x, "resize failed"); goto done;}
}
}
--- 1241,1245 ----
garray_getfloatarray(garrays[i], &vecsize, &vecs[i]);
/* if the resize failed, garray_resize reported the error */
! if (vecsize != framesinfile) {error("resize failed"); goto done;}
}
}
***************
*** 1272,1276 ****
goto done;
usage:
! pd_error(x, "usage: read [flags] filename tablename...");
post("flags: -skip <n> -nframes <n> -resize -maxsize <n> ...");
post("-raw <headerbytes> <channels> <bytespersamp> <endian (b, l, or n)>.");
--- 1272,1276 ----
goto done;
usage:
! error("usage: read [flags] filename tablename...");
post("flags: -skip <n> -nframes <n> -resize -maxsize <n> ...");
post("-raw <headerbytes> <channels> <bytespersamp> <endian (b, l, or n)>.");
***************
*** 1303,1307 ****
if (argv[i].a_type != A_SYMBOL) goto usage;
if (!(garrays[i] = (t_garray *)pd_findbyclass(argv[i].a_symbol, garray_class))) {
! pd_error(obj, "%s: no such table", argv[i].a_symbol->name);
goto fail;
}
--- 1303,1307 ----
if (argv[i].a_type != A_SYMBOL) goto usage;
if (!(garrays[i] = (t_garray *)pd_findbyclass(argv[i].a_symbol, garray_class))) {
! error("%s: no such table", argv[i].a_symbol->name);
goto fail;
}
***************
*** 1315,1319 ****
}
if (nframes <= 0) {
! pd_error(obj, "soundfiler_write: no samples at onset %ld", onset);
goto fail;
}
--- 1315,1319 ----
}
if (nframes <= 0) {
! error("soundfiler_write: no samples at onset %ld", onset);
goto fail;
}
***************
*** 1349,1353 ****
return itemswritten;
usage:
! pd_error(obj, "usage: write [flags] filename tablename...");
post("flags: -skip <n> -nframes <n> -bytes <n> -wave -aiff -nextstep ...");
post("-big -little -normalize");
--- 1349,1353 ----
return itemswritten;
usage:
! error("usage: write [flags] filename tablename...");
post("flags: -skip <n> -nframes <n> -bytes <n> -wave -aiff -nextstep ...");
post("-big -little -normalize");
***************
*** 1656,1661 ****
if (x->eof && x->fifohead >= x->fifotail && x->fifohead < x->fifotail + wantbytes-1) {
if (x->fileerror) {
! pd_error(x, "dsp: %s: %s", x->filename,
! (x->fileerror == EIO ? "unknown or bad header format" : strerror(x->fileerror)));
}
clock_delay(x->clock, 0);
--- 1656,1660 ----
if (x->eof && x->fifohead >= x->fifotail && x->fifohead < x->fifotail + wantbytes-1) {
if (x->fileerror) {
! error("dsp: %s: %s", x->filename, x->fileerror == EIO ? "unknown or bad header format" : strerror(x->fileerror));
}
clock_delay(x->clock, 0);
***************
*** 1698,1702 ****
to the "running" state. */
if (x->state == STATE_STARTUP) x->state = STATE_STREAM;
! else pd_error(x, "readsf: start requested with no prior 'open'");
}
--- 1697,1701 ----
to the "running" state. */
if (x->state == STATE_STARTUP) x->state = STATE_STREAM;
! else error("readsf: start requested with no prior 'open'");
}
***************
*** 1733,1737 ****
if (*endian->name == 'b') x->bigendian = 1;
else if (*endian->name == 'l') x->bigendian = 0;
! else if (*endian->name) pd_error(x, "endianness neither 'b' nor 'l'");
else x->bigendian = garray_ambigendian();
x->onsetframes = max(long(onsetframes),0L);
--- 1732,1736 ----
if (*endian->name == 'b') x->bigendian = 1;
else if (*endian->name == 'l') x->bigendian = 0;
! else if (*endian->name) error("endianness neither 'b' nor 'l'");
else x->bigendian = garray_ambigendian();
x->onsetframes = max(long(onsetframes),0L);
***************
*** 1974,1978 ****
/* start making output. If we're in the "startup" state change to the "running" state. */
if (x->state == STATE_STARTUP) x->state = STATE_STREAM;
! else pd_error(x, "writesf: start requested with no prior 'open'");
}
--- 1973,1977 ----
/* start making output. If we're in the "startup" state change to the "running" state. */
if (x->state == STATE_STARTUP) x->state = STATE_STREAM;
! else error("writesf: start requested with no prior 'open'");
}
***************
*** 1995,2005 ****
if (soundfiler_writeargparse(x, &argc, &argv, &filesym, &filetype, &bytespersamp, &swap, &bigendian,
&normalize, &onset, &nframes, &samplerate)) {
! pd_error(x, "writesf~: usage: open [-bytes [234]] [-wave,-nextstep,-aiff] ...");
post("... [-big,-little] [-rate ####] filename");
return;
}
if (normalize || onset || (nframes != 0x7fffffff))
! pd_error(x, "normalize/onset/nframes argument to writesf~: ignored");
! if (argc) pd_error(x, "extra argument(s) to writesf~: ignored");
pthread_mutex_lock(&x->mutex);
while (x->requestcode != REQUEST_NOTHING) {
--- 1994,2004 ----
if (soundfiler_writeargparse(x, &argc, &argv, &filesym, &filetype, &bytespersamp, &swap, &bigendian,
&normalize, &onset, &nframes, &samplerate)) {
! error("writesf~: usage: open [-bytes [234]] [-wave,-nextstep,-aiff] ...");
post("... [-big,-little] [-rate ####] filename");
return;
}
if (normalize || onset || (nframes != 0x7fffffff))
! error("normalize/onset/nframes argument to writesf~: ignored");
! if (argc) error("extra argument(s) to writesf~: ignored");
pthread_mutex_lock(&x->mutex);
while (x->requestcode != REQUEST_NOTHING) {
More information about the Pd-cvs
mailing list