shithub: sox

Download patch

ref: 16704130c9deceb62298e8237f66c3df30471a30
parent: 2c318fba9e88a35c141111aa3af0a3aaef51f3f6
author: cbagwell <cbagwell>
date: Sun Sep 18 18:02:57 EDT 2005

Move SIGINT handling to sox.c to fix playback aborts.

--- a/src/alsa.c
+++ b/src/alsa.c
@@ -49,11 +49,13 @@
     unsigned int min_chan, max_chan;
     unsigned int rate, periods;
     snd_pcm_uframes_t buffer_size;
-    snd_pcm_sframes_t period_size;
     int dir;
     snd_pcm_format_mask_t *fmask;
+#if 0
     unsigned int buffer_time = 500000;
     unsigned int period_time = 100000;
+    snd_pcm_sframes_t period_size;
+#endif
 
     /* Reserve buffer for 16-bit data.  FIXME: Whats a good size? */
     alsa->buf_size = ST_BUFSIZ*2;
@@ -92,8 +94,8 @@
     err = snd_pcm_hw_params_set_rate_resample(alsa->pcm_handle, hw_params, 
                                               rate);
     if (err < 0) {
-        printf("Resampling setup failed for playback: %s\n", snd_strerror(err));
-        return err;
+        st_fail_errno(ft, ST_EPERM, "Resampling setup failed for playback");
+        return ST_EOF;
     }
 
     if ((err = snd_pcm_hw_params_set_access(alsa->pcm_handle, hw_params, 
@@ -131,7 +133,6 @@
 
     snd_pcm_hw_params_get_rate_min(hw_params, &min_rate, &dir);
     snd_pcm_hw_params_get_rate_max(hw_params, &max_rate, &dir);
-    fprintf(stderr, "min_rate=%d max_rate=%d\n", min_rate, max_rate);
 
     rate = ft->info.rate;
     if (rate < min_rate) 
@@ -141,7 +142,7 @@
             rate = max_rate;
     if (rate != ft->info.rate)
     {
-        st_warn("alsa: Hardware does not support %d.  Forcing sample rate to %d.", ft->info.rate, rate);
+        st_report("alsa: Hardware does not support %d.  Forcing sample rate to %d.", ft->info.rate, rate);
         ft->info.rate = rate;
     }
 
@@ -158,10 +159,9 @@
                                &rate,
                                &dir);
  
-    fprintf(stderr, "new rate=%d\n", rate);
     if (rate != ft->info.rate)
     {
-        st_warn("Could not set exact rate of %d.  Approximating with %d",
+        st_report("Could not set exact rate of %d.  Approximating with %d",
                 ft->info.rate, rate);
     }
 
@@ -201,7 +201,7 @@
     }
 #endif
 
-#if 0
+#if 1
     /* Set number of periods. Periods used to be called fragments. */ 
     periods = 2;
     if (snd_pcm_hw_params_set_periods_near(alsa->pcm_handle, hw_params, 
@@ -214,7 +214,7 @@
 
     /* Set buffer size (in frames). The resulting latency is given by */
     /* latency = periodsize * periods / (rate * bytes_per_frame)     */
-    buffer_size = ((ST_BUFSIZ/ft->info.channels) * periods);
+    buffer_size = ((ST_BUFSIZ/ft->info.size/ft->info.channels) * periods);
     if (snd_pcm_hw_params_set_buffer_size_near(alsa->pcm_handle, hw_params, 
                                                &buffer_size) < 0) {
       st_fail_errno(ft, ST_EPERM, "Error setting buffersize.");
@@ -279,8 +279,6 @@
         return ST_EOF;
     }
 
-    sigintreg(ft);      /* Prepare to catch SIGINT */
-
     return (ST_SUCCESS);
 }
 
@@ -334,13 +332,6 @@
     alsa_priv_t alsa = (alsa_priv_t)ft->priv;
     void (*read_buf)(st_sample_t *, char *, st_ssize_t, char) = 0;
 
-    /* Check to see if user sent SIGINT and if so return ST_EOF to
-     * stop playing.
-     */
-    if (ft->file.eof)
-        return ST_EOF;
-
-
     switch(ft->info.size) {
         case ST_SIZE_BYTE:
             switch(ft->info.encoding)
@@ -389,8 +380,6 @@
             continue;
         if (err < 0)
         {
-            if (ft->file.eof)
-                return ST_EOF;
             if (xrun_recovery(alsa->pcm_handle, err) < 0)
             {
                 st_fail_errno(ft, ST_EPERM, "ALSA write error");
@@ -399,7 +388,7 @@
         }
         else
         {
-            read_buf(buf+len, alsa->buf, err, ft->swap);
+            read_buf(buf+(len*sizeof(st_sample_t)), alsa->buf, err, ft->swap);
             len += err * ft->info.channels;
         }
     }
@@ -431,12 +420,6 @@
     alsa_priv_t alsa = (alsa_priv_t)ft->priv;
     void (*write_buf)(char *, st_sample_t *, st_ssize_t, char) = 0;
 
-    /* Check to see if user sent SIGINT and if so return ST_EOF to
-     * stop recording
-     */
-    if (ft->file.eof)
-        return ST_EOF;
-
     switch(ft->info.size) {
         case ST_SIZE_BYTE:
             switch(ft->info.encoding)
@@ -480,14 +463,13 @@
 
     while (len < nsamp)
     {
-        err = snd_pcm_writei(alsa->pcm_handle, alsa->buf, 
+        err = snd_pcm_writei(alsa->pcm_handle, 
+                             alsa->buf+(len*ft->info.size), 
                              (nsamp-len)/ft->info.channels);
         if (err == -EAGAIN)
             continue;
         if (err < 0)
         {
-            if (ft->file.eof)
-                return ST_EOF;
             if (xrun_recovery(alsa->pcm_handle, err) < 0)
             {
                 st_fail_errno(ft, ST_EPERM, "ALSA write error\n");
@@ -533,7 +515,7 @@
     if (ft->info.size != ST_SIZE_WORD &&
         ft->info.size != ST_SIZE_BYTE)
     {
-        st_warn("ALSA driver only supports byte and word samples.  Changing to word.");
+        st_report("ALSA driver only supports byte and word samples.  Changing to word.");
         ft->info.size = ST_SIZE_WORD;
     }
 
@@ -542,12 +524,12 @@
     {
         if (ft->info.size == ST_SIZE_WORD)
         {
-            st_warn("ALSA driver only supports signed and unsigned samples.  Changing to signed.");
+            st_report("ALSA driver only supports signed and unsigned samples.  Changing to signed.");
             ft->info.encoding = ST_ENCODING_SIGN2;
         }
         else
         {
-            st_warn("ALSA driver only supports signed and unsigned samples.  Changing to unsigned.");
+            st_report("ALSA driver only supports signed and unsigned samples.  Changing to unsigned.");
             ft->info.encoding = ST_ENCODING_UNSIGNED;
         }
     }
--- a/src/mp3.c
+++ b/src/mp3.c
@@ -128,7 +128,7 @@
         mad_timer_reset(p->Timer);
 
         ft->info.encoding = ST_ENCODING_MP3;
-        ft->info.size = ST_SIZE_DWORD;
+        ft->info.size = ST_SIZE_WORD;
 
         /* We need to decode the first frame,
          * so we know the output format */
--- a/src/nulfile.c
+++ b/src/nulfile.c
@@ -20,7 +20,7 @@
 
 /* Private data for nul file */
 typedef struct nulstuff {
-	int	rest;			/* bytes remaining in current block */
+        int     rest;                   /* bytes remaining in current block */
     unsigned long readsamples;
     unsigned long writesamples;
 } *nul_t;
@@ -28,34 +28,29 @@
 /*
  * Do anything required before you start reading samples.
  * Read file header. 
- *	Find out sampling rate, 
- *	size and encoding of samples, 
- *	mono/stereo/quad.
+ *      Find out sampling rate, 
+ *      size and encoding of samples, 
+ *      mono/stereo/quad.
  */
 int st_nulstartread(ft_t ft) 
 {
-	nul_t sk = (nul_t) ft->priv;
-	/* no samples read yet */
-	sk->readsamples=0;
+        nul_t sk = (nul_t) ft->priv;
+        /* no samples read yet */
+        sk->readsamples=0;
 
-	/* if no input rate is given as parameter, switch to 
-	 * default parameter
-	 */
-	if(ft->info.rate == 0){
-	    /* input rate not set, switch to default */
-	    ft->info.rate = 44100;
-	    ft->info.size = ST_SIZE_WORD;
-	    ft->info.encoding = ST_ENCODING_SIGN2;
-	    ft->info.channels = 2;
-	}
-	ft->comment = "nul file";
-	
-	/* only SIGINT will stop us from reading nul data.. 
-	 *
-	 */
-	sigintreg(ft);	/* Prepare to catch SIGINT */
-
-	return (ST_SUCCESS);
+        /* if no input rate is given as parameter, switch to 
+         * default parameter
+         */
+        if(ft->info.rate == 0){
+            /* input rate not set, switch to default */
+            ft->info.rate = 44100;
+            ft->info.size = ST_SIZE_WORD;
+            ft->info.encoding = ST_ENCODING_SIGN2;
+            ft->info.channels = 2;
+        }
+        ft->comment = "nul file";
+        
+        return (ST_SUCCESS);
 }
 
 /*
@@ -67,17 +62,17 @@
 
 st_ssize_t st_nulread(ft_t ft, st_sample_t *buf, st_ssize_t len) 
 {
-	nul_t sk = (nul_t) ft->priv;
-	int done = 0;
-	st_sample_t l;
-	for(; done < len; done++) {
-	    if (ft->file.eof)
-		break;
-	    l = 0; /* nul samples are always 0 */
-	    sk->readsamples++;
-	    *buf++ = l;
-	}
-	return done;
+        nul_t sk = (nul_t) ft->priv;
+        int done = 0;
+        st_sample_t l;
+        for(; done < len; done++) {
+            if (ft->file.eof)
+                break;
+            l = 0; /* nul samples are always 0 */
+            sk->readsamples++;
+            *buf++ = l;
+        }
+        return done;
 }
 
 /*
@@ -92,20 +87,20 @@
 
 int st_nulstartwrite(ft_t ft) 
 {
-	nul_t sk = (nul_t) ft->priv;
-	sk->writesamples=0;
-	return(ST_SUCCESS);
-	
+        nul_t sk = (nul_t) ft->priv;
+        sk->writesamples=0;
+        return(ST_SUCCESS);
+        
 }
 
 st_ssize_t st_nulwrite(ft_t ft, st_sample_t *buf, st_ssize_t len) 
 {
-	nul_t sk = (nul_t) ft->priv;
-	while(len--)
-	    sk->writesamples++;
-	st_writeb(ft, (*buf++ >> 24) ^ 0x80);
-	return (ST_SUCCESS);
-	
+        nul_t sk = (nul_t) ft->priv;
+        while(len--)
+            sk->writesamples++;
+        st_writeb(ft, (*buf++ >> 24) ^ 0x80);
+        return (ST_SUCCESS);
+        
 }
 
 int st_nulstopwrite(ft_t ft) 
--- a/src/oss.c
+++ b/src/oss.c
@@ -208,7 +208,6 @@
 {
     int rc;
     rc = ossdspinit(ft);
-    sigintreg(ft);      /* Prepare to catch SIGINT */
     return rc;
 }
 
--- a/src/sox.c
+++ b/src/sox.c
@@ -30,6 +30,7 @@
 #include <stdio.h>
 #include <string.h>
 #include <stdlib.h>             /* for malloc() */
+#include <signal.h>
 #ifdef HAVE_ERRNO_H
 #include <errno.h>
 #endif
@@ -72,6 +73,8 @@
 static int writing = 1;         /* are we writing to a file? assume yes. */
 static int soxpreview = 0;      /* preview mode */
 
+static int user_abort = 0;
+
 static int quite = 0;
 static int status = 0;
 static unsigned long input_samples = 0;
@@ -112,6 +115,8 @@
 static int drain_effect(int);
 static void release_effect_buf(void);
 static void stop_effects(void);
+void cleanup(void);
+static void sigint(int s);
 
 #define MAX_INPUT_FILES 32
 #define MAX_FILES MAX_INPUT_FILES + 1
@@ -242,11 +247,21 @@
                                      &file_opts[i]->info, 
                                      file_opts[i]->filetype,
                                      file_opts[i]->swap);
+        if (!file_desc[i])
+        {
+            /* st_open_input() will call st_warn for most errors.
+             * Rely on that printing something.
+             */
+            cleanup();
+            exit(2);
+        }
     }
 
     /* Loop through the reset of the arguments looking for effects */
     parse_effects(argc, argv);
 
+    signal(SIGINT, sigint);
+
     process();
     statistics();
 
@@ -469,9 +484,18 @@
                            file_opts[file_count-1]->filetype,
                            file_opts[file_count-1]->swap);
 
+        if (!file_desc[file_count-1])
+        {
+            /* st_open_output() will call st_warn for most errors.
+             * Rely on that printing something.
+             */
+            cleanup();
+            exit(2);
+        }
+
         /* When writing to an audio device, auto turn on the
-         * status display to match behavior of ogg123/mpg123
-         * utils.  That is unless user requested us not to display]
+         * status display to match behavior of ogg123 status.
+         * That is unless user requested us not to display]
          * anything.
          */
         if (strcmp(file_desc[file_count-1]->filetype, "alsa") == 0 ||
@@ -549,10 +573,8 @@
      */
     do {
 #ifndef SOXMIX
-        efftab[0].olen = 
-        ilen = (*file_desc[current_input]->h->read)(file_desc[current_input],
-                                                    efftab[0].obuf, 
-                                                    (st_ssize_t)ST_BUFSIZ);
+        ilen = st_read(file_desc[current_input], efftab[0].obuf, 
+                       (st_ssize_t)ST_BUFSIZ);
         if (ilen > ST_BUFSIZ)
         {
             st_warn("WARNING: Corrupt value of %d!  Assuming 0 bytes read.\n", ilen);
@@ -567,7 +589,6 @@
             efftab[0].olen = 0;
         else
             efftab[0].olen = ilen;
-        efftab[0].odone = 0;
 
         read_samples += (efftab[0].olen / file_desc[0]->info.channels);
 
@@ -600,9 +621,8 @@
 #else
         for (f = 0; f < input_count; f++)
         {
-            ilen[f] = (*file_desc[f]->h->read)(file_desc[f],
-                                               ibuf[f], 
-                                               (st_ssize_t)ST_BUFSIZ);
+            ilen[f] = st_read(file_desc[f], ibuf[f], (st_ssize_t)ST_BUFSIZ);
+
             /* FIXME: libst needs the feof() and ferror() concepts
              * to see if ST_EOF means a real failure.  Until then we
              * must treat ST_EOF as just hiting the end of the buffer.
@@ -683,6 +703,12 @@
         if (status)
             update_status();
 
+        /* Quite reading/writing on user aborts.  This will close
+         * done the files nicely as if an EOF was reached on read.
+         */
+        if (user_abort)
+            break;
+
         /* Negative flowstatus says no more output will ever be generated. */
         if (flowstatus == ST_EOF || 
             (writing && file_desc[file_count-1]->st_errno))
@@ -995,6 +1021,7 @@
 static int flow_effect_out(void)
 {
     int e, havedata, flowstatus = 0;
+    int len, total;
 
     do {
       /* run entire chain BACKWARDS: pull, don't push.*/
@@ -1045,22 +1072,23 @@
           /* FIXME: Should look at return code and abort
            * on ST_EOF
            */
-          (*file_desc[file_count-1]->h->write)(file_desc[file_count-1],
-                                               efftab[neffects-1].obuf,
-                                               (st_ssize_t)efftab[neffects-1].olen);
-          /* FIXME: Goes with above.  Should look at # of bytes writen. */
-          /* Currently, assuming all bytes were written and resetting
-           * buffer pointers accordingly.
-           */
-          output_samples += (efftab[neffects-1].olen / 
-                             file_desc[file_count-1]->info.channels);
-          efftab[neffects-1].odone = efftab[neffects-1].olen = 0;
-
-          if (file_desc[file_count-1]->st_errno)
+          total = 0;
+          do
           {
-              st_warn("Error writing: %s", file_desc[file_count-1]->st_errstr);
-              break;
-          }
+              len = st_write(file_desc[file_count-1], 
+                             &efftab[neffects-1].obuf[total],
+                             (st_ssize_t)efftab[neffects-1].olen-total);
+
+              if (len < 0)
+              {
+                  st_warn("Error writing: %s",
+                          file_desc[file_count-1]->st_errstr);
+                  return ST_EOF;
+              }
+              total += len;
+              output_samples += (len / file_desc[file_count-1]->info.channels);
+              efftab[neffects-1].odone = efftab[neffects-1].olen = 0;
+          } while (total < efftab[neffects-1].olen);
       }
       else
       {
@@ -1283,7 +1311,6 @@
 
         /* right */
         olenr = olen/2;
-        /* FIXME: Should look at return code and abort on ST_EOF */
         rc_r = (* efftab[e].h->drain)(&efftabR[e], obufr, 
                                       (st_size_t *)&olenr);
 
@@ -1473,7 +1500,6 @@
         exit(1);
 }
 
-
 /* called from util.c::st_fail() */
 void cleanup(void) 
 {
@@ -1503,5 +1529,13 @@
         free(fn);
         if (file_desc[file_count-1])
             free(file_desc[file_count-1]);
+    }
+}
+
+static void sigint(int s)
+{
+    if (s == SIGINT)
+    {
+        user_abort = 1;
     }
 }
--- a/src/st.h
+++ b/src/st.h
@@ -261,6 +261,8 @@
                            const char *comment, const st_loopinfo_t *loops,
                            const st_instrinfo_t *instr,
                            const char *filetype, const char swap);
+extern st_ssize_t st_read(ft_t ft, st_sample_t *buf, st_ssize_t len);
+extern st_ssize_t st_write(ft_t ft, st_sample_t *buf, st_ssize_t len);
 extern int st_close(ft_t ft);
 
 int st_geteffect_opt(eff_t, int, char **);
@@ -271,12 +273,6 @@
 ft_t st_initformat(void);
 int st_parsesamples(st_rate_t rate, char *str, st_size_t *samples, char def);
 
-/* FIXME: Recording hacks shouldn't display a "sigint" style interface.
- * Instead we should provide a function to call when done playing/recording.
- * sox.c should be responsible for registering to sigint.
- */
-void sigintreg(ft_t);
-
 /* FIXME: these declared in util.c, global is inappropriate for lib */
 extern int verbose;     /* be noisy on stderr */
 extern char *myname;
@@ -294,6 +290,7 @@
 #define ST_EPERM 2004           /* Operation not permitted */
 #define ST_ENOTSUP 2005         /* Operation not supported */
 #define ST_EINVAL 2006          /* Invalid argument */
+#define ST_EFFMT 2007           /* Unsupported file format */
 
 #ifdef __cplusplus
 } /* end of extern "C" */
--- a/src/stio.c
+++ b/src/stio.c
@@ -62,7 +62,6 @@
                 return ST_EOF;
         }
 
-        /* anyway to check length on st_encoding_str[] ? */
         if (ft->info.encoding <= 0  || ft->info.encoding > ST_ENCODING_MAX)
         {
                 st_fail_errno(ft,ST_EFMT,"data encoding %i is invalid");
@@ -95,8 +94,7 @@
 
     if (st_gettype(ft) != ST_SUCCESS)
     {
-        /* FIXME */
-        st_fail("Unknown input file format for '%s':  %s", 
+        st_warn("Unknown input file format for '%s':  %s", 
                 ft->filename, 
                 ft->st_errstr);
         goto input_error;
@@ -118,8 +116,7 @@
             ft->fp = stdin;
         else if ((ft->fp = fopen(ft->filename, "rb")) == NULL)
         {
-            /* FIXME */
-            st_fail("Can't open input file '%s': %s", ft->filename,
+            st_warn("Can't open input file '%s': %s", ft->filename,
                     strerror(errno));
             goto input_error;
         }
@@ -131,8 +128,7 @@
     /* Read and write starters can change their formats. */
     if ((*ft->h->startread)(ft) != ST_SUCCESS)
     {
-        /* FIXME */
-        st_fail("Failed reading %s: %s", ft->filename, ft->st_errstr);
+        st_warn("Failed reading %s: %s", ft->filename, ft->st_errstr);
         goto input_error;
     }
 
@@ -248,8 +244,7 @@
 
     if (st_gettype(ft) != ST_SUCCESS)
     {
-        /* FIXME */
-        st_fail("Unknown output file format for '%s':  %s", 
+        st_warn("Unknown output file format for '%s':  %s", 
                 ft->filename, 
                 ft->st_errstr);
         goto output_error;
@@ -274,8 +269,7 @@
         }
         else if ((ft->fp = fopen(ft->filename, "wb")) == NULL)
         {
-            /* FIXME */
-            st_fail("Can't open output file '%s': %s", ft->filename,
+            st_warn("Can't open output file '%s': %s", ft->filename,
                     strerror(errno));
             goto output_error;
         }
@@ -285,8 +279,7 @@
         /* FIXME: Use buffer size from ft structure */
         if (setvbuf (ft->fp, NULL, _IOFBF, sizeof(char)*ST_BUFSIZ))
         {
-            /* FIXME */
-            st_fail("Can't set write buffer");
+            st_warn("Can't set write buffer");
             goto output_error;
         }
 
@@ -299,8 +292,7 @@
     /* Read and write starters can change their formats. */
     if ((*ft->h->startwrite)(ft) != ST_SUCCESS)
     {
-        /* FIXME */
-        st_fail("Failed writing %s: %s", ft->filename, ft->st_errstr);
+        st_warn("Failed writing %s: %s", ft->filename, ft->st_errstr);
         goto output_error;
     }
 
@@ -321,6 +313,16 @@
         free(ft->filetype);
     free(ft);
     return NULL;
+}
+
+st_ssize_t st_read(ft_t ft, st_sample_t *buf, st_ssize_t len)
+{
+    return (*ft->h->read)(ft, buf, len);
+}
+
+st_ssize_t st_write(ft_t ft, st_sample_t *buf, st_ssize_t len)
+{
+    return (*ft->h->write)(ft, buf, len);
 }
 
 int st_close(ft_t ft)
--- a/src/sunaudio.c
+++ b/src/sunaudio.c
@@ -181,7 +181,6 @@
 #endif
     /* Change to non-buffered I/O*/
     setvbuf(ft->fp, NULL, _IONBF, sizeof(char) * ft->file.size);
-    sigintreg(ft);      /* Prepare to catch SIGINT */
 
     return (ST_SUCCESS);
 }
--- a/src/util.c
+++ b/src/util.c
@@ -10,7 +10,6 @@
 #include "st_i.h"
 #include <string.h>
 #include <ctype.h>
-#include <signal.h>
 
 #ifdef __STDC__
 #include <stdarg.h>
@@ -318,30 +317,6 @@
         effect_mask |= ST_EFF_RATE;
 
     return effect_mask;
-}
-
-/*
- * File format routines
- */
-static ft_t ft_queue[2] = {0, 0};
-
-static void sigint(int s)
-{
-    if (s == SIGINT) {
-        if (ft_queue[0])
-            ft_queue[0]->file.eof = 1;
-        if (ft_queue[1])
-            ft_queue[1]->file.eof = 1;
-    }
-}
-
-void sigintreg(ft_t ft)
-{
-    if (ft_queue[0] == 0)
-        ft_queue[0] = ft;
-    else
-        ft_queue[1] = ft;
-    signal(SIGINT, sigint);
 }
 
 /*
--- a/src/vorbis.c
+++ b/src/vorbis.c
@@ -126,7 +126,7 @@
 
         /* Record audio info */
         ft->info.rate = vi->rate;
-        ft->info.size = ST_SIZE_32BIT;
+        ft->info.size = ST_SIZE_16BIT;
         ft->info.encoding = ST_ENCODING_VORBIS;
         ft->info.channels = vi->channels;
 
@@ -350,7 +350,7 @@
         vorbis_enc_t *ve;
         long rate;
 
-        ft->info.size = ST_SIZE_32BIT;
+        ft->info.size = ST_SIZE_16BIT;
         ft->info.encoding = ST_ENCODING_VORBIS;
 
         /* Allocate memory for all of the structures */
--- a/src/wav.c
+++ b/src/wav.c
@@ -1356,7 +1356,7 @@
          ft->info.encoding == ST_ENCODING_GSM) &&
          ft->info.size != ST_SIZE_BYTE)
     {
-        st_warn("Overriding output size to bytes for compressed data.");
+        st_report("Overriding output size to bytes for compressed data.");
         ft->info.size = ST_SIZE_BYTE;
     }
 
@@ -1371,7 +1371,7 @@
                     ft->info.encoding != ST_ENCODING_ADPCM &&
                     ft->info.encoding != ST_ENCODING_IMA_ADPCM)
             {
-                st_warn("Do not support %s with 8-bit data.  Forcing to unsigned",st_encodings_str[(unsigned char)ft->info.encoding]);
+                st_report("Do not support %s with 8-bit data.  Forcing to unsigned",st_encodings_str[(unsigned char)ft->info.encoding]);
                 ft->info.encoding = ST_ENCODING_UNSIGNED;
             }
             break;
@@ -1379,7 +1379,7 @@
             wBitsPerSample = 16;
             if (ft->info.encoding != ST_ENCODING_SIGN2)
             {
-                st_warn("Do not support %s with 16-bit data.  Forcing to Signed.",st_encodings_str[(unsigned char)ft->info.encoding]);
+                st_report("Do not support %s with 16-bit data.  Forcing to Signed.",st_encodings_str[(unsigned char)ft->info.encoding]);
                 ft->info.encoding = ST_ENCODING_SIGN2;
             }
             break;
@@ -1388,13 +1388,13 @@
             if (ft->info.encoding != ST_ENCODING_SIGN2 &&
                 ft->info.encoding != ST_ENCODING_FLOAT)
             {
-                st_warn("Do not support %s with 32-bit data.  Forcing to Signed.",st_encodings_str[(unsigned char)ft->info.encoding]);
+                st_report("Do not support %s with 32-bit data.  Forcing to Signed.",st_encodings_str[(unsigned char)ft->info.encoding]);
                 ft->info.encoding = ST_ENCODING_SIGN2;
             }
 
             break;
         default:
-            st_warn("Do not support %s in WAV files.  Forcing to Signed Words.",st_sizes_str[(unsigned char)ft->info.size]);
+            st_report("Do not support %s in WAV files.  Forcing to Signed Words.",st_sizes_str[(unsigned char)ft->info.size]);
             ft->info.encoding = ST_ENCODING_SIGN2;
             ft->info.size = ST_SIZE_WORD;
             wBitsPerSample = 16;
@@ -1452,7 +1452,7 @@
 #ifdef ENABLE_GSM
             if (wChannels!=1)
             {
-                st_warn("Overriding GSM audio from %d channel to 1\n",wChannels);
+                st_report("Overriding GSM audio from %d channel to 1\n",wChannels);
                 wChannels = ft->info.channels = 1;
             }
             wFormatTag = WAVE_FORMAT_GSM610;