shithub: sox

Download patch

ref: c0fa003407d0e404ee7006d1374027b7c320cff3
parent: 97e1c671b1cf7b9b5040cb79cff2ad476b79b3ae
author: robs <robs>
date: Sat Dec 30 14:17:44 EST 2006

Fix a-law/mu-law to flac conversion; add some cdda tests

--- a/src/flac.c
+++ b/src/flac.c
@@ -318,7 +318,15 @@
 #undef SET_OPTION
   }
 
+  /* FIXME: FLAC should not need to know about this oddity */
+  if (format->signal.encoding == ST_ENCODING_ULAW ||
+      format->signal.encoding == ST_ENCODING_ALAW ||
+      format->signal.encoding == ST_ENCODING_INV_ULAW ||
+      format->signal.encoding == ST_ENCODING_INV_ALAW)
+    format->signal.size = ST_SIZE_WORD;
+
   encoder->bits_per_sample = (format->signal.size > 4 ? 4 : format->signal.size) << 3;
+
   st_report("FLAC encoding at %i bits per sample", encoder->bits_per_sample);
 
   FLAC__stream_encoder_set_channels(encoder->flac, format->signal.channels);
--- a/src/tests.sh
+++ b/src/tests.sh
@@ -3,6 +3,7 @@
 # SoX Regression Test script.
 #
 # This script is just a quick sanity check of SoX on lossless format conversions.
+# TODO sndt sph
 
 # verbose options
 #verbose=-V
@@ -64,10 +65,10 @@
   convertToAndFrom sl u4 Raw wav aiff aifc
 
   format1=al
-  convertToAndFrom al sw uw sl raw Raw dat aiff aifc
+  convertToAndFrom al sw uw sl raw Raw dat aiff aifc flac
 
   format1=ul
-  convertToAndFrom ul sw uw sl raw Raw dat aiff aifc
+  convertToAndFrom ul sw uw sl raw Raw dat aiff aifc flac
 
   format1=Wav
   convertToAndFrom Wav aiff aifc au dat sf flac
@@ -87,6 +88,9 @@
 
   format1=wve
   (rate=8000; convertToAndFrom al sw uw sl raw Raw dat) || exit 1 # Fixed rate
+
+  format1=prc
+  (rate=8000; convertToAndFrom al sw uw sl raw Raw dat) || exit 1 # Fixed rate
 }
 
 grep -q "^#define HAVE_LIBFLAC" stconfig.h || skip="flac $skip"
@@ -93,11 +97,16 @@
 
 rate=44100
 samples=23493
+
 channels=3 
 do_multichannel_formats
+
 channels=2 
 do_multichannel_formats
 do_twochannel_formats
+format1=cdda         # 2-channel only
+convertToAndFrom sw u3 aiff
+
 channels=1 
 do_multichannel_formats
 do_twochannel_formats