diff options
author | B. Watson <urchlay@slackware.uk> | 2024-04-07 18:00:11 -0400 |
---|---|---|
committer | B. Watson <urchlay@slackware.uk> | 2024-04-11 16:52:47 -0400 |
commit | 6540fe15cf2c025ea6db29d3b64f5f0380024e6b (patch) | |
tree | 18456144a5245c929369aca7bccfeb6aa2428303 | |
parent | 5ef769ce4eba2110acbf605d14245284dcab2f78 (diff) | |
download | soxdial-6540fe15cf2c025ea6db29d3b64f5f0380024e6b.tar.gz |
soxdial: check arguments, tweak doc.
-rwxr-xr-x | soxdial | 11 |
1 files changed, 9 insertions, 2 deletions
@@ -53,13 +53,15 @@ writes raw samples to standard output. =item B<-r>, B<--rate> I<rate> -Set the bitrate. Default is 8000. You should probably stick with +Set the bitrate in Hz. Default is 8000. You should probably stick with standard bitrates such as 22050, 44100, 48000, etc, although this is not enforced. =item B<-b>, B<--bits> I<bits> Set the bits per sample. Default is 8. The only other choice is 16. +8-bit samples will be encoded as unsigned, and 16-bit will be encoded +as signed. =item B<-v>, B<--verbose> @@ -328,9 +330,12 @@ for ($argc = 0; $argc < @ARGV; $argc++) { warn "$SELF: bits set to '$bits'\n" if $verbose; } elsif(/^--?r(?:ate)?$/) { $rate = $ARGV[++$argc]; + warn "$SELF: bitrate set to '$rate'\n" if $verbose; + die "$SELF: invalid bitrate.\n" unless $rate > 0; } elsif(/^--?l(?:ength)?$/) { $digittime = $ARGV[++$argc]; - warn "$SELF: digittime set to '$digittime'\n" if $verbose; + warn "$SELF: digit length set to '$digittime'\n" if $verbose; + die "$SELF: invalid --length argument.\n" unless $digittime > 0; } elsif(/^--?(?:x|extended)$/) { $extended = 1; warn "$SELF: extended DTMF (ABCD) enabled.\n" if $verbose; @@ -340,9 +345,11 @@ for ($argc = 0; $argc < @ARGV; $argc++) { } elsif(/^--?d(?:elay)?$/) { $intertime = $ARGV[++$argc]; warn "$SELF: inter-digit delay set to '$intertime'\n" if $verbose; + die "$SELF: invalid --delay argument.\n" unless $intertime > 0; } elsif(/^--?c(?:omma)?$/) { $pausetime = $ARGV[++$argc]; warn "$SELF: comma delay set to '$pausetime'\n" if $verbose; + die "$SELF: invalid --comma argument.\n" unless $pausetime > 0; } elsif(/^--?(?:t|dialtone)$/) { push @sox_subcmds, dialtone_subcmd($ARGV[++$argc]); } else { |