From 8d90e839d7356708e5dd377920759f3c03b29291 Mon Sep 17 00:00:00 2001 From: Kamal Mostafa Date: Sat, 11 Aug 2012 10:24:28 -0700 Subject: [PATCH] minimodem: --samplerate sets the audio sample rate --- src/minimodem.1.in | 5 ++++- src/minimodem.c | 8 +++++++- 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/src/minimodem.1.in b/src/minimodem.1.in index 3716cad..2509737 100644 --- a/src/minimodem.1.in +++ b/src/minimodem.1.in @@ -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 8, 2011" +.TH MINIMODEM 1 "August 11, 2011" .\" Please adjust this date whenever revising the manpage. .\" .\" Some roff macros, for reference: @@ -71,6 +71,9 @@ encode or decode an audio file (extension sets audio format) .B \-q, \-\-quiet Do not report CARRIER / NOCARRIER or signal analysis metrics. .TP +.B \-R, \-\-samplerate {rate} +Set the audio sample rate (default rate is 48000 Hz). +.TP .B \-A, \-\-alsa Use ALSA as the audio output system instead of the default PulseAudio (depending on build configuration options). diff --git a/src/minimodem.c b/src/minimodem.c index 659e431..43b4f1f 100644 --- a/src/minimodem.c +++ b/src/minimodem.c @@ -254,6 +254,7 @@ usage() " -S, --space {space_freq}\n" " -T, --txstopbits {m.n}\n" " -q, --quiet\n" + " -R, --samplerate {rate}\n" " -V, --version\n" " -A, --alsa\n" " {baudmode}\n" @@ -329,9 +330,10 @@ main( int argc, char*argv[] ) { "txstopbits", 1, 0, 'T' }, { "quiet", 0, 0, 'q' }, { "alsa", 0, 0, 'A' }, + { "samplerate", 1, 0, 'R' }, { 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); if ( c == -1 ) break; @@ -383,6 +385,10 @@ main( int argc, char*argv[] ) case 'q': quiet_mode = 1; break; + case 'R': + sample_rate = atoi(optarg); + assert( sample_rate > 0 ); + break; case 'A': #if USE_ALSA simpleaudio_open_system_audio = simpleaudio_open_stream_alsa;