[prev in list] [next in list] [prev in thread] [next in thread] 

List:       sox-commits
Subject:    [SoX-commits] [git] b4debb5cd3 More detailed effects chain debugging output
From:       "Ulrich Klauer" <uklauer () users ! sourceforge ! net>
Date:       2012-03-07 1:49:24
Message-ID: E1S560O-0005TV-8G () sfs-ml-4 ! v29 ! ch3 ! sourceforge ! com
[Download RAW message or body]

This is an automated email from the git hooks/post-receive script. It was
generated because a ref change was pushed to the repository containing
the project "sox".

The branch, master has been updated
       via  b4debb5cd3cbcdb5b89c8518fbab75a112fb4206 (commit)
       via  bb3de85b4548137544fc06a3e10a2b30c9e017cd (commit)
       via  2fcc4d9eec388ee6583fbda2235b690b718159f0 (commit)
       via  af232e336fe93e45fa6d970ee7655dd08600c152 (commit)
       via  62eaa64589f187826fcb31bcf18341b0baf07441 (commit)
       via  f05b1a3f9f311cb1b7f53c1ddc29c0ad644529c8 (commit)
       via  284d1de103828fc0d47cac0544abf15806da779e (commit)
      from  eb205813c2efd425674e14462706aa1cd9a62190 (commit)

Those revisions listed above that are new to this repository have
not appeared on any other notification email; so we list those
revisions in full, below.

- Log -----------------------------------------------------------------
commit b4debb5cd3cbcdb5b89c8518fbab75a112fb4206
Author: Ulrich Klauer <ulrich@chirlu.de>
Date:   Fri Jan 27 16:44:23 2012 +0100

    More detailed effects chain debugging output
    
    Output more information about the output buffers when
    DEBUG_EFFECTS_CHAIN is set.

diff --git a/src/effects.c b/src/effects.c
index 81f7830..5186f41 100644
--- a/src/effects.c
+++ b/src/effects.c
@@ -285,10 +285,6 @@ static int flow_effect(sox_effects_chain_t * chain, size_t n)
     idone = effp->flows * idone_last;
     obeg = effp->flows * odone_last;
   }
-#if DEBUG_EFFECTS_CHAIN
-  lsx_report("flow:  %5" PRIuPTR " %5" PRIuPTR " %5" PRIuPTR " %5" PRIuPTR,
-      pre_idone, pre_odone, idone, obeg);
-#endif
   effp1->obeg += idone;
   if (effp1->obeg == effp1->oend)
     effp1->obeg = effp1->oend = 0;
@@ -300,6 +296,14 @@ static int flow_effect(sox_effects_chain_t * chain, size_t n)
 
   effp->oend += obeg;
 
+#if DEBUG_EFFECTS_CHAIN
+  lsx_report("\t" "flow:  %2" PRIuPTR " (%1" PRIuPTR ")  "
+      "%5" PRIuPTR " %5" PRIuPTR " %5" PRIuPTR " %5" PRIuPTR "  "
+      "%5" PRIuPTR " [%" PRIuPTR "-%" PRIuPTR "]",
+      n, effp->flows, pre_idone, pre_odone, idone, obeg,
+      effp1->oend - effp1->obeg, effp1->obeg, effp1->oend);
+#endif
+
   return effstatus == SOX_SUCCESS? SOX_SUCCESS : SOX_EOF;
 }
 
@@ -342,15 +346,17 @@ static int drain_effect(sox_effects_chain_t * chain, size_t n)
         *obuf++ = chain->obufc[f][i];
     obeg = f * odone_last;
   }
-#if DEBUG_EFFECTS_CHAIN
-  lsx_report("drain: %5" PRIuPTR " %5" PRIuPTR " %5" PRIuPTR " %5" PRIuPTR,
-      (size_t)0, pre_odone, (size_t)0, obeg);
-#endif
   if (!obeg)   /* This is the only thing that drain has and flow hasn't */
     effstatus = SOX_EOF;
 
   effp->oend += obeg;
 
+#if DEBUG_EFFECTS_CHAIN
+  lsx_report("\t" "drain: %2" PRIuPTR " (%1" PRIuPTR ")  "
+      "%5" PRIuPTR " %5" PRIuPTR " %5" PRIuPTR " %5" PRIuPTR,
+      n, effp->flows, (size_t)0, pre_odone, (size_t)0, obeg);
+#endif
+
   return effstatus == SOX_SUCCESS? SOX_SUCCESS : SOX_EOF;
 }
 

commit bb3de85b4548137544fc06a3e10a2b30c9e017cd
Author: Ulrich Klauer <ulrich@chirlu.de>
Date:   Mon Jan 30 01:43:07 2012 +0100

    Use size_t to count effects, flows, chains, files
    
    Use only size_t for index variables etc. when effects, flows, effects
    chains, or files are counted. Previously, there was inconsistent use
    of size_t, int, or unsigned int.

diff --git a/src/effects.c b/src/effects.c
index 435412f..81f7830 100644
--- a/src/effects.c
+++ b/src/effects.c
@@ -130,7 +130,7 @@ int lsx_effect_set_imin(sox_effect_t * effp, size_t imin)
 int sox_add_effect(sox_effects_chain_t * chain, sox_effect_t * effp, \
sox_signalinfo_t * in, sox_signalinfo_t const * out)  {
   int ret, (*start)(sox_effect_t * effp) = effp->handler.start;
-  unsigned f;
+  size_t f;
   sox_effect_t eff0;  /* Copy of effect for flow 0 before calling start */
 
   effp->global_info = &chain->global_info;
@@ -186,7 +186,7 @@ int sox_add_effect(sox_effects_chain_t * chain, sox_effect_t * \
effp, sox_signali  if (chain->length == chain->table_size) {
     chain->table_size += EFF_TABLE_STEP;
     lsx_debug_more("sox_add_effect: extending effects table, "
-      "new size = %lu", (unsigned long)chain->table_size);
+      "new size = %" PRIuPTR, chain->table_size);
     lsx_revalloc(chain->effects, chain->table_size);
   }
 
@@ -213,8 +213,8 @@ static int flow_effect(sox_effects_chain_t * chain, size_t n)
 {
   sox_effect_t * effp1 = &chain->effects[n - 1][0];
   sox_effect_t * effp = &chain->effects[n][0];
-  int effstatus = SOX_SUCCESS, f = 0;
-  size_t i;
+  int effstatus = SOX_SUCCESS;
+  size_t i, f = 0;
   const sox_sample_t *ibuf;
   size_t idone = effp1->oend - effp1->obeg;
   size_t obeg = sox_globals.bufsiz - effp->oend;
@@ -237,14 +237,14 @@ static int flow_effect(sox_effects_chain_t * chain, size_t n)
 
     ibuf = &effp1->obuf[effp1->obeg];
     for (i = 0; i < idone; i += effp->flows)
-      for (f = 0; f < (int)effp->flows; ++f)
+      for (f = 0; f < effp->flows; ++f)
         chain->ibufc[f][i / effp->flows] = *ibuf++;
 
 #ifdef HAVE_OPENMP
     if (sox_globals.use_threads && effp->flows > 1)
     {
       #pragma omp parallel for
-      for (f = 0; f < (int)effp->flows; ++f) {
+      for (f = 0; f < effp->flows; ++f) {
         size_t idonec = idone / effp->flows;
         size_t odonec = obeg / effp->flows;
         int eff_status_c = effp->handler.flow(&chain->effects[n][f],
@@ -261,7 +261,7 @@ static int flow_effect(sox_effects_chain_t * chain, size_t n)
     else /* sox_globals.use_threads */
 #endif
     {
-      for (f = 0; f < (int)effp->flows; ++f) {
+      for (f = 0; f < effp->flows; ++f) {
         size_t idonec = idone / effp->flows;
         size_t odonec = obeg / effp->flows;
         int eff_status_c = effp->handler.flow(&chain->effects[n][f],
@@ -279,7 +279,7 @@ static int flow_effect(sox_effects_chain_t * chain, size_t n)
     }
 
     for (i = 0; i < odone_last; ++i)
-      for (f = 0; f < (int)effp->flows; ++f)
+      for (f = 0; f < effp->flows; ++f)
         *obuf++ = chain->obufc[f][i];
 
     idone = effp->flows * idone_last;
@@ -399,8 +399,10 @@ int sox_flow_effects(sox_effects_chain_t * chain, int (* \
callback)(sox_bool all_  ++e;
     else if (e == source_e)
       draining = sox_true;
-    else if ((int)--e < (int)source_e)
+    else if (e < source_e)
       e = source_e;
+    else
+      --e;
 
     if (callback && callback(source_e == chain->length, client_data) != SOX_SUCCESS) \
{  flow_status = SOX_EOF; /* Client has requested to stop the flow. */
@@ -420,7 +422,7 @@ int sox_flow_effects(sox_effects_chain_t * chain, int (* \
callback)(sox_bool all_  
 sox_uint64_t sox_effects_clips(sox_effects_chain_t * chain)
 {
-  unsigned i, f;
+  size_t i, f;
   uint64_t clips = 0;
   for (i = 1; i < chain->length - 1; ++i)
     for (f = 0; f < chain->effects[i][0].flows; ++f)
@@ -430,7 +432,7 @@ sox_uint64_t sox_effects_clips(sox_effects_chain_t * chain)
 
 sox_uint64_t sox_stop_effect(sox_effect_t *effp)
 {
-  unsigned f;
+  size_t f;
   uint64_t clips = 0;
 
   for (f = 0; f < effp->flows; ++f) {
@@ -445,7 +447,7 @@ void sox_push_effect_last(sox_effects_chain_t *chain, \
sox_effect_t *effp)  if (chain->length == chain->table_size) {
     chain->table_size += EFF_TABLE_STEP;
     lsx_debug_more("sox_push_effect_last: extending effects table, "
-        "new size = %lu", (unsigned long)chain->table_size);
+        "new size = %" PRIuPTR, chain->table_size);
     lsx_revalloc(chain->effects, chain->table_size);
   }
 
@@ -473,7 +475,7 @@ sox_effect_t *sox_pop_effect_last(sox_effects_chain_t *chain)
 void sox_delete_effect(sox_effect_t *effp)
 {
   uint64_t clips;
-  unsigned f;
+  size_t f;
 
   if ((clips = sox_stop_effect(effp)) != 0)
     lsx_warn("%s clipped %" PRIu64 " samples; decrease volume?",
diff --git a/src/sox.c b/src/sox.c
index bd89cbe..b08d338 100644
--- a/src/sox.c
+++ b/src/sox.c
@@ -178,9 +178,9 @@ static size_t *user_effargs_size = NULL;  /* array: size of \
user_effargs for eac  /* Size of memory structures related to effects arguments \
                (user_effargs[i],
  * user_effargs[i][j].argv) to be extended in steps of EFFARGS_STEP */
 #define EFFARGS_STEP 8
-static unsigned *nuser_effects = NULL;  /* array: number of effects in each chain */
-static int current_eff_chain = 0;
-static int eff_chain_count = 0;
+static size_t *nuser_effects = NULL;  /* array: number of effects in each chain */
+static size_t current_eff_chain = 0;
+static size_t eff_chain_count = 0;
 static sox_bool very_first_effchain = sox_true;
   /* Indicates that not only the first effects chain is in effect (hrm), but
      also that it has never been restarted. Only then we may use the
@@ -745,7 +745,7 @@ static void add_eff_chain(void)
  */
 static void free_eff_chain(void)
 {
-  unsigned j;
+  size_t j;
   int k;
   for (j = 0; j < nuser_effects[eff_chain_count]; j++)
   {
@@ -792,8 +792,7 @@ static sox_bool is_pseudo_effect(const char *s)
 static void parse_effects(int argc, char ** argv)
 {
   while (optstate.ind < argc) {
-    unsigned eff_offset;
-    size_t j;
+    size_t eff_offset, j;
     int newline_mode = 0;
 
     eff_offset = nuser_effects[eff_chain_count];
@@ -1012,7 +1011,7 @@ static void read_user_effects(char const *filename)
  */
 static void create_user_effects(void)
 {
-  unsigned i;
+  size_t i;
   sox_effect_t *effp;
   size_t num_effects = nuser_effects[current_eff_chain];
 
@@ -1056,7 +1055,7 @@ static void add_effects(sox_effects_chain_t *chain)
 {
   sox_signalinfo_t signal = combiner_signal;
   int guard = is_guarded - 1;
-  unsigned i;
+  size_t i;
   sox_effect_t * effp;
   char * rate_arg = is_player ? (play_rate_arg ? play_rate_arg : "-l") : NULL;
 
@@ -1189,7 +1188,7 @@ static int advance_eff_chain(void)
 
 static uint64_t total_clips(void)
 {
-  unsigned i;
+  size_t i;
   uint64_t clips = 0;
   for (i = 0; i < file_count; ++i)
     clips += files[i]->ft->clips + files[i]->volume_clips;
@@ -1596,7 +1595,7 @@ static void calculate_combiner_signal_parameters(void)
    * -n isn't as convenient.
    */
   for (i = 0; i < input_count; i++) {
-    unsigned j;
+    size_t j;
     for (j =0; j < nuser_effects[current_eff_chain] &&
                !files[i]->ft->signal.channels; ++j)
       files[i]->ft->signal.channels = user_efftab[j]->in_signal.channels;
@@ -2013,7 +2012,7 @@ static void usage(char const * message)
 
 static void usage_effect(char const * name)
 {
-  int i;
+  size_t i;
 
   display_SoX_version(stdout);
   putchar('\n');
@@ -2875,7 +2874,7 @@ int main(int argc, char **argv)
 
   signal(SIGINT, SIG_IGN); /* So child pipes aren't killed by track skip */
   for (i = 0; i < input_count; i++) {
-    int j = input_count - 1 - i; /* Open in reverse order 'cos of rec (below) */
+    size_t j = input_count - 1 - i; /* Open in reverse order 'cos of rec (below) */
     file_t * f = files[j];
 
     /* When mixing audio, default to input side volume adjustments that will
diff --git a/src/sox.h b/src/sox.h
index bf1677f..eb9510e 100644
--- a/src/sox.h
+++ b/src/sox.h
@@ -1620,12 +1620,12 @@ Chain of effects to be applied to a stream.
 */
 typedef struct sox_effects_chain_t {
   sox_effect_t **effects;                  /**< Table of effects to be applied to a \
                stream */
-  unsigned length;                         /**< Number of effects to be applied */
+  size_t length;                           /**< Number of effects to be applied */
   sox_effects_globals_t global_info;       /**< Copy of global effects settings */
   sox_encodinginfo_t const * in_enc;       /**< Input encoding */
   sox_encodinginfo_t const * out_enc;      /**< Output encoding */
   /* The following items are private to the libSoX effects chain functions. */
-  unsigned table_size;                     /**< Size of effects table (including \
unused entries) */ +  size_t table_size;                       /**< Size of effects \
table (including unused entries) */  sox_sample_t **ibufc;                    /**< \
Channel interleave buffer */  sox_sample_t **obufc;                    /**< Channel \
interleave buffer */  } sox_effects_chain_t;

commit 2fcc4d9eec388ee6583fbda2235b690b718159f0
Author: Ulrich Klauer <ulrich@chirlu.de>
Date:   Sat Jan 28 06:55:47 2012 +0100

    Reorder effect and effects chain structure members
    
    Put members of sox_effect_t and sox_effects_chain_t that are for
    internal use only to the end of the structures.
    
    This breaks ABI compatibility, but will make it easier to change them
    in future if needed, since offsets for non-private members won't have
    to change again then.

diff --git a/src/sox.h b/src/sox.h
index 07aedeb..bf1677f 100644
--- a/src/sox.h
+++ b/src/sox.h
@@ -1,6 +1,6 @@
 /* libSoX Library Public Interface
  *
- * Copyright 1999-2011 Chris Bagwell and SoX Contributors.
+ * Copyright 1999-2012 Chris Bagwell and SoX Contributors.
  *
  * This source code is freely redistributable and may be used for
  * any purpose.  This copyright notice must be maintained.
@@ -1603,14 +1603,15 @@ struct sox_effect_t {
   sox_encodinginfo_t       const * in_encoding;  /**< Information about the incoming \
data encoding */  sox_encodinginfo_t       const * out_encoding; /**< Information \
about the outgoing data encoding */  sox_effect_handler_t     handler;   /**< The \
                handler for this effect */
-  sox_sample_t             * obuf;    /**< output buffer */
-  size_t                   obeg;      /**< output buffer: start of valid data \
                section */
-  size_t                   oend;      /**< output buffer: one past valid data \
                section (oend-obeg is length of current content) */
-  size_t               imin;          /**< minimum input buffer content required for \
calling this effect's flow function; set via lsx_effect_set_imin() */  sox_uint64_t   \
clips;         /**< increment if clipping occurs */  size_t               flows;      \
/**< 1 if MCHAN, number of chans otherwise */  size_t               flow;          \
/**< flow number */  void                 * priv;        /**< Effect's private data \
area (each flow has a separate copy) */ +  /* The following items are private to the \
libSoX effects chain functions. */ +  sox_sample_t             * obuf;    /**< output \
buffer */ +  size_t                   obeg;      /**< output buffer: start of valid \
data section */ +  size_t                   oend;      /**< output buffer: one past \
valid data section (oend-obeg is length of current content) */ +  size_t              \
imin;          /**< minimum input buffer content required for calling this effect's \
flow function; set via lsx_effect_set_imin() */  };
 
 /**
@@ -1619,13 +1620,14 @@ Chain of effects to be applied to a stream.
 */
 typedef struct sox_effects_chain_t {
   sox_effect_t **effects;                  /**< Table of effects to be applied to a \
                stream */
-  unsigned table_size;                     /**< Number of entries in effects table \
*/  unsigned length;                         /**< Number of effects to be applied */
-  sox_sample_t **ibufc;                    /**< Channel interleave buffer */
-  sox_sample_t **obufc;                    /**< Channel interleave buffer */
   sox_effects_globals_t global_info;       /**< Copy of global effects settings */
   sox_encodinginfo_t const * in_enc;       /**< Input encoding */
   sox_encodinginfo_t const * out_enc;      /**< Output encoding */
+  /* The following items are private to the libSoX effects chain functions. */
+  unsigned table_size;                     /**< Size of effects table (including \
unused entries) */ +  sox_sample_t **ibufc;                    /**< Channel \
interleave buffer */ +  sox_sample_t **obufc;                    /**< Channel \
interleave buffer */  } sox_effects_chain_t;
 
 /*****************************************************************************

commit af232e336fe93e45fa6d970ee7655dd08600c152
Author: Ulrich Klauer <ulrich@chirlu.de>
Date:   Mon Jan 30 21:48:35 2012 +0100

    Increment library version
    
    Increment SHLIB_VERSION in preparation of ABI breaks.

diff --git a/configure.ac b/configure.ac
index b656271..5103200 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,7 +22,7 @@ AC_PROG_INSTALL
 AC_PROG_LN_S
 
 dnl Increase version when binary compatibility with previous version is broken
-SHLIB_VERSION=2:0:0
+SHLIB_VERSION=3:0:0
 AC_SUBST(SHLIB_VERSION)
 
 AC_ARG_WITH(libltdl,

commit 62eaa64589f187826fcb31bcf18341b0baf07441
Author: Ulrich Klauer <ulrich@chirlu.de>
Date:   Tue Jan 24 00:32:54 2012 +0100

    Simpler swap effect

diff --git a/ChangeLog b/ChangeLog
index 727efea..98ca989 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -15,6 +15,7 @@ Previously deprecated features that have been removed in this \
release:  14.3.0   O -1/-2/-3/-4/-8        -b
   14.3.0   O -s/-u/-f              -e
   14.3.0   O -A/-U/-o/-i/-a/-g     -e
+  14.4.0   E swap with parameters  remix
 
 Previously deprecated features (to be removed in future):
 
@@ -22,7 +23,6 @@ Previously deprecated features (to be removed in future):
   ated in  [F(ormat)] [E(ffect)]   Replacement             due after
   -------  ----------------------  ----------------------  -------
   14.4.0   E mixer                 remix                   2013-03-04
-  14.4.0   E swap with parameters  remix                   14.4.0
 
 
 sox-14.4.0	2012-03-04
diff --git a/FEATURES.in b/FEATURES.in
index c2d7351..bb4bfcd 100644
--- a/FEATURES.in
+++ b/FEATURES.in
@@ -97,7 +97,7 @@ The audio effects/tools included in this release are as follows:
 ** channels: Auto mix or duplicate to change number of channels
 ** divide+: Divide sample values by those in the 1st channel (W.I.P.)
 ** remix: Produce arbitrarily mixed output channels
-** swap: Swap stereo channels
+** swap: Swap pairs of channels
 
 * Pitch/tempo effects
 ** bend: Bend pitch at given times without changing tempo
diff --git a/sox.1 b/sox.1
index 869c165..d033c26 100644
--- a/sox.1
+++ b/sox.1
@@ -3657,7 +3657,10 @@ See also the
 effect.
 .TP
 \fBswap\fR
-Swap stereo channels.
+Swap stereo channels.  If the input is not stereo, pairs of channels are
+swapped, and a possible odd last channel passed through.  E.g., for seven
+channels, the output order will be 2, 1, 4, 3, 6, 5, 7.
+.SP
 See also
 .B remix
 for an effect that allows arbitrary channel selection and ordering
diff --git a/src/swap.c b/src/swap.c
index 2cc383f..d39310c 100644
--- a/src/swap.c
+++ b/src/swap.c
@@ -1,192 +1,62 @@
-/* libSoX swap - effect to swap ordering of channels in multi-channel audio.
+/* libSoX effect: swap pairs of audio channels
  *
- * Written by Chris Bagwell (cbagwell@sprynet.com) - March 16, 1999
+ * First version written 01/2012 by Ulrich Klauer.
+ * Replaces an older swap effect originally written by Chris Bagwell
+ * on March 16, 1999.
  *
-  * Copyright 1999 Chris Bagwell And Sundry Contributors
- * This source code is freely redistributable and may be used for
- * any purpose.  This copyright notice must be maintained.
- * Chris Bagwell And Sundry Contributors are not responsible for
- * the consequences of using this software.
+ * Copyright 2012 Chris Bagwell and SoX Contributors
+ *
+ * This library is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as published by
+ * the Free Software Foundation; either version 2.1 of the License, or (at
+ * your option) any later version.
+ *
+ * This library is distributed in the hope that it will be useful, but
+ * WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU Lesser
+ * General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License
+ * along with this library; if not, write to the Free Software Foundation,
+ * Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
  */
 
-
 #include "sox_i.h"
 
-typedef struct {
-  int         order[4];
-  int         def_opts;
-} priv_t;
-
-/*
- * Process options
- *
- * Don't do initialization now.
- * The 'info' fields are not yet filled in.
- */
-static int sox_swap_getopts(sox_effect_t * effp, int argc, char **argv)
+static int start(sox_effect_t *effp)
 {
-    priv_t * swap = (priv_t *) effp->priv;
-  --argc, ++argv;
-
-    if (argc)
-      lsx_warn("Invoking this effect with parameters is deprecated; use `remix' \
                instead.");
-
-    swap->order[0] = swap->order[1] = swap->order[2] = swap->order[3] = 0;
-    if (argc)
-    {
-        swap->def_opts = 0;
-        if (argc != 2 && argc != 4)
-          return lsx_usage(effp);
-        else if (argc == 2)
-        {
-            sscanf(argv[0],"%d",&swap->order[0]);
-            sscanf(argv[1],"%d",&swap->order[1]);
-        }
-        else
-        {
-            sscanf(argv[0],"%d",&swap->order[0]);
-            sscanf(argv[1],"%d",&swap->order[1]);
-            sscanf(argv[2],"%d",&swap->order[2]);
-            sscanf(argv[3],"%d",&swap->order[3]);
-        }
-    }
-    else
-        swap->def_opts = 1;
-
-    return (SOX_SUCCESS);
+  return effp->in_signal.channels >= 2 ? SOX_SUCCESS : SOX_EFF_NULL;
 }
 
-/*
- * Prepare processing.
- * Do all initializations.
- */
-static int sox_swap_start(sox_effect_t * effp)
+static int flow(sox_effect_t *effp, const sox_sample_t *ibuf,
+    sox_sample_t *obuf, size_t *isamp, size_t *osamp)
 {
-    priv_t * swap = (priv_t *) effp->priv;
-    int i;
-
-    if (effp->out_signal.channels == 1)
-    {
-        lsx_fail("Can't swap channels on mono data.");
-        return (SOX_EOF);
-    }
-
-    if (effp->out_signal.channels == 2)
-    {
-        if (swap->def_opts)
-        {
-            swap->order[0] = 2;
-            swap->order[1] = 1;
-        }
-
-        if (swap->order[2] || swap->order[3])
-        {
-            lsx_fail("invalid swap channel options used");
-        }
-        if (swap->order[0] != 1 && swap->order[0] != 2)
-            lsx_fail("invalid swap channel options used");
-        if (swap->order[1] != 1 && swap->order[1] != 2)
-            lsx_fail("invalid swap channel options used");
-
-        /* Convert to array offsets */
-        swap->order[0]--;
-        swap->order[1]--;
+  size_t len = min(*isamp, *osamp);
+  size_t channels = effp->in_signal.channels;
+  len /= channels;
+  *isamp = *osamp = len * channels;
+
+  while (len--) {
+    size_t i;
+    for (i = 0; i + 1 < channels; i += 2) {
+      *obuf++ = ibuf[1];
+      *obuf++ = ibuf[0];
+      ibuf += 2;
     }
+    if (channels % 2)
+      *obuf++ = *ibuf++;
+  }
 
-    if (effp->out_signal.channels == 4)
-    {
-        if (swap->def_opts)
-        {
-            swap->order[0] = 2;
-            swap->order[1] = 1;
-            swap->order[2] = 4;
-            swap->order[3] = 3;
-        }
-
-        if (swap->order[0] < 1 || swap->order[0] > 4)
-            lsx_fail("invalid swap channel options used");
-        if (swap->order[1] < 1 || swap->order[1] > 4)
-            lsx_fail("invalid swap channel options used");
-        if (swap->order[2] < 1 || swap->order[2] > 4)
-            lsx_fail("invalid swap channel options used");
-        if (swap->order[3] < 1 || swap->order[3] > 4)
-            lsx_fail("invalid swap channel options used");
-
-        /* Convert to array offsets */
-        swap->order[0]--;
-        swap->order[1]--;
-        swap->order[2]--;
-        swap->order[3]--;
-
-    }
-
-    for (i = 0; i < (int)effp->out_signal.channels; ++i)
-      if (swap->order[i] != i)
-        return SOX_SUCCESS;
-
-    return SOX_EFF_NULL;
-}
-
-/*
- * Processed signed long samples from ibuf to obuf.
- * Return number of samples processed.
- */
-static int sox_swap_flow(sox_effect_t * effp, const sox_sample_t *ibuf, sox_sample_t \
                *obuf,
-                 size_t *isamp, size_t *osamp)
-{
-    priv_t * swap = (priv_t *) effp->priv;
-    int len, done;
-
-    switch (effp->out_signal.channels)
-    {
-    case 2:
-        /* Length to process will be buffer length / 2 since we
-         * work with two samples at a time.
-         */
-        len = ((*isamp > *osamp) ? *osamp : *isamp) / 2;
-        for(done = 0; done < len; done++)
-        {
-            obuf[0] = ibuf[swap->order[0]];
-            obuf[1] = ibuf[swap->order[1]];
-            /* Advance buffer by 2 samples */
-            ibuf += 2;
-            obuf += 2;
-        }
-
-        *isamp = len * 2;
-        *osamp = len * 2;
-
-        break;
-
-    case 4:
-        /* Length to process will be buffer length / 4 since we
-         * work with four samples at a time.
-         */
-        len = ((*isamp > *osamp) ? *osamp : *isamp) / 4;
-        for(done = 0; done < len; done++)
-        {
-            obuf[0] = ibuf[swap->order[0]];
-            obuf[1] = ibuf[swap->order[1]];
-            obuf[2] = ibuf[swap->order[2]];
-            obuf[3] = ibuf[swap->order[3]];
-            /* Advance buffer by 2 samples */
-            ibuf += 4;
-            obuf += 4;
-        }
-        *isamp = len * 4;
-        *osamp = len * 4;
-
-        break;
-    }
-    return (SOX_SUCCESS);
+  return SOX_SUCCESS;
 }
 
-const sox_effect_handler_t *lsx_swap_effect_fn(void)
+sox_effect_handler_t const *lsx_swap_effect_fn(void)
 {
   static sox_effect_handler_t handler = {
-    "swap", NULL, SOX_EFF_MCHAN | SOX_EFF_MODIFY,
-    sox_swap_getopts, sox_swap_start, sox_swap_flow,
-    NULL, NULL, NULL, sizeof(priv_t)
+    "swap", NULL,
+    SOX_EFF_MCHAN | SOX_EFF_MODIFY,
+    NULL, start, flow, NULL, NULL, NULL,
+    0
   };
   return &handler;
 }

commit f05b1a3f9f311cb1b7f53c1ddc29c0ad644529c8
Author: Ulrich Klauer <ulrich@chirlu.de>
Date:   Tue Jan 24 00:38:51 2012 +0100

    Remove deprecated encoding options

diff --git a/ChangeLog b/ChangeLog
index 80d5a53..727efea 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -12,6 +12,9 @@ Previously deprecated features that have been removed in this \
release:  Deprec-  Feature    [O(ption)]
   ated in  [F(ormat)] [E(ffect)]   Replacement
   -------  ----------------------  ----------------------
+  14.3.0   O -1/-2/-3/-4/-8        -b
+  14.3.0   O -s/-u/-f              -e
+  14.3.0   O -A/-U/-o/-i/-a/-g     -e
 
 Previously deprecated features (to be removed in future):
 
@@ -20,9 +23,6 @@ Previously deprecated features (to be removed in future):
   -------  ----------------------  ----------------------  -------
   14.4.0   E mixer                 remix                   2013-03-04
   14.4.0   E swap with parameters  remix                   14.4.0
-  14.3.0   O -1/-2/-3/-4/-8        -b                      14.4.0
-  14.3.0   O -s/-u/-f              -e                      14.4.0
-  14.3.0   O -A/-U/-o/-i/-a/-g     -e                      14.4.0
 
 
 sox-14.4.0	2012-03-04
diff --git a/sox.1 b/sox.1
index b28d260..869c165 100644
--- a/sox.1
+++ b/sox.1
@@ -1116,11 +1116,6 @@ example
 converts raw CD digital audio (16-bit, signed-integer) to a
 24-bit (signed-integer) `WAV' file.
 .TP
-\fB\-1\fR\^/\fB\-2\fR\^/\fB\-3\fR\^/\fB\-4\fR\^/\fB\-8\fR
-The number of bytes in each encoded sample.  Deprecated aliases for
-\fB\-b 8\fR, \fB\-b 16\fR, \fB\-b 24\fR, \fB\-b 32\fR, \fB\-b 64\fR
-respectively.
-.TP
 \fB\-c\fR \fICHANNELS\fR, \fB\-\-channels\fR \fICHANNELS\fR
 The number of audio channels in the audio file. This can be any number
 greater than zero.
@@ -1235,13 +1230,6 @@ By default (i.e. if this option is not given), the output \
encoding  type will (providing it is supported by the output file type) be set
 to the input encoding type.
 .TP
-\fB\-s\fR\^/\fB\-u\fR\^/\fB\-f\fR\^/\fB\-A\fR\^/\fB\-U\fR\^/\fB\-o\fR\^/\fB\-i\fR\^/\fB\-a\fR\^/\fB\-g\fR
                
-Deprecated aliases for specifying the encoding types
-\fBsigned-integer\fR, \fBunsigned-integer\fR, \fBfloating-point\fR, \fBa-law\fR, \
                \fBmu-law\fR, \fBoki-adpcm\fR, \fBima-adpcm\fR, \fBms-adpcm\fR, \
                \fBgsm-full-rate\fR
-respectively (see
-.B \-e
-above).
-.TP
 \fB\-\-no\-glob\fR
 Specifies that filename `globbing' (wild-card matching) should not be
 performed by SoX on the following filename.  For example, if the current
diff --git a/src/sox.c b/src/sox.c
index 665149b..bd89cbe 100644
--- a/src/sox.c
+++ b/src/sox.c
@@ -2152,7 +2152,7 @@ static void read_comment_file(sox_comments_t * comments, char \
const * const file  }
 
 static char const * const getoptstr =
-  "+ab:c:de:fghimnopqr:st:uv:xABC:DGLMNRSTUV::X12348";
+  "+b:c:de:hmnpqr:t:v:xBC:DGLMNRSTV::X";
 
 static struct lsx_option_t const long_options[] = {
   {"add-comment"     , lsx_option_arg_required, NULL, 0},
@@ -2459,34 +2459,6 @@ static char parse_gopts_and_fopts(file_t * f)
       }
       break;
 
-#define DEPRECATED lsx_warn("Option `-%c' is deprecated, use `-b %i' instead.", c, \
                (c-'0')*8)
-    case '1': f->encoding.bits_per_sample = 8;  DEPRECATED; break;
-    case '2': f->encoding.bits_per_sample = 16; DEPRECATED; break;
-    case '3': f->encoding.bits_per_sample = 24; DEPRECATED; break;
-    case '4': f->encoding.bits_per_sample = 32; DEPRECATED; break;
-    case '8': f->encoding.bits_per_sample = 64; DEPRECATED; break;
-#undef DEPRECATED
-
-#define DEPRECATED(encname) lsx_warn("Option `-%c' is deprecated, use `-e %s' \
                instead.", c, encname)
-    case 's': f->encoding.encoding = SOX_ENCODING_SIGN2;     \
                DEPRECATED("signed-integer"); break;
-    case 'u': f->encoding.encoding = SOX_ENCODING_UNSIGNED;  \
                DEPRECATED("unsigned-integer"); break;
-    case 'f': f->encoding.encoding = SOX_ENCODING_FLOAT;     \
                DEPRECATED("floating-point"); break;
-    case 'a': f->encoding.encoding = SOX_ENCODING_MS_ADPCM;  DEPRECATED("ms-adpcm"); \
                break;
-    case 'i': f->encoding.encoding = SOX_ENCODING_IMA_ADPCM; \
                DEPRECATED("ima-adpcm"); break;
-    case 'o': f->encoding.encoding = SOX_ENCODING_OKI_ADPCM; \
                DEPRECATED("oki-adpcm"); break;
-    case 'g': f->encoding.encoding = SOX_ENCODING_GSM;       \
                DEPRECATED("gsm-full-rate"); break;
-
-    case 'U': f->encoding.encoding = SOX_ENCODING_ULAW; DEPRECATED("mu-law");
-      if (f->encoding.bits_per_sample == 0)
-        f->encoding.bits_per_sample = 8;
-      break;
-
-    case 'A': f->encoding.encoding = SOX_ENCODING_ALAW; DEPRECATED("a-law");
-      if (f->encoding.bits_per_sample == 0)
-        f->encoding.bits_per_sample = 8;
-      break;
-#undef DEPRECATED
-
     case 'L': case 'B': case 'x':
       if (f->encoding.reverse_bytes != sox_option_default || \
f->encoding.opposite_endian)  usage("only one endian option per file is allowed");

commit 284d1de103828fc0d47cac0544abf15806da779e
Author: Ulrich Klauer <ulrich@chirlu.de>
Date:   Wed Mar 7 01:25:35 2012 +0100

    List deprecated features in 14.4.1 changelog

diff --git a/ChangeLog b/ChangeLog
index c37d839..80d5a53 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -7,6 +7,23 @@ sox-11gamma, followed by a list of prior authors and features.
 sox-14.4.1	20xx-xx-xx
 ----------
 
+Previously deprecated features that have been removed in this release:
+
+  Deprec-  Feature    [O(ption)]
+  ated in  [F(ormat)] [E(ffect)]   Replacement
+  -------  ----------------------  ----------------------
+
+Previously deprecated features (to be removed in future):
+
+  Deprec-  Feature    [O(ption)]                           Removal
+  ated in  [F(ormat)] [E(ffect)]   Replacement             due after
+  -------  ----------------------  ----------------------  -------
+  14.4.0   E mixer                 remix                   2013-03-04
+  14.4.0   E swap with parameters  remix                   14.4.0
+  14.3.0   O -1/-2/-3/-4/-8        -b                      14.4.0
+  14.3.0   O -s/-u/-f              -e                      14.4.0
+  14.3.0   O -A/-U/-o/-i/-a/-g     -e                      14.4.0
+
 
 sox-14.4.0	2012-03-04
 ----------
@@ -117,6 +134,7 @@ Internal improvements:
   o Improve large file support by using 64-bit numbers to count
     samples. (Doug Cook, Thor Andreassen, Ulrich Klauer)
 
+
 sox-14.3.2	2011-02-27
 ----------
 

-----------------------------------------------------------------------

Summary of changes:
 ChangeLog     |   18 +++++
 FEATURES.in   |    2 +-
 configure.ac  |    2 +-
 sox.1         |   17 +----
 src/effects.c |   50 ++++++++------
 src/sox.c     |   53 +++-----------
 src/sox.h     |   20 +++---
 src/swap.c    |  216 +++++++++++---------------------------------------------
 8 files changed, 119 insertions(+), 259 deletions(-)


hooks/post-receive
-- 
sox

------------------------------------------------------------------------------
Virtualization & Cloud Management Using Capacity Planning
Cloud computing makes use of virtualization - but cloud computing 
also focuses on allowing computing to be delivered as a service.
http://www.accelacomm.com/jaw/sfnl/114/51521223/
_______________________________________________
SoX-commits mailing list
SoX-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sox-commits


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic