summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Brady <mikebrady@eircom.net>2019-05-29 16:18:51 +0100
committerMike Brady <mikebrady@eircom.net>2019-05-29 16:18:51 +0100
commit7f2e6b1aac6740168c7fac5b1054ed234e420159 (patch)
tree1b9970e01dd1d752fccc20bc39cdfa0330e7841b
parent76ad4e6a73709f6c42bd9a8ccd6a85844096719e (diff)
Add support for S32_LE, S32_BE, S24_LE and S24_BE wqhen generating frames of dithered silence
-rw-r--r--common.c48
1 files changed, 47 insertions, 1 deletions
diff --git a/common.c b/common.c
index b097dda..0f72f6f 100644
--- a/common.c
+++ b/common.c
@@ -1442,6 +1442,30 @@ int64_t generate_zero_frames(char *outp, size_t number_of_frames, enum sps_forma
*(int32_t *)op = hyper_sample;
result = 4;
break;
+ case SPS_FORMAT_S32_LE:
+ hyper_sample >>= (64 - 32);
+ byt = (uint8_t)hyper_sample;
+ *op++ = byt;
+ byt = (uint8_t)(hyper_sample >> 8);
+ *op++ = byt;
+ byt = (uint8_t)(hyper_sample >> 16);
+ *op++ = byt;
+ byt = (uint8_t)(hyper_sample >> 24);
+ *op++ = byt;
+ result = 4;
+ break;
+ case SPS_FORMAT_S32_BE:
+ hyper_sample >>= (64 - 32);
+ byt = (uint8_t)(hyper_sample >> 24);
+ *op++ = byt;
+ byt = (uint8_t)(hyper_sample >> 16);
+ *op++ = byt;
+ byt = (uint8_t)(hyper_sample >> 8);
+ *op++ = byt;
+ byt = (uint8_t)hyper_sample;
+ *op++ = byt;
+ result = 4;
+ break;
case SPS_FORMAT_S24_3LE:
hyper_sample >>= (64 - 24);
byt = (uint8_t)hyper_sample;
@@ -1467,6 +1491,28 @@ int64_t generate_zero_frames(char *outp, size_t number_of_frames, enum sps_forma
*(int32_t *)op = hyper_sample;
result = 4;
break;
+ case SPS_FORMAT_S24_LE:
+ hyper_sample >>= (64 - 24);
+ byt = (uint8_t)hyper_sample;
+ *op++ = byt;
+ byt = (uint8_t)(hyper_sample >> 8);
+ *op++ = byt;
+ byt = (uint8_t)(hyper_sample >> 16);
+ *op++ = byt;
+ *op++ = 0;
+ result = 4;
+ break;
+ case SPS_FORMAT_S24_BE:
+ hyper_sample >>= (64 - 24);
+ *op++ = 0;
+ byt = (uint8_t)(hyper_sample >> 16);
+ *op++ = byt;
+ byt = (uint8_t)(hyper_sample >> 8);
+ *op++ = byt;
+ byt = (uint8_t)hyper_sample;
+ *op++ = byt;
+ result = 4;
+ break;
case SPS_FORMAT_S16_LE:
hyper_sample >>= (64 - 16);
byt = (uint8_t)hyper_sample;
@@ -1501,7 +1547,7 @@ int64_t generate_zero_frames(char *outp, size_t number_of_frames, enum sps_forma
break;
default:
result = 0; // stop a compiler warning
- die("Unexpected SPS_FORMAT_UNKNOWN while outputting samples");
+ die("Unexpected SPS_FORMAT_* with index %d while outputting silence",format);
}
p += result;
previous_random_number = r;