aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rwxr-xr-xsoxdial11
1 files changed, 9 insertions, 2 deletions
diff --git a/soxdial b/soxdial
index f3714c8..a414cf8 100755
--- a/soxdial
+++ b/soxdial
@@ -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 {