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-08 19:59:19 -0400
commit041f0a71e0a6d695d498e9afdaf37744dc7e59fb (patch)
tree62c84d4f4932b06b0b967ac096c1d6b040acf75f
parent8bd615b9fe567b87472318ec859db0055b4ebd0e (diff)
downloadmisc-scripts-041f0a71e0a6d695d498e9afdaf37744dc7e59fb.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)$/) {