diff options
author | Leah Rowe <leah@libreboot.org> | 2023-05-16 11:57:53 +0100 |
---|---|---|
committer | Leah Rowe <leah@libreboot.org> | 2023-05-16 23:11:35 +0100 |
commit | 93cc66425473a3ab8911220d0a6eb9ea27ae3c75 (patch) | |
tree | 29436ef2edc9804ac2bb25b8325b283d83aa4a83 /util/spkmodem_recv/spkmodem-recv.c | |
parent | 27866e65fbc2f9eb2564f774a5139aeec7fcba89 (diff) |
util/spkmodem_recv: Handle output in new function
Signed-off-by: Leah Rowe <leah@libreboot.org>
Diffstat (limited to 'util/spkmodem_recv/spkmodem-recv.c')
-rw-r--r-- | util/spkmodem_recv/spkmodem-recv.c | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/util/spkmodem_recv/spkmodem-recv.c b/util/spkmodem_recv/spkmodem-recv.c index b7805954..82b71343 100644 --- a/util/spkmodem_recv/spkmodem-recv.c +++ b/util/spkmodem_recv/spkmodem-recv.c @@ -27,8 +27,11 @@ int ringpos = 0; int pos, f1, f2; int amplitude = 0; int lp = 0; +int ascii_bit = 7; +char ascii = 0; void handle_audio(void); +void print_char(void); void fetch_sample(void); int @@ -45,8 +48,6 @@ main(int argc, char *argv[]) void handle_audio(void) { - static int ascii_bit = 7; - static char ascii = 0; static int llp = 0; if (lp > 3 * SAMPLES_PER_FRAME) { @@ -64,6 +65,18 @@ handle_audio(void) fetch_sample(); return; } + + print_char(); + + lp = 0; + llp = 0; + for (int i = 0; i < SAMPLES_PER_FRAME; i++) + fetch_sample(); +} + +void +print_char(void) +{ #if DEBUG long stdin_pos = 0; if ((stdin_pos = ftell(stdin)) == -1) @@ -83,10 +96,6 @@ handle_audio(void) ascii_bit = 7; ascii = 0; } - lp = 0; - llp = 0; - for (int i = 0; i < SAMPLES_PER_FRAME; i++) - fetch_sample(); } void |