diff options
author | Leah Rowe <leah@libreboot.org> | 2023-05-16 08:23:19 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-05-16 23:11:35 +0100 |
commit | abc5cfd38cf52461bee5d2f71f3320a76b15d3a3 (patch) | |
tree | 5fd014ea74e77dfae5f0a1df375cddc2676ff747 /util | |
parent | e2864704320e9fdde78ea34088256d99df9d5931 (diff) |
util/spkmodem_recv: Say frame in English
Source code should be written in English.
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util')
-rw-r--r-- | util/spkmodem_recv/spkmodem-recv.c | 26 |
1 files changed, 13 insertions, 13 deletions
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++; } |