view libtest/robewrite.c @ 165:ef3ea52a190f

rename gsmfr-cvt-dlcap to gsmfr-dlcap-gsmx for consistency with EFR version
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 16 Dec 2022 04:09:03 +0000
parents 14b627682458
children
line wrap: on
line source

/*
 * 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);
}