shithub: sox

Download patch

ref: d14f798ae9d14cc6192f3c764976820a288bd8af
parent: c7dbcf529c434f00da0d25fc7daba11a01141acb
author: rrt <rrt>
date: Mon Nov 13 20:15:50 EST 2006

Support Maxis's XA format (Dwayne C. Litzenberger)

--- a/Changelog
+++ b/Changelog
@@ -26,6 +26,7 @@
   o Allow the rate and number of channels of .au files to be overridden
     by command-line arguments. (robs@users.sf.net)
   o More and better self-tests. (robs@users.sf.net)
+  o Support Maxis's XA format. (Dwayne C. Litzenberger)
 
 sox-12.18.2
 -----------
--- a/README
+++ b/README
@@ -41,6 +41,8 @@
     o GSM
     o RIFX (big endian)
   o Psion (palmtop) A-law WVE files and Record voice notes
+  o Maxis XA Audio files
+    o EA ADPCM (read support only, for now)
   o Pseudo-file formats that allow direct playing/recording
     from some audio devices under UNIX.
   o Pseudo-nul file that reads and writes from/to nowhere
--- a/sox.1
+++ b/sox.1
@@ -616,6 +616,13 @@
 .B .wve
 Psion 8-bit A-law. Used on older Psion PDAs.
 .TP 10
+.B .xa
+Maxis XA files
+.br
+These are 16-bit ADPCM sound files used by Maxis games.  Writing .xa files is
+currently not supported, although adding write support should not be very
+difficult.
+.TP 10
 .B .raw
 Raw files (no header).
 The sample rate, size (byte, word, etc), 
--- a/src/Makefile.in
+++ b/src/Makefile.in
@@ -45,7 +45,7 @@
 	  cvsd.o dat.o flac.o g711.o g721.o g723_16.o g723_24.o g723_40.o \
 	  g72x.o gsm.o hcom.o ima_rw.o maud.o mp3.o nulfile.o prc.o \
 	  raw.o sf.o smp.o sndrtool.o sphere.o tx16w.o voc.o vorbis.o \
-	  vox.o wav.o wve.o
+	  vox.o wav.o wve.o xa.o
 
 EOBJ	= avg.o band.o bandpass.o breject.o btrworth.o chorus.o compand.o \
 	  copy.o dcshift.o deemphas.o earwax.o echo.o echos.o \
--- a/src/auto.c
+++ b/src/auto.c
@@ -131,6 +131,12 @@
             {
                 type = "flac";
             }
+            else if ((memcmp(header, "XAI\0", 4) == 0) ||
+                     (memcmp(header, "XAJ\0", 4) == 0) ||
+                     (memcmp(header, "XA\0\0", 4) == 0))
+            {
+                type = "xa";
+            }
         } /* read 4-byte header */
 
         /* If we didn't find type yet then start looking for file
--- a/src/handlers.c
+++ b/src/handlers.c
@@ -69,6 +69,7 @@
   st_vox_format_fn,
   st_wav_format_fn,
   st_wve_format_fn,
+  st_xa_format_fn,
   NULL
 };
 
--- a/src/st_i.h
+++ b/src/st_i.h
@@ -202,6 +202,7 @@
 extern const st_format_t *st_vox_format_fn(void);
 extern const st_format_t *st_wav_format_fn(void);
 extern const st_format_t *st_wve_format_fn(void);
+extern const st_format_t *st_xa_format_fn(void);
 
 /* Raw I/O
  */