Limit carrier/idle generation for input with delays
For non-interactive output (writing to an audio file), generate the idle output carrier for same duration that the input is idle. Makes this case generate an output .wav file of just over 1 second duration: { echo hello; sleep 1; echo world; } | minimodem --tx -f /tmp/xx.wav 300
This commit is contained in:
parent
84b2406b97
commit
513a11d454
|
@ -163,6 +163,14 @@ static void fsk_transmit_stdin(
|
|||
FD_ZERO(&fdset);
|
||||
FD_SET(fd, &fdset);
|
||||
struct timeval tv_idletimeout = { 0, 0 };
|
||||
|
||||
if ( !tx_interactive ) {
|
||||
// When stdin blocks we "emit idle tone", for a duration of
|
||||
// idle_carrier_usec. If !tx_interactive (i.e. writing to an
|
||||
// audio file) make the select timeout the same duration.
|
||||
tv_idletimeout.tv_usec = idle_carrier_usec;
|
||||
}
|
||||
|
||||
if( block_input || select(fd+1, &fdset, NULL, NULL, &tv_idletimeout) )
|
||||
{
|
||||
n_read = read(fd, &buf, sizeof(buf));
|
||||
|
|
Loading…
Reference in New Issue