From 0c022aca03dc8f74f213accfefecb0fe6ad18fd0 Mon Sep 17 00:00:00 2001 From: Kamal Mostafa Date: Thu, 30 Aug 2012 10:17:55 -0700 Subject: [PATCH] minimodem: --rx-one quits after first no-carrier --- src/minimodem.1.in | 3 +++ src/minimodem.c | 10 ++++++++++ 2 files changed, 13 insertions(+) diff --git a/src/minimodem.1.in b/src/minimodem.1.in index b4936dc..37a34a0 100644 --- a/src/minimodem.1.in +++ b/src/minimodem.1.in @@ -104,6 +104,9 @@ Generate 32-bit floating-point format audio samples, instead of the default 16-bit signed integer format (applies to \-\-tx mode only; \-\-rx mode always uses 32-bit floating-point). .TP +.B \-\-rx-one +Quit after the first carrier/no-carrier event (applies to \-\-rx mode only). +.TP .B \-\-benchmarks Run and report internal performance tests (all other flags are ignored). .TP diff --git a/src/minimodem.c b/src/minimodem.c index 6f6ead4..8af8468 100644 --- a/src/minimodem.c +++ b/src/minimodem.c @@ -341,6 +341,7 @@ usage() " -A, --alsa\n" " --lut={tx_sin_table_len}\n" " --float-samples\n" + " --rx-one\n" " --benchmarks\n" " {baudmode}\n" " 1200 Bell202 1200 bps --ascii\n" @@ -389,6 +390,7 @@ main( int argc, char*argv[] ) float tx_amplitude = 1.0; unsigned int tx_sin_table_len = 4096; + unsigned int rx_one = 0; float rxnoise_factor = 0.0; /* validate the default system audio mechanism */ @@ -412,6 +414,7 @@ main( int argc, char*argv[] ) MINIMODEM_OPT_UNUSED=256, // placeholder MINIMODEM_OPT_LUT, MINIMODEM_OPT_FLOAT_SAMPLES, + MINIMODEM_OPT_RX_ONE, MINIMODEM_OPT_BENCHMARKS, MINIMODEM_OPT_XRXNOISE, }; @@ -441,6 +444,7 @@ main( int argc, char*argv[] ) { "samplerate", 1, 0, 'R' }, { "lut", 1, 0, MINIMODEM_OPT_LUT }, { "float-samples", 0, 0, MINIMODEM_OPT_FLOAT_SAMPLES }, + { "rx-one", 0, 0, MINIMODEM_OPT_RX_ONE }, { "benchmarks", 0, 0, MINIMODEM_OPT_BENCHMARKS }, { "Xrxnoise", 1, 0, MINIMODEM_OPT_XRXNOISE }, { 0 } @@ -525,6 +529,9 @@ main( int argc, char*argv[] ) case MINIMODEM_OPT_FLOAT_SAMPLES: sample_format = SA_SAMPLE_FORMAT_FLOAT; break; + case MINIMODEM_OPT_RX_ONE: + rx_one = 1; + break; case MINIMODEM_OPT_BENCHMARKS: benchmarks(); exit(0); @@ -964,6 +971,9 @@ main( int argc, char*argv[] ) nframes_decoded = 0; nbits_decoded = 0; } + + if ( rx_one ) + break; } /* Advance the sample stream forward by try_max_nsamples so the