ref: 93a6c6ea96219101f0d57e38584971952d65b567
parent: 0141f233364b96bee00bee7463c494a981f50e55
author: robs <robs>
date: Sun Mar 16 16:49:56 EDT 2008
allow, e.g., -r 6k
--- a/src/sox.c
+++ b/src/sox.c
@@ -1367,12 +1367,16 @@
f->filetype++;
break;
- case 'r':
- if (sscanf(optarg, "%lf %c", &f->signal.rate, &dummy) != 1 || f->signal.rate <= 0) {
+ case 'r': {
+ char k = 0;
+ size_t n = sscanf(optarg, "%lf %c %c", &f->signal.rate, &k, &dummy);
+ if (n < 1 || f->signal.rate <= 0 || (n > 1 && k != 'k') || n > 2) {
sox_fail("Rate value `%s' is not a positive number", optarg);
exit(1);
}
+ f->signal.rate *= k == 'k'? 1000. : 1.;
break;
+ }
case 'v':
if (sscanf(optarg, "%lf %c", &f->volume, &dummy) != 1) {