ref: 33859cedfacd4e904353d2cbb7d045c42bd5d7fb
parent: 51abeca26dab9ece7c1f3cb7d40049568350fc2f
author: cbagwell <cbagwell>
date: Mon Oct 4 19:50:09 EDT 2004
Adding support for writing 32-bit data in AIFF
--- a/Changelog
+++ b/Changelog
@@ -58,6 +58,7 @@
from -1:1.
o Modifed .au handler to be able to read and write 32-bit
and 64-bit float data. Only tested reading so far.
+ o Added support for writing 32-bit audio to AIFF.
sox-12.17.5
-----------
--- a/src/aiff.c
+++ b/src/aiff.c
@@ -376,6 +376,8 @@
if (foundcomm) {
ft->info.channels = channels;
ft->info.rate = rate;
+ if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_SIGN2)
+ st_report("AIFF only supports signed data. Forcing to signed.");
ft->info.encoding = ST_ENCODING_SIGN2;
if (bits <= 8)
{
@@ -671,9 +673,12 @@
if ((ft->info.encoding == ST_ENCODING_ULAW ||
ft->info.encoding == ST_ENCODING_ALAW) &&
ft->info.size == ST_SIZE_BYTE) {
- st_report("expanding 8-bit u-law to 16 bits");
+ st_report("expanding 8-bit u-law to signed 16 bits");
+ ft->info.encoding = ST_ENCODING_SIGN2;
ft->info.size = ST_SIZE_WORD;
}
+ if (ft->info.encoding != -1 && ft->info.encoding != ST_ENCODING_SIGN2)
+ st_report("AIFF only supports signed data. Forcing to signed.");
ft->info.encoding = ST_ENCODING_SIGN2; /* We have a fixed encoding */
/* Compute the "very large number" so that a maximum number
@@ -741,6 +746,9 @@
else if (ft->info.encoding == ST_ENCODING_SIGN2 &&
ft->info.size == ST_SIZE_WORD)
bits = 16;
+ else if (ft->info.encoding == ST_ENCODING_SIGN2 &&
+ ft->info.size == ST_SIZE_DWORD)
+ bits = 32;
else
{
st_fail_errno(ft,ST_EFMT,"unsupported output encoding/size for AIFF header");
@@ -1052,4 +1060,3 @@
else
return f;
}
-