Skip to content

Commit fcd7c9d

Browse files
committed
dsp.c: Allow forcing interactive mode.
1 parent d54219f commit fcd7c9d

File tree

2 files changed

+12
-5
lines changed

2 files changed

+12
-5
lines changed

README.md

+1
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ Flag | Description
4747
`-h` | Show help text.
4848
`-b frames` | Set buffer size (must be specified before the first input).
4949
`-R ratio` | Set codec maximum buffer ratio (must be specified before the first input).
50+
`-i` | Force interactive mode.
5051
`-I` | Disable interactive mode.
5152
`-q` | Disable progress display.
5253
`-s` | Silent mode.

dsp.c

+11-5
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,7 @@ static const char usage[] =
3636
" -h show this help\n"
3737
" -b frames set buffer size (must be specified before the first input)\n"
3838
" -R ratio set codec maximum buffer ratio (must be specified before the first input)\n"
39+
" -i force interactive mode\n"
3940
" -I disable interactive mode\n"
4041
" -q disable progress display\n"
4142
" -s silent mode\n"
@@ -145,7 +146,7 @@ static int parse_codec_params(int argc, char *argv[], int *mode, char **path, ch
145146
*channels = *fs = -1;
146147
*mode = CODEC_MODE_READ;
147148

148-
while ((opt = getopt(argc, argv, "+:hb:R:IqsvdDpVSot:e:BLNr:c:n")) != -1) {
149+
while ((opt = getopt(argc, argv, "+:hb:R:iIqsvdDpVSot:e:BLNr:c:n")) != -1) {
149150
switch (opt) {
150151
case 'h':
151152
print_usage();
@@ -172,6 +173,9 @@ static int parse_codec_params(int argc, char *argv[], int *mode, char **path, ch
172173
else
173174
LOG(LL_ERROR, "dsp: warning: buffer ratio must be specified before the first input\n");
174175
break;
176+
case 'i':
177+
interactive = 1;
178+
break;
175179
case 'I':
176180
interactive = 0;
177181
break;
@@ -405,10 +409,12 @@ int main(int argc, char *argv[])
405409
if (LOGLEVEL(LL_NORMAL))
406410
print_io_info(out_codec, "output");
407411

408-
if (interactive == -1 && out_codec->interactive)
409-
interactive = 1;
410-
else
411-
interactive = 0;
412+
if (interactive == -1) {
413+
if (out_codec->interactive)
414+
interactive = 1;
415+
else
416+
interactive = 0;
417+
}
412418

413419
buf1 = calloc(ceil(dsp_globals.buf_frames * in_codecs.head->channels * get_effects_chain_max_ratio(&chain)), sizeof(sample_t));
414420
buf2 = calloc(ceil(dsp_globals.buf_frames * in_codecs.head->channels * get_effects_chain_max_ratio(&chain)), sizeof(sample_t));

0 commit comments

Comments
 (0)