minimodem: --tx uses S16 samples by default, --float-samples overrides
This commit is contained in:
parent
6671138471
commit
9948e7c7dd
@ -2,7 +2,7 @@
|
||||
.\" First parameter, NAME, should be all caps
|
||||
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
|
||||
.\" other parameters are allowed: see man(7), man(1)
|
||||
.TH MINIMODEM 1 "August 11, 2011"
|
||||
.TH MINIMODEM 1 "August 12, 2011"
|
||||
.\" Please adjust this date whenever revising the manpage.
|
||||
.\"
|
||||
.\" Some roff macros, for reference:
|
||||
@ -78,6 +78,11 @@ Set the audio sample rate (default rate is 48000 Hz).
|
||||
Use ALSA as the audio output system instead of the default
|
||||
PulseAudio (depending on build configuration options).
|
||||
.TP
|
||||
.B \-F, \-\-float-samples
|
||||
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 \-V, \-\-version
|
||||
print program version
|
||||
.SH {baudmode}
|
||||
|
@ -257,6 +257,7 @@ usage()
|
||||
" -R, --samplerate {rate}\n"
|
||||
" -V, --version\n"
|
||||
" -A, --alsa\n"
|
||||
" -F, --float-samples\n"
|
||||
" {baudmode}\n"
|
||||
" 1200 Bell202 1200 bps --ascii\n"
|
||||
" 300 Bell103 300 bps --ascii\n"
|
||||
@ -285,7 +286,7 @@ main( int argc, char*argv[] )
|
||||
float bfsk_confidence_threshold = 0.6;
|
||||
|
||||
sa_backend_t sa_backend = SA_BACKEND_SYSDEFAULT;
|
||||
|
||||
sa_format_t sample_format = SA_SAMPLE_FORMAT_S16;
|
||||
unsigned int sample_rate = 48000;
|
||||
unsigned int nchannels = 1; // FIXME: only works with one channel
|
||||
|
||||
@ -327,9 +328,10 @@ main( int argc, char*argv[] )
|
||||
{ "quiet", 0, 0, 'q' },
|
||||
{ "alsa", 0, 0, 'A' },
|
||||
{ "samplerate", 1, 0, 'R' },
|
||||
{ "float-samples", 0, 0, 'F' },
|
||||
{ 0 }
|
||||
};
|
||||
c = getopt_long(argc, argv, "Vtrc:a85f:b:M:S:T:qAR:",
|
||||
c = getopt_long(argc, argv, "Vtrc:a85f:b:M:S:T:qAR:F",
|
||||
long_options, &option_index);
|
||||
if ( c == -1 )
|
||||
break;
|
||||
@ -393,6 +395,9 @@ main( int argc, char*argv[] )
|
||||
exit(1);
|
||||
#endif
|
||||
break;
|
||||
case 'F':
|
||||
sample_format = SA_SAMPLE_FORMAT_FLOAT;
|
||||
break;
|
||||
default:
|
||||
usage();
|
||||
}
|
||||
@ -400,6 +405,10 @@ main( int argc, char*argv[] )
|
||||
if ( TX_mode == -1 )
|
||||
TX_mode = 0;
|
||||
|
||||
/* The receive code requires floating point samples to feed to the FFT */
|
||||
if ( TX_mode == 0 )
|
||||
sample_format = SA_SAMPLE_FORMAT_FLOAT;
|
||||
|
||||
if ( filename ) {
|
||||
#if !USE_SNDFILE
|
||||
fprintf(stderr, "E: This build of minimodem was configured without sndfile,\nE: so the --file flag is not supported.\n");
|
||||
@ -524,8 +533,7 @@ main( int argc, char*argv[] )
|
||||
|
||||
simpleaudio *sa_out;
|
||||
sa_out = simpleaudio_open_stream(sa_backend, SA_STREAM_PLAYBACK,
|
||||
SA_SAMPLE_FORMAT_FLOAT,
|
||||
sample_rate, nchannels,
|
||||
sample_format, sample_rate, nchannels,
|
||||
program_name, stream_name);
|
||||
if ( ! sa_out )
|
||||
return 1;
|
||||
@ -553,8 +561,7 @@ main( int argc, char*argv[] )
|
||||
|
||||
simpleaudio *sa;
|
||||
sa = simpleaudio_open_stream(sa_backend, SA_STREAM_RECORD,
|
||||
SA_SAMPLE_FORMAT_FLOAT,
|
||||
sample_rate, nchannels,
|
||||
sample_format, sample_rate, nchannels,
|
||||
program_name, stream_name);
|
||||
if ( ! sa )
|
||||
return 1;
|
||||
|
1
src/testcases/test-06-self-test-float-samples
Executable file
1
src/testcases/test-06-self-test-float-samples
Executable file
@ -0,0 +1 @@
|
||||
exec ./self-test testcases/self-test-ascii.txt --float-samples 12000
|
Loading…
x
Reference in New Issue
Block a user