ref: ab029955926a37d3b48e9309faf7d9af785cd21f
parent: 50f5368a56be08480b207c77a093cdccf2a814ce
author: cbagwell <cbagwell>
date: Sun Oct 8 16:32:39 EDT 2000
Fixed bug were it was impossible to write ADPCM wav files.
--- a/Changelog
+++ b/Changelog
@@ -13,6 +13,7 @@
trash your data. Reported by Friedhel Mehnert.
o Added a new fade in/out effect from Ari Moisio.
o AIFF files now ignore a MARK chunk if the loop type is NoLoop (0).
+ o Fixed bug were it was impossible to output ADPCM data in wav files.
sox-12.17
---------
--- a/src/wav.c
+++ b/src/wav.c
@@ -1176,6 +1176,19 @@
wSamplesPerSecond = ft->info.rate;
wChannels = ft->info.channels;
+ /* Check to see if encoding is ADPCM or not. If ADPCM
+ * possibly override the size to be bytes. It isn't needed
+ * by this routine will look nicer (and more correct)
+ * on verbose output.
+ */
+ if ((ft->info.encoding == ST_ENCODING_ADPCM ||
+ ft->info.encoding == ST_ENCODING_IMA_ADPCM) &&
+ ft->info.size != ST_SIZE_BYTE)
+ {
+ st_warn("Overriding output size to bytes for ADPCM data.");
+ ft->info.size = ST_SIZE_BYTE;
+ }
+
switch (ft->info.size)
{
case ST_SIZE_BYTE:
@@ -1183,7 +1196,9 @@
if (ft->info.encoding != ST_ENCODING_UNSIGNED &&
ft->info.encoding != ST_ENCODING_ULAW &&
ft->info.encoding != ST_ENCODING_ALAW &&
- ft->info.encoding != ST_ENCODING_GSM)
+ ft->info.encoding != ST_ENCODING_GSM &&
+ ft->info.encoding != ST_ENCODING_ADPCM &&
+ ft->info.encoding != ST_ENCODING_IMA_ADPCM)
{
st_warn("Do not support %s with 8-bit data. Forcing to unsigned",st_encodings_str[ft->info.encoding]);
ft->info.encoding = ST_ENCODING_UNSIGNED;