shithub: sox

Download patch

ref: f0c438f6e5a813322d30bebdc9c44452922bc3e8
parent: 19079619533a80049dfde894d7f7d1ff5fa31819
author: cbagwell <cbagwell>
date: Sat Oct 18 12:42:40 EDT 2008

More symbol name cleanup.

--- a/src/8svx.c
+++ b/src/8svx.c
@@ -89,7 +89,7 @@
                                 return(SOX_EOF);
                         }
                         chunk_buf[chunksize] = '\0';
-                        sox_debug("%s",chunk_buf);
+                        lsx_debug("%s",chunk_buf);
                         free(chunk_buf);
 
                         continue;
@@ -107,7 +107,7 @@
                                 return(SOX_EOF);
                         }
                         chunk_buf[chunksize] = '\0';
-                        sox_debug("%s",chunk_buf);
+                        lsx_debug("%s",chunk_buf);
                         free(chunk_buf);
 
                         continue;
--- a/src/adpcm.c
+++ b/src/adpcm.c
@@ -231,7 +231,7 @@
                 if (op) {   /* if we want output, put it in proper place */
                         op[ox>>3] |= (ox&4)? c:(c<<4);
                         ox += 4*chans;
-                        sox_debug_more("%.1x",c);
+                        lsx_debug_more("%.1x",c);
 
                 }
 
@@ -240,9 +240,9 @@
                 if (step < 16) step = 16;
 
         }
-        if (op) sox_debug_more("\n");
+        if (op) lsx_debug_more("\n");
         d2 /= n; /* be sure it's non-negative */
-        sox_debug_more("ch%d: st %d->%d, d %.1f\n", ch, *iostep, step, sqrt(d2));
+        lsx_debug_more("ch%d: st %d->%d, d %.1f\n", ch, *iostep, step, sqrt(d2));
         *iostep = step;
         return (int) sqrt(d2);
 }
@@ -277,7 +277,7 @@
 
                 s1 = s0;
                 AdpcmMashS(ch, chans, v, lsx_ms_adpcm_i_coef[k], ip, n0, &s1, NULL);
-                sox_debug_more(" s32 %d\n",s1);
+                lsx_debug_more(" s32 %d\n",s1);
                 ss = s1 = (3*s0+s1)/4;
                 d1=AdpcmMashS(ch, chans, v, lsx_ms_adpcm_i_coef[k], ip, n, &ss, NULL); /* with step s1 */
                 if (!k || d0<dmin || d1<dmin) {
@@ -292,7 +292,7 @@
                 }
         }
         *st = smin;
-        sox_debug_more("kmin %d, smin %5d, ",kmin,smin);
+        lsx_debug_more("kmin %d, smin %5d, ",kmin,smin);
         d=AdpcmMashS(ch, chans, v, lsx_ms_adpcm_i_coef[kmin], ip, n, st, obuff);
         obuff[ch] = kmin;
 }
@@ -309,7 +309,7 @@
         unsigned ch;
         unsigned char *p;
 
-        sox_debug_more("AdpcmMashI(chans %d, ip %p, n %d, st %p, obuff %p, bA %d)\n",
+        lsx_debug_more("AdpcmMashI(chans %d, ip %p, n %d, st %p, obuff %p, bA %d)\n",
             chans, (void *)ip, n, (void *)st, obuff, blockAlign);
 
         for (p=obuff+7*chans; p<obuff+blockAlign; p++) *p=0;
--- a/src/adpcms.c
+++ b/src/adpcms.c
@@ -74,7 +74,7 @@
   if (s < min_sample || s > max_sample) {
     int grace = (p->setup.steps[p->step_index] >> (p->setup.shift + 1)) & p->setup.mask;
     if (s < min_sample - grace || s > max_sample + grace) {
-      sox_debug_most("code=%i step=%i grace=%i s=%i",
+      lsx_debug_most("code=%i step=%i grace=%i s=%i",
           code & (2 * p->setup.sign - 1), p->setup.steps[p->step_index], grace, s);
       p->errors++;
     }
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -334,7 +334,7 @@
                         if (lsx_eof(ft))
                                 break;
                         buf[4] = 0;
-                        sox_debug("AIFFstartread: ignoring '%s' chunk", buf);
+                        lsx_debug("AIFFstartread: ignoring '%s' chunk", buf);
                         lsx_readdw(ft, &chunksize);
                         if (lsx_eof(ft))
                                 break;
@@ -418,12 +418,12 @@
 
         if (foundmark && !foundinstr)
         {
-            sox_debug("Ignoring MARK chunk since no INSTR found.");
+            lsx_debug("Ignoring MARK chunk since no INSTR found.");
             foundmark = 0;
         }
         if (!foundmark && foundinstr)
         {
-            sox_debug("Ignoring INSTR chunk since no MARK found.");
+            lsx_debug("Ignoring INSTR chunk since no MARK found.");
             foundinstr = 0;
         }
         if (foundmark && foundinstr) {
@@ -525,7 +525,7 @@
                         return(SOX_EOF);
                 }
         }
-  sox_debug("%-10s   \"%s\"", chunkDescription, *text);
+  lsx_debug("%-10s   \"%s\"", chunkDescription, *text);
   return(SOX_SUCCESS);
 }
 
@@ -579,7 +579,7 @@
         }
     }
   }
-  sox_debug("%-10s   \"%s\"", chunkDescription, *text);
+  lsx_debug("%-10s   \"%s\"", chunkDescription, *text);
   /* make sure we read the whole chunk */
   if (totalReadLength < chunksize) {
        size_t i;
@@ -708,7 +708,7 @@
         unsigned i;
         size_t padded_comment_size = 0, comment_size = 0;
         size_t comment_chunk_size = 0;
-        char * comment = sox_cat_comments(ft->oob.comments);
+        char * comment = lsx_cat_comments(ft->oob.comments);
 
         /* MARK and INST chunks */
         if (ft->oob.instr.nloops) {
@@ -962,7 +962,7 @@
 {
         char buf[10];
         ConvertToIeeeExtended(x, buf);
-        sox_debug_more("converted %g to %o %o %o %o %o %o %o %o %o %o",
+        lsx_debug_more("converted %g to %o %o %o %o %o %o %o %o %o %o",
                 x,
                 buf[0], buf[1], buf[2], buf[3], buf[4],
                 buf[5], buf[6], buf[7], buf[8], buf[9]);
--- a/src/au.c
+++ b/src/au.c
@@ -194,7 +194,7 @@
 
 static int write_header(sox_format_t * ft)
 {
-  char * comment  = sox_cat_comments(ft->oob.comments);
+  char * comment  = lsx_cat_comments(ft->oob.comments);
   size_t len      = strlen(comment) + 1;     /* Write out null-terminated */
   size_t info_len = max(4, (len + 3) & ~3u); /* Minimum & multiple of 4 bytes */
   size_t size     = ft->olength? ft->olength : ft->signal.length;
--- a/src/compand.c
+++ b/src/compand.c
@@ -130,10 +130,10 @@
   priv_t * l = (priv_t *) effp->priv;
   unsigned i, j;
 
-  sox_debug("%i input channel(s) expected: actually %i",
+  lsx_debug("%i input channel(s) expected: actually %i",
       l->expectedChannels, effp->out_signal.channels);
   for (i = 0; i < l->expectedChannels; ++i)
-    sox_debug("Channel %i: attack = %g decay = %g", i,
+    lsx_debug("Channel %i: attack = %g decay = %g", i,
         l->channels[i].attack_times[0], l->channels[i].attack_times[1]);
   if (!lsx_compandt_show(&l->transfer_fn, effp->global_info->plot))
     return SOX_EOF;
--- a/src/compandt.c
+++ b/src/compandt.c
@@ -27,7 +27,7 @@
   int i;
 
   for (i = 1; t->segments[i-1].x; ++i)
-    sox_debug("TF: %g %g %g %g",
+    lsx_debug("TF: %g %g %g %g",
        LOG_TO_LOG10(t->segments[i].x),
        LOG_TO_LOG10(t->segments[i].y),
        LOG_TO_LOG10(t->segments[i].a),
--- a/src/coreaudio.c
+++ b/src/coreaudio.c
@@ -139,7 +139,7 @@
 
   if (stream_desc.mChannelsPerFrame != ft->signal.channels)
   {
-    sox_debug("audio device did not accept %d channels. Use %d channels instead.", (int)ft->signal.channels, 
+    lsx_debug("audio device did not accept %d channels. Use %d channels instead.", (int)ft->signal.channels, 
               (int)stream_desc.mChannelsPerFrame);
     ft->signal.channels = stream_desc.mChannelsPerFrame;
   }
@@ -146,7 +146,7 @@
 
   if (stream_desc.mSampleRate != ft->signal.rate)
   {
-    sox_debug("audio device did not accept %d sample rate. Use %d instead.", (int)ft->signal.rate, 
+    lsx_debug("audio device did not accept %d sample rate. Use %d instead.", (int)ft->signal.rate, 
               (int)stream_desc.mSampleRate);
     ft->signal.rate = stream_desc.mSampleRate;
   }
--- a/src/cvsd-fmt.c
+++ b/src/cvsd-fmt.c
@@ -50,7 +50,7 @@
   p->last_n_bits = 5; /* 101 */
   p->step_mult = exp((-1 / .005 / ft->signal.rate));
   p->step_add = (1 - p->step_mult) * (.1 * SOX_SAMPLE_MAX);
-  sox_debug("step_mult=%g step_add=%f", p->step_mult, p->step_add);
+  lsx_debug("step_mult=%g step_add=%f", p->step_mult, p->step_add);
   return SOX_SUCCESS;
 }
 
--- a/src/cvsd.c
+++ b/src/cvsd.c
@@ -162,7 +162,7 @@
                 lsx_writeb(ft, p->bit.shreg);
                 p->bytes_written++;
         }
-        sox_debug("cvsd: min slope %f, max slope %f",
+        lsx_debug("cvsd: min slope %f, max slope %f",
                p->com.v_min, p->com.v_max);
 
         return (SOX_SUCCESS);
@@ -174,7 +174,7 @@
 {
         priv_t *p = (priv_t *) ft->priv;
 
-        sox_debug("cvsd: min value %f, max value %f",
+        lsx_debug("cvsd: min value %f, max value %f",
                p->com.v_min, p->com.v_max);
 
         return(SOX_SUCCESS);
@@ -220,8 +220,8 @@
                                           (p->cvsd_rate < 24000) ?
                                           dec_filter_16 : dec_filter_32,
                                           CVSD_DEC_FILTERLEN);
-                        sox_debug_more("input %d %f\n", debug_count, p->com.mla_int);
-                        sox_debug_more("recon %d %f\n", debug_count, oval);
+                        lsx_debug_more("input %d %f\n", debug_count, p->com.mla_int);
+                        lsx_debug_more("recon %d %f\n", debug_count, oval);
                         debug_count++;
 
                         if (oval > p->com.v_max)
@@ -289,8 +289,8 @@
                 } else
                         p->bit.mask <<= 1;
                 p->com.phase += p->com.phase_inc;
-                sox_debug_more("input %d %f\n", debug_count, inval);
-                sox_debug_more("recon %d %f\n", debug_count, p->c.enc.recon_int);
+                lsx_debug_more("input %d %f\n", debug_count, inval);
+                lsx_debug_more("recon %d %f\n", debug_count, p->c.enc.recon_int);
                 debug_count++;
         }
 }
@@ -444,7 +444,7 @@
 {
         priv_t *p = (priv_t *) ft->priv;
         size_t len;
-        char * comment = sox_cat_comments(ft->oob.comments);
+        char * comment = lsx_cat_comments(ft->oob.comments);
 
         memset(hdr->Filename, 0, sizeof(hdr->Filename));
         len = strlen(ft->filename);
@@ -479,21 +479,21 @@
             return rc;
         }
 
-        sox_debug("DVMS header of source file \"%s\":", ft->filename);
-        sox_debug("  filename  \"%.14s\"", hdr.Filename);
-        sox_debug("  id        0x%x", hdr.Id);
-        sox_debug("  state     0x%x", hdr.State);
-        sox_debug("  time      %s", ctime(&hdr.Unixtime)); /* ctime generates lf */
-        sox_debug("  usender   %u", hdr.Usender);
-        sox_debug("  ureceiver %u", hdr.Ureceiver);
-        sox_debug("  length    %lu", (unsigned long)hdr.Length);
-        sox_debug("  srate     %u", hdr.Srate);
-        sox_debug("  days      %u", hdr.Days);
-        sox_debug("  custom1   %u", hdr.Custom1);
-        sox_debug("  custom2   %u", hdr.Custom2);
-        sox_debug("  info      \"%.16s\"", hdr.Info);
+        lsx_debug("DVMS header of source file \"%s\":", ft->filename);
+        lsx_debug("  filename  \"%.14s\"", hdr.Filename);
+        lsx_debug("  id        0x%x", hdr.Id);
+        lsx_debug("  state     0x%x", hdr.State);
+        lsx_debug("  time      %s", ctime(&hdr.Unixtime)); /* ctime generates lf */
+        lsx_debug("  usender   %u", hdr.Usender);
+        lsx_debug("  ureceiver %u", hdr.Ureceiver);
+        lsx_debug("  length    %lu", (unsigned long)hdr.Length);
+        lsx_debug("  srate     %u", hdr.Srate);
+        lsx_debug("  days      %u", hdr.Days);
+        lsx_debug("  custom1   %u", hdr.Custom1);
+        lsx_debug("  custom2   %u", hdr.Custom2);
+        lsx_debug("  info      \"%.16s\"", hdr.Info);
         ft->signal.rate = (hdr.Srate < 240) ? 16000 : 32000;
-        sox_debug("DVMS rate %dbit/s using %gbit/s deviation %g%%",
+        lsx_debug("DVMS rate %dbit/s using %gbit/s deviation %g%%",
                hdr.Srate*100, ft->signal.rate,
                ((ft->signal.rate - hdr.Srate*100) * 100) / ft->signal.rate);
         rc = lsx_cvsdstartread(ft);
--- a/src/fade.c
+++ b/src/fade.c
@@ -170,7 +170,7 @@
     fade->samplesdone = fade->in_start;
     fade->endpadwarned = 0;
 
-    sox_debug("fade: in_start = %lu in_stop = %lu out_start = %lu out_stop = %lu", (unsigned long)fade->in_start, (unsigned long)fade->in_stop, (unsigned long)fade->out_start, (unsigned long)fade->out_stop);
+    lsx_debug("fade: in_start = %lu in_stop = %lu out_start = %lu out_stop = %lu", (unsigned long)fade->in_start, (unsigned long)fade->in_stop, (unsigned long)fade->out_start, (unsigned long)fade->out_stop);
 
     if (fade->in_start == fade->in_stop && fade->out_start == fade->out_stop)
       return SOX_EFF_NULL;
--- a/src/filter.c
+++ b/src/filter.c
@@ -138,7 +138,7 @@
       for (i=Dh; i<Mwing; i+=Dh)
          DCgain += ImpR[i];
       DCgain = 2*DCgain + ImpR[0];    /* DC gain of real coefficients */
-      sox_debug("DCgain err=%.12f",DCgain-1.0);
+      lsx_debug("DCgain err=%.12f",DCgain-1.0);
 
       DCgain = 1.0/DCgain;
       for (i=0; i<Mwing; i++)
@@ -181,7 +181,7 @@
                 }
                 if (*p) f->freq1 = f->freq0 = 0;
         }
-        sox_debug("freq: %g-%g", f->freq0, f->freq1);
+        lsx_debug("freq: %g-%g", f->freq0, f->freq1);
         if (f->freq0 == 0 && f->freq1 == 0)
           return lsx_usage(effp);
 
@@ -195,7 +195,7 @@
         if ((n >= 3) && !sscanf(argv[2], "%lf", &f->beta))
           return lsx_usage(effp);
 
-        sox_debug("filter opts: %g-%g, window-len %ld, beta %f", f->freq0, f->freq1, f->Nwin, f->beta);
+        lsx_debug("filter opts: %g-%g, window-len %ld, beta %f", f->freq0, f->freq1, f->Nwin, f->beta);
         return (SOX_SUCCESS);
 }
 
@@ -344,7 +344,7 @@
         long i, Nproc;
 
         /* constrain amount we actually process */
-        /* sox_debug("Xh %d, Xt %d, isamp %d, ",f->Xh, f->Xt, *isamp); */
+        /* lsx_debug("Xh %d, Xt %d, isamp %d, ",f->Xh, f->Xt, *isamp); */
         Nx = BUFFSIZE + 2*f->Xh - f->Xt;
         if (Nx > *isamp) Nx = *isamp;
         if (Nx > *osamp) Nx = *osamp;
@@ -370,7 +370,7 @@
                 *osamp = 0;
                 return (SOX_SUCCESS);
         }
-        sox_debug("flow Nproc %ld",Nproc);
+        lsx_debug("flow Nproc %ld",Nproc);
         FiltWin(f, Nproc);
 
         /* Copy back portion of input signal that must be re-used */
@@ -395,7 +395,7 @@
         long isamp_res, osamp_res;
         sox_sample_t *Obuf;
 
-        sox_debug("Xh %ld, Xt %ld  <--- DRAIN",f->Xh, f->Xt);
+        lsx_debug("Xh %ld, Xt %ld  <--- DRAIN",f->Xh, f->Xt);
 
         /* stuff end with Xh zeros */
         isamp_res = f->Xh;
@@ -406,7 +406,7 @@
                 Isamp = isamp_res;
                 Osamp = osamp_res;
                 sox_filter_flow(effp, NULL, Obuf, &Isamp, &Osamp);
-          /* sox_debug("DRAIN isamp,osamp  (%d,%d) -> (%d,%d)",
+          /* lsx_debug("DRAIN isamp,osamp  (%d,%d) -> (%d,%d)",
                  * isamp_res,osamp_res,Isamp,Osamp); */
                 Obuf += Osamp;
                 osamp_res -= Osamp;
@@ -413,7 +413,7 @@
                 isamp_res -= Isamp;
         };
         *osamp -= osamp_res;
-        /* sox_debug("DRAIN osamp %d", *osamp); */
+        /* lsx_debug("DRAIN osamp %d", *osamp); */
         if (isamp_res)
                 sox_warn("drain overran obuf by %ld", isamp_res);
         /* FIXME: This is very picky. osamp better be big enough to grab
--- a/src/flac.c
+++ b/src/flac.c
@@ -135,7 +135,7 @@
 static int start_read(sox_format_t * const ft)
 {
   priv_t * p = (priv_t *)ft->priv;
-  sox_debug("API version %u", FLAC_API_VERSION_CURRENT);
+  lsx_debug("API version %u", FLAC_API_VERSION_CURRENT);
   p->decoder = FLAC__stream_decoder_new();
   if (p->decoder == NULL) {
     lsx_fail_errno(ft, SOX_ENOMEM, "FLAC ERROR creating the decoder instance");
--- a/src/flanger.c
+++ b/src/flanger.c
@@ -167,7 +167,7 @@
   /* Balance feedback loop: */
   f->delay_gain *= 1 - fabs(f->feedback_gain);
 
-  sox_debug("in_gain=%g feedback_gain=%g delay_gain=%g\n",
+  lsx_debug("in_gain=%g feedback_gain=%g delay_gain=%g\n",
       f->in_gain, f->feedback_gain, f->delay_gain);
 
   /* Create the delay buffers, one for each channel: */
@@ -190,7 +190,7 @@
       (double)(f->delay_buf_length - 2),
       3 * M_PI_2);  /* Start the sweep at minimum delay (for mono at least) */
 
-  sox_debug("delay_buf_length=%lu lfo_length=%lu\n",
+  lsx_debug("delay_buf_length=%lu lfo_length=%lu\n",
       (unsigned long)f->delay_buf_length, (unsigned long)f->lfo_length);
 
   return SOX_SUCCESS;
--- a/src/formats.c
+++ b/src/formats.c
@@ -229,7 +229,7 @@
   *comments = 0;
 }
 
-char * sox_cat_comments(sox_comments_t comments)
+char * lsx_cat_comments(sox_comments_t comments)
 {
   sox_comments_t p = comments;
   size_t len = 0;
@@ -961,7 +961,7 @@
     if (ret > 0 && ret < (int)MAX_NAME_LEN) {
       union {sox_format_fn_t fn; lt_ptr ptr;} ltptr;
       ltptr.ptr = lt_dlsym(lth, fnname);
-      sox_debug("opening format plugin `%s': library %p, entry point %p\n", fnname, (void *)lth, ltptr.ptr);
+      lsx_debug("opening format plugin `%s': library %p, entry point %p\n", fnname, (void *)lth, ltptr.ptr);
       if (nformats < MAX_FORMATS && ltptr.fn && (ltptr.fn()->sox_lib_version_code & ~255) == (SOX_LIB_VERSION_CODE & ~255))
         sox_format_fns[nformats++].fn = ltptr.fn;
     }
--- a/src/hcom.c
+++ b/src/hcom.c
@@ -147,7 +147,7 @@
         for(i = 0; i < dictsize; i++) {
                 lsx_readsw(ft, &(p->dictionary[i].dict_leftson));
                 lsx_readsw(ft, &(p->dictionary[i].dict_rightson));
-                sox_debug("%d %d",
+                lsx_debug("%d %d",
                        p->dictionary[i].dict_leftson,
                        p->dictionary[i].dict_rightson);
         }
@@ -159,7 +159,7 @@
         p->checksum = checksum;
         p->deltacompression = compresstype;
         if (!p->deltacompression)
-                sox_debug("HCOM data using value compression");
+                lsx_debug("HCOM data using value compression");
         p->huffcount = huffcount;
         p->cksum = 0;
         p->dictentry = 0;
@@ -389,8 +389,8 @@
   for (i = 0; i < 256; i++)
     l += frequtable[i] * codesize[i];
   l = (((l + 31) >> 5) << 2) + 24 + dictsize * 4;
-  sox_debug("  Original size: %6d bytes", *dl);
-  sox_debug("Compressed size: %6d bytes", l);
+  lsx_debug("  Original size: %6d bytes", *dl);
+  lsx_debug("Compressed size: %6d bytes", l);
   datafork = lsx_malloc((size_t)l);
   ddf = datafork + 22;
   for(i = 0; i < dictsize; i++) {
--- a/src/ladspa.c
+++ b/src/ladspa.c
@@ -172,12 +172,12 @@
           return SOX_EOF;
         }
         l_st->control[i] = ladspa_default(&(l_st->desc->PortRangeHints[i]));
-        sox_debug("default argument for port %lu is %f", i, l_st->control[i]);
+        lsx_debug("default argument for port %lu is %f", i, l_st->control[i]);
       } else {
         if (!sscanf(argv[0], "%lf", &arg))
           return lsx_usage(effp);
         l_st->control[i] = (LADSPA_Data)arg;
-        sox_debug("argument for port %lu is %f", i, l_st->control[i]);
+        lsx_debug("argument for port %lu is %f", i, l_st->control[i]);
         n--; argv++;
       }
     }
@@ -196,7 +196,7 @@
   unsigned long i;
 
   /* Instantiate the plugin */
-  sox_debug("rate for plugin is %g", effp->in_signal.rate);
+  lsx_debug("rate for plugin is %g", effp->in_signal.rate);
   l_st->handle = l_st->desc->instantiate(l_st->desc, (unsigned long)effp->in_signal.rate);
   if (l_st->handle == NULL) {
     sox_fail("could not instantiate plugin");
--- a/src/libsox.c
+++ b/src/libsox.c
@@ -62,9 +62,9 @@
 #undef sox_fail
 #undef sox_warn
 #undef sox_report
-#undef sox_debug
-#undef sox_debug_more
-#undef sox_debug_most
+#undef lsx_debug
+#undef lsx_debug_more
+#undef lsx_debug_most
 
 #define SOX_MESSAGE_FUNCTION(name,level) \
 void name(char const * fmt, ...) { \
@@ -78,9 +78,9 @@
 SOX_MESSAGE_FUNCTION(sox_fail  , 1)
 SOX_MESSAGE_FUNCTION(sox_warn  , 2)
 SOX_MESSAGE_FUNCTION(sox_report, 3)
-SOX_MESSAGE_FUNCTION(sox_debug , 4)
-SOX_MESSAGE_FUNCTION(sox_debug_more , 5)
-SOX_MESSAGE_FUNCTION(sox_debug_most , 6)
+SOX_MESSAGE_FUNCTION(lsx_debug , 4)
+SOX_MESSAGE_FUNCTION(lsx_debug_more , 5)
+SOX_MESSAGE_FUNCTION(lsx_debug_most , 6)
 
 #undef SOX_MESSAGE_FUNCTION
 
--- a/src/maud.c
+++ b/src/maud.c
@@ -72,7 +72,7 @@
 
                 /*
                 buf[4] = 0;
-                sox_debug("chunk %s",buf);
+                lsx_debug("chunk %s",buf);
                 */
 
                 if (strncmp(buf,"MHDR",(size_t)4) == 0) {
@@ -168,7 +168,7 @@
                                 return(SOX_EOF);
                         }
                         chunk_buf[chunksize] = '\0';
-                        sox_debug("%s",chunk_buf);
+                        lsx_debug("%s",chunk_buf);
                         free(chunk_buf);
 
                         continue;
--- a/src/mp3-duration.h
+++ b/src/mp3-duration.h
@@ -68,7 +68,7 @@
       if ((utf8 = utf8_id3tag_findframe(tag, "TLEN", 0))) {
         if (atoi((char *)utf8) > 0) {
           ft->signal.length = atoi((char *)utf8); /* In ms; convert to samples later */
-          sox_debug("got exact duration from ID3 TLEN");
+          lsx_debug("got exact duration from ID3 TLEN");
         }
         free(utf8);
       }
@@ -115,7 +115,7 @@
     memcpy(buffer, mad_stream.this_frame, leftover);
     read = fread(buffer + leftover, (size_t) 1, INPUT_BUFFER_SIZE - leftover, fp);
     if (read <= 0) {
-      sox_debug("got exact duration by scan to EOF (frames=%lu leftover=%lu)", (unsigned long)frames, (unsigned long)leftover);
+      lsx_debug("got exact duration by scan to EOF (frames=%lu leftover=%lu)", (unsigned long)frames, (unsigned long)leftover);
       break;
     }
     for (; !depadded && padding < read && !buffer[padding]; ++padding);
@@ -162,7 +162,7 @@
           }
         if ((frames = xing_frames(mad_stream.anc_ptr, mad_stream.anc_bitlen))) {
           mad_timer_multiply(&time, (signed long)frames);
-          sox_debug("got exact duration from XING frame count (%lu)", (unsigned long)frames);
+          lsx_debug("got exact duration from XING frame count (%lu)", (unsigned long)frames);
           break;
         }
       }
@@ -173,7 +173,7 @@
         struct stat filestat;
         fstat(fileno(fp), &filestat);
         mad_timer_mult(&time, (double)(filestat.st_size - tagsize) / consumed);
-        sox_debug("got approx. duration by CBR extrapolation");
+        lsx_debug("got approx. duration by CBR extrapolation");
         break;
       }
     }
--- a/src/polyphas.c
+++ b/src/polyphas.c
@@ -130,7 +130,7 @@
 
   p = primes;
   q = q0;
-  sox_debug("factors(%d) =",n);
+  lsx_debug("factors(%d) =",n);
   while (n > 1) {
     while ((pr = *p) && (n % pr)) p++;
     if (!pr) {
@@ -141,8 +141,8 @@
     n /= pr;
   }
   *q = 0;
-  for (pr=0; pr<q-q0; pr++) sox_debug(" %d",q0[pr]);
-  sox_debug(" ");
+  for (pr=0; pr<q-q0; pr++) lsx_debug(" %d",q0[pr]);
+  lsx_debug(" ");
   return (q-q0);
 }
 
@@ -180,8 +180,8 @@
   }
   if (n) *p++=n;
   *p = 0;
-  /*for (k=0; k<p-m; k++) sox_debug(" %d",m[k]);*/
-  /*sox_debug("");*/
+  /*for (k=0; k<p-m; k++) lsx_debug(" %d",m[k]);*/
+  /*lsx_debug("");*/
   return (p-m);
 }
 
@@ -212,9 +212,9 @@
       cost = 0;
       f = denom;
       u = min(ct1,ct2) + 1;
-      /*sox_debug("pfacts(%d): ", numer);*/
+      /*lsx_debug("pfacts(%d): ", numer);*/
       u1 = permute(rate->m1,l1,ct1,u,amalg);
-      /*sox_debug("pfacts(%d): ", denom);*/
+      /*lsx_debug("pfacts(%d): ", denom);*/
       u2 = permute(rate->m2,l2,ct2,u,amalg);
       u = max(u1,u2);
       for (j=0; j<u; j++) {
@@ -228,10 +228,10 @@
         c_min = cost;
         u_min = u;
         if (sox_globals.verbosity >= 4) {
-          sox_debug("c_min %d, [%d-%d]:",c_min,numer,denom);
+          lsx_debug("c_min %d, [%d-%d]:",c_min,numer,denom);
           for (j=0; j<u; j++)
-            sox_debug(" (%d,%d)",rate->m1[j],rate->m2[j]);
-          sox_debug(" ");
+            lsx_debug(" (%d,%d)",rate->m1[j],rate->m2[j]);
+          lsx_debug(" ");
         }
         memcpy(rate->b1,rate->m1,u*sizeof(int));
         memcpy(rate->b2,rate->m2,u*sizeof(int));
@@ -318,12 +318,12 @@
     else
       hamming(buffer,length);  /* Design Hamming window:  43 dB cutoff */
 
-    /* sox_debug("# fir_design length=%d, cutoff=%8.4f",length,cutoff); */
+    /* lsx_debug("# fir_design length=%d, cutoff=%8.4f",length,cutoff); */
     /* Design filter:  windowed sinc function */
     sum = 0.0;
     for(j=0;j<length;j++) {
       buffer[j] *= sinc(M_PI*cutoff*(j-length/2)); /* center at length/2 */
-      /* sox_debug("%.1f %.6f",(float)j,buffer[j]); */
+      /* lsx_debug("%.1f %.6f",(float)j,buffer[j]); */
       sum += buffer[j];
     }
     sum = (double)1.0/sum;
@@ -331,7 +331,7 @@
     for(j=0;j<length;j++) {
       buffer[j] *= sum;
     }
-    /* sox_debug("# end"); */
+    /* lsx_debug("# end"); */
 }
 
 #define RIBLEN 2048
@@ -372,9 +372,9 @@
     rate->total = total;
     /* l1 and l2 are now lists of the up/down factors for conversion */
 
-    sox_debug("Poly:  input rate %g, output rate %g.  %d stages.",
+    lsx_debug("Poly:  input rate %g, output rate %g.  %d stages.",
             effp->in_signal.rate, effp->out_signal.rate,total);
-    sox_debug("Poly:  window: %s  size: %d  cutoff: %f.",
+    lsx_debug("Poly:  window: %s  size: %d  cutoff: %f.",
             (rate->win_type == 0) ? ("nut") : ("ham"), rate->win_width, rate->cutoff);
 
     /* Create an array of filters and past history */
@@ -394,7 +394,7 @@
       s->size = size;
       s->hsize = f_len/s->up; /* this much of window is past-history */
       s->held = 0;
-      sox_debug("Poly:  stage %d:  Up by %d, down by %d,  i_samps %d, hsize %d",
+      lsx_debug("Poly:  stage %d:  Up by %d, down by %d,  i_samps %d, hsize %d",
               k+1,s->up,s->down,size, s->hsize);
       s->filt_len = f_len;
       s->filt_array = lsx_malloc(sizeof(Float) * f_len);
@@ -404,7 +404,7 @@
         s->window[j] = 0.0;
 
       uprate *= s->up;
-      sox_debug("Poly:         :  filt_len %d, cutoff freq %.1f",
+      lsx_debug("Poly:         :  filt_len %d, cutoff freq %.1f",
               f_len, uprate * rate->cutoff / f_cutoff);
       uprate /= s->down;
       fir_design(rate, s->filt_array, f_len, rate->cutoff / f_cutoff);
@@ -427,7 +427,7 @@
       s->filt_array = NULL;
       s->window = lsx_malloc(sizeof(Float) * size);
     }
-    sox_debug("Poly:  output samples %d, oskip %lu",size, (unsigned long)rate->oskip);
+    lsx_debug("Poly:  output samples %d, oskip %lu",size, (unsigned long)rate->oskip);
     return (SOX_SUCCESS);
 }
 
@@ -461,10 +461,10 @@
   Float *o_top;
 
   in = s->window + s->hsize;
-  /*for (mm=0; mm<s->filt_len; mm++) sox_debug("cf_%d %f",mm,s->filt_array[mm]);*/
+  /*for (mm=0; mm<s->filt_len; mm++) lsx_debug("cf_%d %f",mm,s->filt_array[mm]);*/
   /* assumes s->size divisible by down (now true) */
   o_top = output + (s->size * up) / down;
-  /*sox_debug(" isize %d, osize %d, up %d, down %d, N %d", s->size, o_top-output, up, down, f_len);*/
+  /*lsx_debug(" isize %d, osize %d, up %d, down %d, N %d", s->size, o_top-output, up, down, f_len);*/
   for (mm=0, o=output; o < o_top; mm+=down, o++) {
     double sum;
     const Float *p, *q;
@@ -493,7 +493,7 @@
   polystage *s0,*s1;
 
   /* Sanity check:  how much can we tolerate? */
-  /* sox_debug("*isamp=%d *osamp=%d",*isamp,*osamp); */
+  /* lsx_debug("*isamp=%d *osamp=%d",*isamp,*osamp); */
   s0 = rate->stage[0];            /* the first stage */
   s1 = rate->stage[rate->total];  /* the 'last' stage is output buffer */
   {
@@ -532,7 +532,7 @@
 
       out = rate->stage[k+1]->window + rate->stage[k+1]->hsize;
 
-      /* sox_debug("k=%d  insize=%d",k,in_size); */
+      /* lsx_debug("k=%d  insize=%d",k,in_size); */
       polyphase(out, s);
 
       /* copy input history into lower portion of rate->window[k] */
--- a/src/prc.c
+++ b/src/prc.c
@@ -131,7 +131,7 @@
 
   /* Check the header */
   if (prc_checkheader(ft, head))
-    sox_debug("Found Psion Record header");
+    lsx_debug("Found Psion Record header");
   else {
       lsx_fail_errno(ft,SOX_EHDR,"Not a Psion Record file");
       return (SOX_EOF);
@@ -153,10 +153,10 @@
 
   lsx_readdw(ft, &len);
   p->nsamp = len;
-  sox_debug("Number of samples: %d", len);
+  lsx_debug("Number of samples: %d", len);
 
   lsx_readdw(ft, &encoding);
-  sox_debug("Encoding of samples: %x", encoding);
+  lsx_debug("Encoding of samples: %x", encoding);
   if (encoding == 0)
     ft->encoding.encoding = SOX_ENCODING_ALAW;
   else if (encoding == 0x100001a1)
@@ -167,10 +167,10 @@
   }
 
   lsx_readw(ft, &reps);    /* Number of repeats */
-  sox_debug("Repeats: %d", reps);
+  lsx_debug("Repeats: %d", reps);
 
   lsx_readb(ft, &volume);
-  sox_debug("Volume: %d", (unsigned)volume);
+  lsx_debug("Volume: %d", (unsigned)volume);
   if (volume < 1 || volume > 5)
     sox_warn("Volume %d outside range 1..5", volume);
 
@@ -177,10 +177,10 @@
   lsx_readb(ft, &byte);   /* Unused and seems always zero */
 
   lsx_readdw(ft, &repgap); /* Time between repeats in usec */
-  sox_debug("Time between repeats (usec): %u", repgap);
+  lsx_debug("Time between repeats (usec): %u", repgap);
 
   lsx_readdw(ft, &listlen); /* Length of samples list */
-  sox_debug("Number of bytes in samples list: %u", listlen);
+  lsx_debug("Number of bytes in samples list: %u", listlen);
 
   if (ft->signal.rate != 0 && ft->signal.rate != 8000)
     sox_report("PRC only supports 8 kHz; overriding.");
@@ -216,7 +216,7 @@
 
   if (lsx_readb(ft, &byte) == SOX_EOF)
     return (unsigned)SOX_EOF;
-  sox_debug_more("Cardinal byte 1: %x", byte);
+  lsx_debug_more("Cardinal byte 1: %x", byte);
   a = byte;
   if (!(a & 1))
     a >>= 1;
@@ -223,7 +223,7 @@
   else {
     if (lsx_readb(ft, &byte) == SOX_EOF)
       return (unsigned)SOX_EOF;
-    sox_debug_more("Cardinal byte 2: %x", byte);
+    lsx_debug_more("Cardinal byte 2: %x", byte);
     a |= byte << 8;
     if (!(a & 2))
       a >>= 2;
@@ -230,11 +230,11 @@
     else if (!(a & 4)) {
       if (lsx_readb(ft, &byte) == SOX_EOF)
         return (unsigned)SOX_EOF;
-      sox_debug_more("Cardinal byte 3: %x", byte);
+      lsx_debug_more("Cardinal byte 3: %x", byte);
       a |= byte << 16;
       if (lsx_readb(ft, &byte) == SOX_EOF)
         return (unsigned)SOX_EOF;
-      sox_debug_more("Cardinal byte 4: %x", byte);
+      lsx_debug_more("Cardinal byte 4: %x", byte);
       a |= byte << 24;
       a >>= 3;
     }
@@ -247,7 +247,7 @@
 {
   priv_t * p = (priv_t *)ft->priv;
 
-  sox_debug_more("length now = %d", p->nsamp);
+  lsx_debug_more("length now = %d", p->nsamp);
 
   if (ft->encoding.encoding == SOX_ENCODING_IMA_ADPCM) {
     size_t nsamp, read;
@@ -259,14 +259,14 @@
       if (framelen == (unsigned)SOX_EOF)
         return 0;
 
-      sox_debug_more("frame length %d", framelen);
+      lsx_debug_more("frame length %d", framelen);
       p->frame_samp = framelen;
 
       /* Discard length of compressed data */
-      sox_debug_more("compressed length %d", read_cardinal(ft));
+      lsx_debug_more("compressed length %d", read_cardinal(ft));
       /* Discard length of BListL */
       lsx_readdw(ft, &trash);
-      sox_debug_more("list length %d", trash);
+      lsx_debug_more("list length %d", trash);
 
       /* Reset CODEC for start of frame */
       lsx_adpcm_reset(&p->adpcm, ft->encoding.encoding);
@@ -275,7 +275,7 @@
     p->nsamp += nsamp;
     read = lsx_adpcm_read(ft, &p->adpcm, buf, nsamp);
     p->frame_samp -= read;
-    sox_debug_more("samples left in this frame: %d", p->frame_samp);
+    lsx_debug_more("samples left in this frame: %d", p->frame_samp);
     return read;
   } else {
     p->nsamp += samp;
@@ -332,27 +332,27 @@
 
   if (a < 0x80) {
     byte = a << 1;
-    sox_debug_more("Cardinal byte 1: %x", byte);
+    lsx_debug_more("Cardinal byte 1: %x", byte);
     lsx_writeb(ft, byte);
   } else if (a < 0x8000) {
     byte = (a << 2) | 1;
-    sox_debug_more("Cardinal byte 1: %x", byte);
+    lsx_debug_more("Cardinal byte 1: %x", byte);
     lsx_writeb(ft, byte);
     byte = a >> 6;
-    sox_debug_more("Cardinal byte 2: %x", byte);
+    lsx_debug_more("Cardinal byte 2: %x", byte);
     lsx_writeb(ft, byte);
   } else {
     byte = (a << 3) | 3;
-    sox_debug_more("Cardinal byte 1: %x", byte);
+    lsx_debug_more("Cardinal byte 1: %x", byte);
     lsx_writeb(ft, byte);
     byte = a >> 5;
-    sox_debug_more("Cardinal byte 2: %x", byte);
+    lsx_debug_more("Cardinal byte 2: %x", byte);
     lsx_writeb(ft, byte);
     byte = a >> 13;
-    sox_debug_more("Cardinal byte 3: %x", byte);
+    lsx_debug_more("Cardinal byte 3: %x", byte);
     lsx_writeb(ft, byte);
     byte = a >> 21;
-    sox_debug_more("Cardinal byte 4: %x", byte);
+    lsx_debug_more("Cardinal byte 4: %x", byte);
     lsx_writeb(ft, byte);
   }
 }
@@ -362,7 +362,7 @@
   priv_t * p = (priv_t *)ft->priv;
   /* Psion Record seems not to be able to handle frames > 800 samples */
   size_t written = 0;
-  sox_debug_more("length now = %d", p->nsamp);
+  lsx_debug_more("length now = %d", p->nsamp);
   if (ft->encoding.encoding == SOX_ENCODING_IMA_ADPCM) {
     while (written < nsamp) {
       size_t written1, samp = min(nsamp - written, 800);
@@ -371,7 +371,7 @@
       /* Write compressed length */
       write_cardinal(ft, (unsigned) ((samp / 2) + (samp % 2) + 4));
       /* Write length again (seems to be a BListL) */
-      sox_debug_more("list length %lu", (unsigned long)samp);
+      lsx_debug_more("list length %lu", (unsigned long)samp);
       lsx_writedw(ft, (unsigned) samp);
       lsx_adpcm_reset(&p->adpcm, ft->encoding.encoding);
       written1 = lsx_adpcm_write(ft, &p->adpcm, buf + written, samp);
@@ -412,7 +412,7 @@
   lsx_writebuf(ft, prc_header, sizeof(prc_header));
   lsx_writes(ft, "\x2arecord.app");
 
-  sox_debug("Number of samples: %d",p->nsamp);
+  lsx_debug("Number of samples: %d",p->nsamp);
   lsx_writedw(ft, p->nsamp);
 
   if (ft->encoding.encoding == SOX_ENCODING_ALAW)
@@ -425,7 +425,7 @@
   lsx_writeb(ft, 0);             /* Unused and seems always zero */
   lsx_writedw(ft, 0);            /* Time between repeats in usec */
 
-  sox_debug("Number of bytes: %d", p->nbytes);
+  lsx_debug("Number of bytes: %d", p->nbytes);
   lsx_writedw(ft, p->nbytes);    /* Number of bytes of data */
 }
 
--- a/src/rate.c
+++ b/src/rate.c
@@ -338,7 +338,7 @@
   assert(num_taps & 1);
   f->num_taps = num_taps;
   f->dft_length = dft_length;
-  sox_debug("fir_len=%i dft_length=%i Fp=%g atten=%g mult=%i",
+  lsx_debug("fir_len=%i dft_length=%i Fp=%g atten=%g mult=%i",
       num_taps, dft_length, Fp, atten, multiplier);
   lsx_safe_rdft(dft_length, 1, f->coefs);
 }
@@ -394,7 +394,7 @@
     assert(!last_stage.step.parts.fraction);
   else if (quality != Quick)
     assert(!last_stage.step.parts.integer);
-  sox_debug("i/o=%g; %.9g:%i @ level %i", p->factor, factor, divisor, p->level);
+  lsx_debug("i/o=%g; %.9g:%i @ level %i", p->factor, factor, divisor, p->level);
 
   mult = 1 + p->upsample; /* Compensate for zero-stuffing in double_sample */
   p->input_stage_num = -p->upsample;
@@ -425,7 +425,7 @@
       assert(num_taps == f->num_coefs * phases - 1);
       last_stage.shared->poly_fir_coefs =
           prepare_coefs(coefs, f->num_coefs, phases, interp_order, mult);
-      sox_debug("fir_len=%i phases=%i coef_interp=%i mult=%i size=%s",
+      lsx_debug("fir_len=%i phases=%i coef_interp=%i mult=%i size=%s",
           f->num_coefs, phases, interp_order, mult,
           sox_sigfigs3((num_taps + 1) * (interp_order + 1) * sizeof(sample_t)));
       free(coefs);
@@ -487,7 +487,7 @@
     fifo_create(&s->fifo, (int)sizeof(sample_t));
     memset(fifo_reserve(&s->fifo, s->preload), 0, sizeof(sample_t)*s->preload);
     if (i < p->output_stage_num)
-      sox_debug("stage=%-3ipre_post=%-3ipre=%-3ipreload=%i",
+      lsx_debug("stage=%-3ipre_post=%-3ipre=%-3ipreload=%i",
           i, s->pre_post, s->pre, s->preload);
   }
 }
--- a/src/resample.c
+++ b/src/resample.c
@@ -171,9 +171,9 @@
           return lsx_usage(effp);
         } else if (r->beta <= 2.0) {
         	r->beta = 0;
-                sox_debug("opts: Nuttall window, cutoff %f", r->rolloff);
+                lsx_debug("opts: Nuttall window, cutoff %f", r->rolloff);
         } else
-                sox_debug("opts: Kaiser window, cutoff %f, beta %f", r->rolloff, r->beta);
+                lsx_debug("opts: Kaiser window, cutoff %f, beta %f", r->rolloff, r->beta);
         return (SOX_SUCCESS);
 }
 
@@ -216,11 +216,11 @@
     return (SOX_EOF);
   }
 
-  sox_debug("Nmult: %ld, Nwing: %ld, Nq: %ld", r->Nmult, r->Nwing, r->Nq);
+  lsx_debug("Nmult: %ld, Nwing: %ld, Nq: %ld", r->Nmult, r->Nwing, r->Nq);
 
   if (r->quadr < 0) {     /* exact coeff's method */
     r->Xh = r->Nwing / r->b;
-    sox_debug("rate ratio %ld:%ld, coeff interpolation not needed", r->a, r->b);
+    lsx_debug("rate ratio %ld:%ld, coeff interpolation not needed", r->a, r->b);
   } else {
     r->dhb = Np;        /* Fixed-point Filter sampling-time-increment */
     if (r->Factor < 1.0)
@@ -250,7 +250,7 @@
 
   r->Xsize = 2 * Xoff + i / (1.0 + r->Factor);
   r->Ysize = BUFFSIZE - r->Xsize;
-  sox_debug("Xsize %li, Ysize %li, Xoff %li", r->Xsize, r->Ysize, r->Xoff);
+  lsx_debug("Xsize %li, Ysize %li, Xoff %li", r->Xsize, r->Ysize, r->Xoff);
 
   r->X = lsx_malloc(sizeof(double) * (BUFFSIZE));
   r->Y = r->X + r->Xsize;
@@ -271,7 +271,7 @@
         priv_t * r = (priv_t *) effp->priv;
         long i, last, Nout, Nx, Nproc;
 
-        sox_debug_more("Xp %li, Xread %li, isamp %lu, ",r->Xp, r->Xread,(unsigned long)*isamp);
+        lsx_debug_more("Xp %li, Xread %li, isamp %lu, ",r->Xp, r->Xread,(unsigned long)*isamp);
 
         /* constrain amount we actually process */
         Nproc = r->Xsize - r->Xp;
@@ -288,7 +288,7 @@
         }
         if ((unsigned long)Nx > *isamp)
                 Nx = *isamp;
-        sox_debug_more("Nx %li",Nx);
+        lsx_debug_more("Nx %li",Nx);
 
         if (ibuf == NULL) {
                 for(i = r->Xread; i < Nx + r->Xread  ; i++)
@@ -310,7 +310,7 @@
         if (r->quadr < 0) { /* exact coeff's method */
                 long creep;
                 Nout = SrcEX(r, Nproc);
-                sox_debug_more("Nproc %li --> %li",Nproc,Nout);
+                lsx_debug_more("Nproc %li --> %li",Nproc,Nout);
                 /* Move converter Nproc samples back in time */
                 r->t -= Nproc * r->b;
                 /* Advance by number of samples processed */
@@ -321,12 +321,12 @@
                 {
                   r->t -= creep * r->b;  /* Remove time accumulation   */
                   r->Xp += creep;        /* and add it to read pointer */
-                  sox_debug_more("Nproc %ld, creep %ld",Nproc,creep);
+                  lsx_debug_more("Nproc %ld, creep %ld",Nproc,creep);
                 }
         } else { /* approx coeff's method */
                 long creep;
                 Nout = SrcUD(r, Nproc);
-                sox_debug_more("Nproc %li --> %li",Nproc,Nout);
+                lsx_debug_more("Nproc %li --> %li",Nproc,Nout);
                 /* Move converter Nproc samples back in time */
                 r->Time -= Nproc;
                 /* Advance by number of samples processed */
@@ -337,7 +337,7 @@
                 {
                   r->Time -= creep;   /* Remove time accumulation   */
                   r->Xp += creep;     /* and add it to read pointer */
-                  sox_debug_more("Nproc %ld, creep %ld",Nproc,creep);
+                  lsx_debug_more("Nproc %ld, creep %ld",Nproc,creep);
                 }
         }
 
@@ -345,7 +345,7 @@
         long i,k;
         /* Copy back portion of input signal that must be re-used */
         k = r->Xp - r->Xoff;
-        sox_debug_more("k %li, last %li",k,last);
+        lsx_debug_more("k %li, last %li",k,last);
         for (i=0; i<last - k; i++)
             r->X[i] = r->X[i+k];
 
@@ -377,7 +377,7 @@
         sox_sample_t *Obuf;
         int rc;
 
-        sox_debug("Xoff %li  <--- DRAIN",r->Xoff);
+        lsx_debug("Xoff %li  <--- DRAIN",r->Xoff);
 
         /* stuff end with Xoff zeros */
         isamp_res = r->Xoff;
@@ -390,7 +390,7 @@
                 rc = flow(effp, NULL, Obuf, &Isamp, &Osamp);
                 if (rc)
                     return rc;
-                sox_debug("DRAIN isamp,osamp  (%li,%li) -> (%lu,%lu)",
+                lsx_debug("DRAIN isamp,osamp  (%li,%li) -> (%lu,%lu)",
                          isamp_res,osamp_res,(unsigned long)Isamp,(unsigned long)Osamp);
                 Obuf += Osamp;
                 osamp_res -= Osamp;
@@ -397,7 +397,7 @@
                 isamp_res -= Isamp;
         }
         *osamp -= osamp_res;
-        sox_debug("DRAIN osamp %lu", (unsigned long)*osamp);
+        lsx_debug("DRAIN osamp %lu", (unsigned long)*osamp);
         if (isamp_res)
                 sox_warn("drain overran obuf by %li", isamp_res);
         /* FIXME: This is very picky.  IF obuf is not big enough to
@@ -495,11 +495,11 @@
    Factor = r->Factor;
    time = r->Time;
    dt = 1.0/Factor;        /* Output sampling period */
-   sox_debug_more("Factor %f, dt %f, ",Factor,dt);
-   sox_debug_more("Time %f, ",r->Time);
+   lsx_debug_more("Factor %f, dt %f, ",Factor,dt);
+   lsx_debug_more("Time %f, ",r->Time);
    /* (Xh * dhb)>>La is max index into Imp[] */
-   sox_debug_more("ct=%.2f %li",(double)r->Nwing*Na/r->dhb, r->Xh);
-   sox_debug_more("ct=%ld, T=%.6f, dhb=%6f, dt=%.6f",
+   lsx_debug_more("ct=%.2f %li",(double)r->Nwing*Na/r->dhb, r->Xh);
+   lsx_debug_more("ct=%ld, T=%.6f, dhb=%6f, dt=%.6f",
                          r->Xh, time-floor(time),(double)r->dhb/Na,dt);
    Ystart = Y = r->Y;
    n = (int)ceil((double)Nx/dt);
@@ -521,7 +521,7 @@
       time += dt;            /* Move to next sample by time increment */
       }
    r->Time = time;
-   sox_debug_more("Time %f",r->Time);
+   lsx_debug_more("Time %f",r->Time);
    return (Y - Ystart);        /* Return the number of output samples */
 }
 
--- a/src/sf.c
+++ b/src/sf.c
@@ -117,7 +117,7 @@
 
 static int write_header(sox_format_t * ft)
 {
-  char * comment  = sox_cat_comments(ft->oob.comments);
+  char * comment  = lsx_cat_comments(ft->oob.comments);
   size_t len      = min(FIXED_HDR - 26, strlen(comment)) + 1; /* null-terminated */
   size_t info_len = max(4, (len + 3) & ~3u); /* Minimum & multiple of 4 bytes */
   int i = ft->encoding.reverse_bytes == MACHINE_IS_BIGENDIAN? 0 : 2;
--- a/src/smp.c
+++ b/src/smp.c
@@ -334,7 +334,7 @@
 {
         priv_t * smp = (priv_t *) ft->priv;
         struct smpheader header;
-        char * comment = sox_cat_comments(ft->oob.comments);
+        char * comment = lsx_cat_comments(ft->oob.comments);
 
         /* If you have to seek around the output file */
         if (! ft->seekable)
--- a/src/sndfile.c
+++ b/src/sndfile.c
@@ -59,7 +59,7 @@
       sox_warn("`%s': %.*s",
           ft->filename, (int)(end - sf->log_buffer_ptr), sf->log_buffer_ptr);
     } else
-      sox_debug("`%s': %.*s",
+      lsx_debug("`%s': %.*s",
           ft->filename, (int)(end - sf->log_buffer_ptr), sf->log_buffer_ptr);
     sf->log_buffer_ptr = end;
     if (*sf->log_buffer_ptr == '\n')
--- a/src/soundtool.c
+++ b/src/soundtool.c
@@ -44,7 +44,7 @@
 
 static int write_header(sox_format_t * ft)
 {
-  char * comment = sox_cat_comments(ft->oob.comments);
+  char * comment = lsx_cat_comments(ft->oob.comments);
   char text_buf[text_field_len];
   size_t length = ft->olength? ft->olength:ft->signal.length;
 
--- a/src/sox.c
+++ b/src/sox.c
@@ -1056,7 +1056,7 @@
          * reset the start location of trim so that it thinks user didn't
          * request a skip.  */
         sox_trim_clear_start(&effects_chain->effects[1][0]);
-        sox_debug("optimize_trim successful");
+        lsx_debug("optimize_trim successful");
       }
     }
   }
@@ -2336,7 +2336,7 @@
   }
 
   if (sox_globals.repeatable)
-    sox_debug("Not reseeding PRNG; randomness is repeatable");
+    lsx_debug("Not reseeding PRNG; randomness is repeatable");
   else {
     time_t t;
 
--- a/src/sox.h
+++ b/src/sox.h
@@ -340,7 +340,6 @@
 void sox_append_comments(sox_comments_t * comments, char const * comment);
 sox_comments_t sox_copy_comments(sox_comments_t comments);
 void sox_delete_comments(sox_comments_t * comments);
-char * sox_cat_comments(sox_comments_t comments);
 char const * sox_find_comment(sox_comments_t comments, char const * id);
 
 #define SOX_MAX_NLOOPS           8
@@ -392,6 +391,16 @@
 #define SOX_FILE_BIG_END (SOX_FILE_ENDIAN | SOX_FILE_ENDBIG)
 
 int sox_format_init(void);
+
+typedef const sox_format_handler_t *(*sox_format_fn_t)(void);
+
+typedef struct {
+  char *name;
+  sox_format_fn_t fn;
+} sox_format_tab_t;
+
+extern sox_format_tab_t sox_format_fns[];
+
 sox_format_t * sox_open_read(
     char               const * path,
     sox_signalinfo_t   const * signal,
@@ -416,7 +425,6 @@
 int sox_seek(sox_format_t * ft, uint64_t offset, int whence);
 
 sox_format_handler_t const * sox_find_format(char const * name, sox_bool no_dev);
-int sox_gettype(sox_format_t *, sox_bool);
 void sox_format_quit(void);
 
 /*
@@ -523,31 +531,22 @@
 sox_bool sox_is_playlist(char const * filename);
 int sox_parse_playlist(sox_playlist_callback_t callback, void * p, char const * const listname);
 
+void sox_output_message(FILE *file, const char *filename, const char *fmt, va_list ap);
+
+/* WARNING BEGIN
+ *
+ * The items in this section are subject to instability.  They only exist
+ * in public API because sox (the application) make use of them but
+ * may not be supported and may change rapidly.
+ */
 void sox_fail(const char *, ...) PRINTF;
 void sox_warn(const char *, ...) PRINTF;
 void sox_report(const char *, ...) PRINTF;
-void sox_debug(const char *, ...) PRINTF;
-void sox_debug_more(char const * fmt, ...) PRINTF;
-void sox_debug_most(char const * fmt, ...) PRINTF;
 
 #define sox_fail       sox_globals.subsystem=__FILE__,sox_fail
 #define sox_warn       sox_globals.subsystem=__FILE__,sox_warn
 #define sox_report     sox_globals.subsystem=__FILE__,sox_report
-#define sox_debug      sox_globals.subsystem=__FILE__,sox_debug
-#define sox_debug_more sox_globals.subsystem=__FILE__,sox_debug_more
-#define sox_debug_most sox_globals.subsystem=__FILE__,sox_debug_most
 
-void sox_output_message(FILE *file, const char *filename, const char *fmt, va_list ap);
-
-typedef const sox_format_handler_t *(*sox_format_fn_t)(void);
-
-typedef struct {
-  char *name;
-  sox_format_fn_t fn;
-} sox_format_tab_t;
-
-extern sox_format_tab_t sox_format_fns[];
-
 typedef struct {char const *text; unsigned value;} sox_enum_item;
 #define ENUM_ITEM(prefix, item) {#item, prefix##item},
 
@@ -557,4 +556,5 @@
 char const * sox_sigfigs3(size_t number);
 char const * sox_sigfigs3p(double percentage);
 
+/* WARNING END */
 #endif
--- a/src/sox_i.h
+++ b/src/sox_i.h
@@ -47,6 +47,14 @@
 #define FMT_size_t "lu"
 #endif
 
+void lsx_debug(const char *, ...) PRINTF;
+void lsx_debug_more(char const * fmt, ...) PRINTF;
+void lsx_debug_most(char const * fmt, ...) PRINTF;
+
+#define lsx_debug      sox_globals.subsystem=__FILE__,lsx_debug
+#define lsx_debug_more sox_globals.subsystem=__FILE__,lsx_debug_more
+#define lsx_debug_most sox_globals.subsystem=__FILE__,lsx_debug_most
+
 /* Digitise one cycle of a wave and store it as
  * a table of samples of a specified data-type.
  */
@@ -202,7 +210,7 @@
 
 extern sox_format_handler_t const * sox_sndfile_format_fn(void);
 
-
+char * lsx_cat_comments(sox_comments_t comments);
 
 /*--------------------------------- Effects ----------------------------------*/
 
--- a/src/spectrogram.c
+++ b/src/spectrogram.c
@@ -158,7 +158,7 @@
   p->end = p->dft_size = DFT_BASE_SIZE << p->y_size;
   p->rows = (p->dft_size >> 1) + 1;
   actual = make_window(p, p->last_end = 0);
-  sox_debug("window_density=%g", actual / p->dft_size);
+  lsx_debug("window_density=%g", actual / p->dft_size);
   p->step_size = (p->slack_overlap? sqrt(actual * p->dft_size) : actual) + .5;
   p->block_steps = effp->in_signal.rate / p->pixels_per_sec;
   p->step_size = p->block_steps / ceil((double)p->block_steps / p->step_size) +.5;
@@ -167,7 +167,7 @@
   actual = effp->in_signal.rate / p->step_size / p->block_steps;
   if (actual != p->pixels_per_sec)
     sox_report("actual pixels/s = %g", actual);
-  sox_debug("step_size=%i block_steps=%i", p->step_size, p->block_steps);
+  lsx_debug("step_size=%i block_steps=%i", p->step_size, p->block_steps);
   p->max = -p->dB_range;
   p->read = (p->step_size - p->dft_size) / 2;
   return SOX_SUCCESS;
@@ -244,13 +244,13 @@
 
     if (left_over >= p->step_size >> 1)
       isamp += p->step_size - left_over;
-    sox_debug("cols=%i left=%i end=%i", p->cols, p->read, p->end);
+    lsx_debug("cols=%i left=%i end=%i", p->cols, p->read, p->end);
     p->end = 0, p->end_min = -p->dft_size;
     if (flow(effp, ibuf, obuf, &isamp, &isamp) == SOX_SUCCESS && p->block_num) {
       p->block_norm *= (double)p->block_steps / p->block_num;
       do_column(effp);
     }
-    sox_debug("flushed cols=%i left=%i end=%i", p->cols, p->read, p->end);
+    lsx_debug("flushed cols=%i left=%i end=%i", p->cols, p->read, p->end);
     free(obuf);
     free(ibuf);
   }
@@ -419,7 +419,7 @@
     free(p->dBfs);
     return SOX_EOF;
   }
-  sox_debug("signal-max=%g", p->max);
+  lsx_debug("signal-max=%g", p->max);
   font = malloc(font_len);
   assert(uncompress(font, &font_len, fixed, sizeof(fixed)-1) == Z_OK);
   make_palette(p, palette);
--- a/src/stretch.c
+++ b/src/stretch.c
@@ -172,7 +172,7 @@
   } else if (p->overlap == 1)
     p->fade_coefs[0] = 1.0;
 
-  sox_debug("start: (factor=%g segment=%g shift=%g overlap=%g)\nstate=%d\n"
+  lsx_debug("start: (factor=%g segment=%g shift=%g overlap=%g)\nstate=%d\n"
       "segment=%lu\nindex=%lu\nishift=%lu\noindex=%lu\noshift=%lu\noverlap=%lu",
       p->factor, p->window, p->shift, p->fading, p->state,
       (unsigned long)p->segment, (unsigned long)p->index,
--- a/src/synth.c
+++ b/src/synth.c
@@ -387,7 +387,7 @@
           (log(chan->freq2) - log(chan->freq)) / synth->samples_to_do : 1;
         break;
     }
-    sox_debug("type=%s, combine=%s, samples_to_do=%lu, f1=%g, f2=%g, "
+    lsx_debug("type=%s, combine=%s, samples_to_do=%lu, f1=%g, f2=%g, "
               "offset=%g, phase=%g, p1=%g, p2=%g, p3=%g mult=%g",
         sox_find_enum_value(chan->type, synth_type)->text,
         sox_find_enum_value(chan->combine, combine_type)->text,
--- a/src/tx16w.c
+++ b/src/tx16w.c
@@ -114,7 +114,7 @@
      */
 
     /* Check to make sure we got a good filetype ID from file */
-    sox_debug("Found header filetype %s",filetype);
+    lsx_debug("Found header filetype %s",filetype);
     if(strcmp(filetype,"LM8953"))
     {
         lsx_fail_errno(ft,SOX_EHDR,"Invalid filetype ID in input file header, != LM8953");
@@ -157,11 +157,11 @@
                     break;
             }
             if ( blewIt ) {
-                sox_debug("Invalid sample rate identifier found %d", sample_rate);
+                lsx_debug("Invalid sample rate identifier found %d", sample_rate);
                 ft->signal.rate = 1e5 / 3;
             }
     }
-    sox_debug("Sample rate = %g", ft->signal.rate);
+    lsx_debug("Sample rate = %g", ft->signal.rate);
 
     ft->signal.channels = 1 ; /* not sure about stereo sample data yet ??? */
     ft->encoding.bits_per_sample = 12;
@@ -232,7 +232,7 @@
   priv_t * sk = (priv_t *) ft->priv;
     struct WaveHeader_ WH;
 
-    sox_debug("tx16w selected output");
+    lsx_debug("tx16w selected output");
 
     memset(&WH, 0, sizeof(struct WaveHeader_));
 
@@ -299,7 +299,7 @@
     /* If file header needs fixing up, for example it needs the */
     /* the number of samples in a field, seek back and write them here. */
 
-    sox_debug("tx16w:output finished");
+    lsx_debug("tx16w:output finished");
 
     memset(&WH, 0, sizeof(struct WaveHeader_));
     strncpy(WH.filetype,"LM8953",(size_t)6);
--- a/src/voc.c
+++ b/src/voc.c
@@ -676,7 +676,7 @@
         continue;       /* get next block */
       case VOC_LOOP:
       case VOC_LOOPEND:
-        sox_debug("skipping repeat loop");
+        lsx_debug("skipping repeat loop");
         lsx_skipbytes(ft, (size_t) sblen);
         break;
       case VOC_EXTENDED:
@@ -707,7 +707,7 @@
         /* can be grabed.                               */
         continue;
       default:
-        sox_debug("skipping unknown block code %d", block);
+        lsx_debug("skipping unknown block code %d", block);
         lsx_skipbytes(ft, (size_t) sblen);
     }
   }
--- a/src/vol.c
+++ b/src/vol.c
@@ -83,7 +83,7 @@
      * of the output amplitudes when using the limiter.) */
     vol->limiterthreshhold = SOX_SAMPLE_MAX * (1.0 - vol->limitergain) / (fabs(vol->gain) - vol->limitergain);
   }
-  sox_debug("mult=%g limit=%g", vol->gain, vol->limitergain);
+  lsx_debug("mult=%g limit=%g", vol->gain, vol->limitergain);
   return SOX_SUCCESS;
 }
 
--- a/src/wav.c
+++ b/src/wav.c
@@ -380,7 +380,7 @@
                           Label);
             return SOX_EOF;
         }
-        sox_debug("WAV Chunk %s", magic);
+        lsx_debug("WAV Chunk %s", magic);
         if (lsx_readdw(ft, len) == SOX_EOF)
         {
             lsx_fail_errno(ft, SOX_EHDR, "WAVE file %s chunk is too short",
@@ -450,7 +450,7 @@
     /* RIFX is a Big-endian RIFF */
     if (strncmp("RIFX", magic, (size_t)4) == 0)
     {
-        sox_debug("Found RIFX header");
+        lsx_debug("Found RIFX header");
         ft->encoding.reverse_bytes = MACHINE_IS_LITTLEENDIAN;
     }
     else ft->encoding.reverse_bytes = MACHINE_IS_BIGENDIAN;
@@ -688,7 +688,7 @@
                 lsx_readsw(ft, &(wav->lsx_ms_adpcm_i_coefs[i]));
                 len -= 2;
                 if (i<14) errct += (wav->lsx_ms_adpcm_i_coefs[i] != lsx_ms_adpcm_i_coef[i/2][i%2]);
-                /* sox_debug("lsx_ms_adpcm_i_coefs[%2d] %4d",i,wav->lsx_ms_adpcm_i_coefs[i]); */
+                /* lsx_debug("lsx_ms_adpcm_i_coefs[%2d] %4d",i,wav->lsx_ms_adpcm_i_coefs[i]); */
             }
             if (errct) sox_warn("base lsx_ms_adpcm_i_coefs differ in %d/14 positions",errct);
         }
@@ -797,7 +797,7 @@
     dwDataLength = len;
     if (dwDataLength == MS_UNSPEC) {
       wav->ignoreSize = 1;
-      sox_debug("WAV Chunk data's length is value often used in pipes or 4G files.  Ignoring length.");
+      lsx_debug("WAV Chunk data's length is value often used in pipes or 4G files.  Ignoring length.");
     }
 
 
@@ -811,7 +811,7 @@
         wav->numSamples =
             lsx_ms_adpcm_samples_in((size_t)dwDataLength, (size_t)ft->signal.channels,
                            (size_t)wav->blockAlign, (size_t)wav->samplesPerBlock);
-        sox_debug_more("datalen %d, numSamples %lu",dwDataLength, (unsigned long)wav->numSamples);
+        lsx_debug_more("datalen %d, numSamples %lu",dwDataLength, (unsigned long)wav->numSamples);
         wav->blockSamplesRemaining = 0;        /* Samples left in buffer */
         ft->signal.length = wav->numSamples*ft->signal.channels;
         break;
@@ -822,7 +822,7 @@
         wav->numSamples =
             lsx_ima_samples_in((size_t)dwDataLength, (size_t)ft->signal.channels,
                          (size_t)wav->blockAlign, (size_t)wav->samplesPerBlock);
-        sox_debug_more("datalen %d, numSamples %lu",dwDataLength, (unsigned long)wav->numSamples);
+        lsx_debug_more("datalen %d, numSamples %lu",dwDataLength, (unsigned long)wav->numSamples);
         wav->blockSamplesRemaining = 0;        /* Samples left in buffer */
         lsx_ima_init_table();
         ft->signal.length = wav->numSamples*ft->signal.channels;
@@ -845,10 +845,10 @@
     if (wav->ignoreSize)
       ft->signal.length = 0;
 
-    sox_debug("Reading Wave file: %s format, %d channel%s, %d samp/sec",
+    lsx_debug("Reading Wave file: %s format, %d channel%s, %d samp/sec",
            wav_format_str(wav->formatTag), ft->signal.channels,
            wChannels == 1 ? "" : "s", dwSamplesPerSecond);
-    sox_debug("        %d byte/sec, %d block align, %d bits/samp, %u data bytes",
+    lsx_debug("        %d byte/sec, %d block align, %d bits/samp, %u data bytes",
            dwAvgBytesPerSec, wav->blockAlign, wBitsPerSample, dwDataLength);
 
     /* Can also report extended fmt information */
@@ -855,7 +855,7 @@
     switch (wav->formatTag)
     {
         case WAVE_FORMAT_ADPCM:
-            sox_debug("        %d Extsize, %d Samps/block, %lu bytes/block %d Num Coefs, %lu Samps/chan",
+            lsx_debug("        %d Extsize, %d Samps/block, %lu bytes/block %d Num Coefs, %lu Samps/chan",
                       wExtSize,wav->samplesPerBlock,
                       (unsigned long)bytesPerBlock,wav->nCoefs,
                       (unsigned long)wav->numSamples);
@@ -862,7 +862,7 @@
             break;
 
         case WAVE_FORMAT_IMA_ADPCM:
-            sox_debug("        %d Extsize, %d Samps/block, %lu bytes/block %lu Samps/chan",
+            lsx_debug("        %d Extsize, %d Samps/block, %lu bytes/block %lu Samps/chan",
                       wExtSize, wav->samplesPerBlock, 
                       (unsigned long)bytesPerBlock,
                       (unsigned long)wav->numSamples);
@@ -869,13 +869,13 @@
             break;
 
         case WAVE_FORMAT_GSM610:
-            sox_debug("GSM .wav: %d Extsize, %d Samps/block, %lu Samples/chan",
+            lsx_debug("GSM .wav: %d Extsize, %d Samps/block, %lu Samples/chan",
                       wExtSize, wav->samplesPerBlock, 
                       (unsigned long)wav->numSamples);
             break;
 
         default:
-            sox_debug("        %lu Samps/chans", 
+            lsx_debug("        %lu Samps/chans", 
                       (unsigned long)wav->numSamples);
     }
 
@@ -905,12 +905,12 @@
                 if (strncmp(magic, "INFO", (size_t)4) == 0)
                 {
                     /*Skip*/
-                    sox_debug("Type INFO");
+                    lsx_debug("Type INFO");
                 }
                 else if (strncmp(magic, "adtl", (size_t)4) == 0)
                 {
                     /* Skip */
-                    sox_debug("Type adtl");
+                    lsx_debug("Type adtl");
                 }
                 else
                 {
@@ -918,7 +918,7 @@
                         break;
                     if (strncmp(magic,"ICRD",(size_t)4) == 0)
                     {
-                        sox_debug("Chunk ICRD");
+                        lsx_debug("Chunk ICRD");
                         if (len > 254)
                         {
                             sox_warn("Possible buffer overflow hack attack (ICRD)!");
@@ -937,7 +937,7 @@
                     }
                     else if (strncmp(magic,"ISFT",(size_t)4) == 0)
                     {
-                        sox_debug("Chunk ISFT");
+                        lsx_debug("Chunk ISFT");
                         if (len > 254)
                         {
                             sox_warn("Possible buffer overflow hack attack (ISFT)!");
@@ -956,7 +956,7 @@
                     }
                     else if (strncmp(magic,"cue ",(size_t)4) == 0)
                     {
-                        sox_debug("Chunk cue ");
+                        lsx_debug("Chunk cue ");
                         lsx_seeki(ft,(off_t)(len-4),SEEK_CUR);
                         lsx_readdw(ft,&dwLoopPos);
                         ft->oob.loops[0].start = dwLoopPos;
@@ -963,7 +963,7 @@
                     }
                     else if (strncmp(magic,"ltxt",(size_t)4) == 0)
                     {
-                        sox_debug("Chunk ltxt");
+                        lsx_debug("Chunk ltxt");
                         lsx_readdw(ft,&dwLoopPos);
                         ft->oob.loops[0].length = dwLoopPos - ft->oob.loops[0].start;
                         if (len > 4)
@@ -971,7 +971,7 @@
                     }
                     else
                     {
-                        sox_debug("Attempting to seek beyond unsupported chunk '%c%c%c%c' of length %d bytes", magic[0], magic[1], magic[2], magic[3], len);
+                        lsx_debug("Attempting to seek beyond unsupported chunk '%c%c%c%c' of length %d bytes", magic[0], magic[1], magic[2], magic[3], len);
                         len = (len + 1) & ~1u;
                         lsx_seeki(ft, (off_t)len, SEEK_CUR);
                     }
@@ -1436,16 +1436,16 @@
     lsx_writedw(ft, dwDataLength);               /* data chunk size */
 
     if (!second_header) {
-        sox_debug("Writing Wave file: %s format, %d channel%s, %d samp/sec",
+        lsx_debug("Writing Wave file: %s format, %d channel%s, %d samp/sec",
                 wav_format_str(wFormatTag), wChannels,
                 wChannels == 1 ? "" : "s", dwSamplesPerSecond);
-        sox_debug("        %d byte/sec, %d block align, %d bits/samp",
+        lsx_debug("        %d byte/sec, %d block align, %d bits/samp",
                 dwAvgBytesPerSec, wBlockAlign, wBitsPerSample);
     } else {
-        sox_debug("Finished writing Wave file, %u data bytes %lu samples",
+        lsx_debug("Finished writing Wave file, %u data bytes %lu samples",
                 dwDataLength, (unsigned long)wav->numSamples);
         if (wFormatTag == WAVE_FORMAT_GSM610){
-            sox_debug("GSM6.10 format: %li blocks %u padded samples %u padded data bytes",
+            lsx_debug("GSM6.10 format: %li blocks %u padded samples %u padded data bytes",
                     blocksWritten, dwSamplesWritten, dwDataLength);
             if (wav->gsmbytecount != dwDataLength)
                 sox_warn("help ! internal inconsistency - data_written %u gsmbytecount %lu",
--- a/src/xa.c
+++ b/src/xa.c
@@ -107,20 +107,20 @@
     if (lsx_readw(ft, &xa->header.bits) != SOX_SUCCESS) return SOX_EOF;
 
     /* Output the data from the header */
-    sox_debug("XA Header:");
-    sox_debug(" szID:          %02x %02x %02x %02x  |%c%c%c%c|",
+    lsx_debug("XA Header:");
+    lsx_debug(" szID:          %02x %02x %02x %02x  |%c%c%c%c|",
         magic[0], magic[1], magic[2], magic[3],
         (magic[0] >= 0x20 && magic[0] <= 0x7e) ? magic[0] : '.',
         (magic[1] >= 0x20 && magic[1] <= 0x7e) ? magic[1] : '.',
         (magic[2] >= 0x20 && magic[2] <= 0x7e) ? magic[2] : '.',
         (magic[3] >= 0x20 && magic[3] <= 0x7e) ? magic[3] : '.');
-    sox_debug(" dwOutSize:     %u", xa->header.outSize);
-    sox_debug(" wTag:          0x%04x", xa->header.tag);
-    sox_debug(" wChannels:     %u", xa->header.channels);
-    sox_debug(" dwSampleRate:  %u", xa->header.sampleRate);
-    sox_debug(" dwAvgByteRate: %u", xa->header.avgByteRate);
-    sox_debug(" wAlign:        %u", xa->header.align);
-    sox_debug(" wBits:         %u", xa->header.bits);
+    lsx_debug(" dwOutSize:     %u", xa->header.outSize);
+    lsx_debug(" wTag:          0x%04x", xa->header.tag);
+    lsx_debug(" wChannels:     %u", xa->header.channels);
+    lsx_debug(" dwSampleRate:  %u", xa->header.sampleRate);
+    lsx_debug(" dwAvgByteRate: %u", xa->header.avgByteRate);
+    lsx_debug(" wAlign:        %u", xa->header.align);
+    lsx_debug(" wBits:         %u", xa->header.bits);
 
     /* Populate the sox_soundstream structure */
     ft->encoding.encoding = SOX_ENCODING_SIGN2;