ref: 3e72daf94c73c8ef82868a2e5cbef422843e6375
parent: ffa15e29de4b78ea558a2f3b7b1f8fc08bd6ca6f
author: cbagwell <cbagwell>
date: Sat Sep 29 14:07:25 EDT 2001
Trim effect wasn't accounting for channels. Added errno.h when needed.
--- a/Changelog
+++ b/Changelog
@@ -12,6 +12,7 @@
settings. This is because it can start buffering data as soon
as the device is open and the buffered data can be in a
wrong format.
+ o trim wasn't accounting for # of channels.
sox-12.17.2
-----------
--- a/TODO
+++ b/TODO
@@ -1,7 +1,7 @@
People are encouraged to pick some of these and implement it. Send
all patches to cbagwell@users.sourceforge.net.
- o Add in manual page entries for silence and dcshift.
+ o Get nul effect and oss driver compiling under latest cygwin.
o Make a global version of MIN/MAX instead of sprinkled min/max/MIN/MAX
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -45,6 +45,7 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
+#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* For SEEK_* defines if not found in stdio */
--- a/src/au.c
+++ b/src/au.c
@@ -23,6 +23,7 @@
#include "g72x.h"
#include <stdlib.h>
#include <string.h>
+#include <errno.h>
/* Magic numbers used in Sun and NeXT audio files */
#define SUN_MAGIC 0x2e736e64 /* Really '.snd' */
--- a/src/cvsd.c
+++ b/src/cvsd.c
@@ -39,6 +39,7 @@
#include <string.h>
#include <time.h>
#include <stdio.h>
+#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* For SEEK_* defines if not found in stdio */
--- a/src/gsm.c
+++ b/src/gsm.c
@@ -29,6 +29,7 @@
#include "st.h"
#include "gsm.h"
+#include <errno.h>
#define MAXCHANS 16
--- a/src/hcom.c
+++ b/src/hcom.c
@@ -24,6 +24,7 @@
#include "st.h"
#include <string.h>
#include <stdlib.h>
+#include <errno.h>
/* Dictionary entry for Huffman (de)compression */
typedef struct {
--- a/src/maud.c
+++ b/src/maud.c
@@ -21,6 +21,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdio.h>
+#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* For SEEK_* defines if not found in stdio */
--- a/src/misc.c
+++ b/src/misc.c
@@ -17,10 +17,13 @@
#include <stdlib.h>
#include <time.h>
#include <string.h>
+#include <errno.h>
/* for fstat */
#include <sys/stat.h>
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
+#endif
const char *st_sizes_str[] = {
"NONSENSE!",
--- a/src/raw.c
+++ b/src/raw.c
@@ -24,6 +24,7 @@
#include <string.h>
#include <stdlib.h>
+#include <errno.h>
#ifndef HAVE_MEMMOVE
#define memmove(dest, src, len) bcopy((src), (dest), (len))
--- a/src/smp.c
+++ b/src/smp.c
@@ -18,6 +18,7 @@
#include "st.h"
#include <string.h>
+#include <errno.h>
#define NAMELEN 30 /* Size of Samplevision name */
#define COMMENTLEN 60 /* Size of Samplevision comment, not shared */
--- a/src/sndrtool.c
+++ b/src/sndrtool.c
@@ -10,6 +10,7 @@
#include <math.h>
#include <string.h>
#include <stdio.h>
+#include <errno.h>
#ifdef HAVE_UNISTD_H
#include <unistd.h> /* For SEEK_* defines if not found in stdio */
--- a/src/sphere.c
+++ b/src/sphere.c
@@ -11,6 +11,7 @@
#include <math.h>
#include <string.h>
+#include <errno.h>
#include "st.h"
/* Private data for SKEL file */
--- a/src/trim.c
+++ b/src/trim.c
@@ -45,9 +45,6 @@
{
trim_t trim = (trim_t) effp->priv;
- trim->start = 0;
- trim->length = 0;
-
/* Do not know sample rate yet so hold off on completely parsing
* time related strings.
*/
@@ -100,7 +97,6 @@
{
trim_t trim = (trim_t) effp->priv;
-
if (st_parsesamples(effp->ininfo.rate, trim->start_str,
&trim->start, 't') != ST_SUCCESS)
{
@@ -107,12 +103,22 @@
st_fail(TRIM_USAGE);
return(ST_EOF);
}
- if (st_parsesamples(effp->ininfo.rate, trim->length_str,
- &trim->length, 't') != ST_SUCCESS)
+ /* Account for # of channels */
+ trim->start *= effp->ininfo.channels;
+ if (trim->length_str)
{
- st_fail(TRIM_USAGE);
- return(ST_EOF);
+ if (st_parsesamples(effp->ininfo.rate, trim->length_str,
+ &trim->length, 't') != ST_SUCCESS)
+ {
+ st_fail(TRIM_USAGE);
+ return(ST_EOF);
+ }
}
+ else
+ trim->length = 0;
+
+ /* Account for # of channels */
+ trim->length *= effp->ininfo.channels;
trim->done = 0;
trim->index = 0;
--- a/src/wve.c
+++ b/src/wve.c
@@ -5,7 +5,8 @@
#include "st.h"
#include "g72x.h"
-#include "string.h"
+#include <string.h>
+#include <errno.h>
/* Magic numbers used in Psion audio files */
#define PSION_MAGIC "ALawSoundFile**"