FreeCalypso > hg > gsm-codec-lib
diff libtest/robewrite.c @ 153:14b627682458
gsmfr-decode-r utility put together
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Wed, 14 Dec 2022 23:11:20 +0000 |
parents | libtest/pcmwrite.c@a3aa152c4653 |
children |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/libtest/robewrite.c Wed Dec 14 23:11:20 2022 +0000 @@ -0,0 +1,22 @@ +/* + * Here we implement our PCM write helper function for "robe" format. + */ + +#include <stdio.h> +#include <stdint.h> +#include "robewrite.h" + +void write_pcm_to_robe(FILE *outf, const int16_t *pcm) +{ + uint8_t bytes[320], *dp; + int16_t samp; + unsigned n; + + dp = bytes; + for (n = 0; n < 160; n++) { + samp = pcm[n]; + *dp++ = (samp >> 8) & 0xFF; + *dp++ = samp & 0xFF; + } + fwrite(bytes, 2, 160, outf); +}