minimodem: --samplerate sets the audio sample rate

This commit is contained in:
Kamal Mostafa 2012-08-11 10:24:28 -07:00
parent 22317f54fc
commit 8d90e839d7
2 changed files with 11 additions and 2 deletions

View File

@ -2,7 +2,7 @@
.\" First parameter, NAME, should be all caps .\" First parameter, NAME, should be all caps
.\" Second parameter, SECTION, should be 1-8, maybe w/ subsection .\" Second parameter, SECTION, should be 1-8, maybe w/ subsection
.\" other parameters are allowed: see man(7), man(1) .\" other parameters are allowed: see man(7), man(1)
.TH MINIMODEM 1 "August 8, 2011" .TH MINIMODEM 1 "August 11, 2011"
.\" Please adjust this date whenever revising the manpage. .\" Please adjust this date whenever revising the manpage.
.\" .\"
.\" Some roff macros, for reference: .\" Some roff macros, for reference:
@ -71,6 +71,9 @@ encode or decode an audio file (extension sets audio format)
.B \-q, \-\-quiet .B \-q, \-\-quiet
Do not report CARRIER / NOCARRIER or signal analysis metrics. Do not report CARRIER / NOCARRIER or signal analysis metrics.
.TP .TP
.B \-R, \-\-samplerate {rate}
Set the audio sample rate (default rate is 48000 Hz).
.TP
.B \-A, \-\-alsa .B \-A, \-\-alsa
Use ALSA as the audio output system instead of the default Use ALSA as the audio output system instead of the default
PulseAudio (depending on build configuration options). PulseAudio (depending on build configuration options).

View File

@ -254,6 +254,7 @@ usage()
" -S, --space {space_freq}\n" " -S, --space {space_freq}\n"
" -T, --txstopbits {m.n}\n" " -T, --txstopbits {m.n}\n"
" -q, --quiet\n" " -q, --quiet\n"
" -R, --samplerate {rate}\n"
" -V, --version\n" " -V, --version\n"
" -A, --alsa\n" " -A, --alsa\n"
" {baudmode}\n" " {baudmode}\n"
@ -329,9 +330,10 @@ main( int argc, char*argv[] )
{ "txstopbits", 1, 0, 'T' }, { "txstopbits", 1, 0, 'T' },
{ "quiet", 0, 0, 'q' }, { "quiet", 0, 0, 'q' },
{ "alsa", 0, 0, 'A' }, { "alsa", 0, 0, 'A' },
{ "samplerate", 1, 0, 'R' },
{ 0 } { 0 }
}; };
c = getopt_long(argc, argv, "Vtrc:a85f:b:M:S:T:qA", c = getopt_long(argc, argv, "Vtrc:a85f:b:M:S:T:qAR:",
long_options, &option_index); long_options, &option_index);
if ( c == -1 ) if ( c == -1 )
break; break;
@ -383,6 +385,10 @@ main( int argc, char*argv[] )
case 'q': case 'q':
quiet_mode = 1; quiet_mode = 1;
break; break;
case 'R':
sample_rate = atoi(optarg);
assert( sample_rate > 0 );
break;
case 'A': case 'A':
#if USE_ALSA #if USE_ALSA
simpleaudio_open_system_audio = simpleaudio_open_stream_alsa; simpleaudio_open_system_audio = simpleaudio_open_stream_alsa;