aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorB. Watson <urchlay@slackware.uk>2024-04-08 19:59:19 -0400
committerB. Watson <urchlay@slackware.uk>2024-04-11 16:52:47 -0400
commit519efa932da5688f3603628d7136a46421d95681 (patch)
tree3b7dd51f53ede694699ecaf8adcb52f4388e7029
parent4367691d8d69319a44c538fff976cb7c4e10079d (diff)
downloadsoxdial-519efa932da5688f3603628d7136a46421d95681.tar.gz
soxdial: don't allow stereo/left/right after a dial string.
-rwxr-xr-xsoxdial7
1 files changed, 7 insertions, 0 deletions
diff --git a/soxdial b/soxdial
index 00f874d..1efc344 100755
--- a/soxdial
+++ b/soxdial
@@ -430,6 +430,10 @@ sub parse_rate {
return $_;
}
+sub check_stereo {
+ die "$SELF: can't enable stereo after a dial string.\n" if @sox_subcmds;
+}
+
# main()
if(system("sox --version > /dev/null 2>&1") != 0) {
die "$SELF: can't execute sox, is it installed?\n";
@@ -508,11 +512,14 @@ for ($argc = 0; $argc < @ARGV; $argc++) {
} elsif(/^--?s(?:ilence)?$/) {
push @sox_subcmds, silence_subcmd(parse_sec($ARGV[++$argc]));
} elsif(/^--?(?:S|stereo)$/) {
+ check_stereo();
$stereo = 1;
} elsif(/^--?(?:L|left)$/) {
+ check_stereo();
$right = 0;
$stereo = $left = 1;
} elsif(/^--?(?:R|right)$/) {
+ check_stereo();
$left = 0;
$stereo = $right = 1;
} elsif(/^--?(?:X|random)$/) {