From abc5cfd38cf52461bee5d2f71f3320a76b15d3a3 Mon Sep 17 00:00:00 2001 From: Leah Rowe Date: Tue, 16 May 2023 08:23:19 +0100 Subject: util/spkmodem_recv: Say frame in English Source code should be written in English. Signed-off-by: Leah Rowe --- util/spkmodem_recv/spkmodem-recv.c | 26 +++++++++++++------------- 1 file changed, 13 insertions(+), 13 deletions(-) (limited to 'util/spkmodem_recv') diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c index d543d32e..12595f98 100644 --- a/util/spkmodem_recv/spkmodem-recv.c +++ b/util/spkmodem_recv/spkmodem-recv.c @@ -8,7 +8,7 @@ /* Compilation: gcc -o spkmodem-recv spkmodem-recv */ /* Usage: parec --channels=1 --rate=48000 --format=s16le | ./spkmodem-recv */ -#define SAMPLES_PER_TRAME 240 +#define SAMPLES_PER_FRAME 240 #define FREQ_SEP_MIN 5 #define FREQ_SEP_MAX 15 #define FREQ_DATA_MIN 15 @@ -19,8 +19,8 @@ #define DEBUG 0 #define FLUSH_TIMEOUT 1 -static signed short trame[2 * SAMPLES_PER_TRAME]; -static signed short pulse[2 * SAMPLES_PER_TRAME]; +static signed short frame[2 * SAMPLES_PER_FRAME]; +static signed short pulse[2 * SAMPLES_PER_FRAME]; static int ringpos = 0; static int pos, f1, f2; static int amplitude = 0; @@ -39,7 +39,7 @@ main (int argc, char *argv[]) (void)argc; (void)argv; while (!feof (stdin)) { - if (lp > 3 * SAMPLES_PER_TRAME) { + if (lp > 3 * SAMPLES_PER_FRAME) { bitn = 7; c = 0; lp = 0; @@ -55,7 +55,7 @@ main (int argc, char *argv[]) } #if DEBUG printf ("%d %d %d @%d\n", f1, f2, FREQ_DATA_THRESHOLD, - ftell (stdin) - sizeof (trame)); + ftell (stdin) - sizeof (frame)); #endif if (f1 < FREQ_DATA_THRESHOLD) c |= (1 << bitn); @@ -71,7 +71,7 @@ main (int argc, char *argv[]) } lp = 0; llp = 0; - for (i = 0; i < SAMPLES_PER_TRAME; i++) + for (i = 0; i < SAMPLES_PER_FRAME; i++) read_sample (); } return 0; @@ -80,14 +80,14 @@ main (int argc, char *argv[]) static void read_sample (void) { - amplitude -= abs (trame[ringpos]); + amplitude -= abs (frame[ringpos]); f1 -= pulse[ringpos]; - f1 += pulse[(ringpos + SAMPLES_PER_TRAME) % (2 * SAMPLES_PER_TRAME)]; - f2 -= pulse[(ringpos + SAMPLES_PER_TRAME) % (2 * SAMPLES_PER_TRAME)]; - fread (trame + ringpos, 1, sizeof (trame[0]), stdin); - amplitude += abs (trame[ringpos]); + f1 += pulse[(ringpos + SAMPLES_PER_FRAME) % (2 * SAMPLES_PER_FRAME)]; + f2 -= pulse[(ringpos + SAMPLES_PER_FRAME) % (2 * SAMPLES_PER_FRAME)]; + fread (frame + ringpos, 1, sizeof (frame[0]), stdin); + amplitude += abs (frame[ringpos]); - if (abs(trame[ringpos]) > THRESHOLD) { /* rising/falling edge(pulse) */ + if (abs(frame[ringpos]) > THRESHOLD) { /* rising/falling edge(pulse) */ pulse[ringpos] = 1; pos = !pos; f2++; @@ -96,6 +96,6 @@ read_sample (void) } ringpos++; - ringpos %= 2 * SAMPLES_PER_TRAME; + ringpos %= 2 * SAMPLES_PER_FRAME; lp++; } -- cgit v1.2.1