Clean up the "emit idle tone" code, which should never have involved
tx_leader_bits_len (that was a copy-paste laziness).
"Emit idle tone" simply generates the idle tone for a hardcoded period
of time now codified as 'idle_tone_usec' and set to 1/25 of a second
(to match the existing behavior).
static analysis from clang scan-build detected some paths
in the call to fsk_frame_analyze where ampl_out is not being
set:
fsk.c:493:13: warning: Assigned value is garbage or undefined
best_a = ampl_out;
..probably the sanest approach here is to initialize it to 0.0
just to avoid it being garbage rather than setting it to zero in
the failed error paths in fsk_frame_analyze.
Signed-off-by: Colin Ian King <colin.king@canonical.com>
The logic that determined whether to 'block_input' was backwards with
respect to non-interactive --file sessions, such that using --file
*enabled* the tx-carrier behavior when it should have disabled it.
This went unnoticed because on reasonably fast systems, reading the
input data from the file never induce the timeout anyway -- only very
slow machines reveal the problem: long gaps of 'mark' between each
frame, as if each input character was slowly typed interactively.
Fixes: ecebf01 Add ability to output a carrier while waiting for data
With arbitrarily large latency setting (unsigned int)-1, ALSA will happily
accept all the samples we want to throw at it.
Reducing to a reasonably long (but still sub-second) value of 100ms, we
cause ALSA writes to block and work properly with --tx-carrier.
Calculate and consider separate signal-strength divergence values for
mark and space bits, so that imbalanced (but consistent) mark/space
strengths do not drive down confidence.
Note: This change makes all existing test cases yield very slightly
higher confidence values.