1
diff --git a/aplay/aplay.1 b/aplay/aplay.1
2
index b6caf0b..8cd1d56 100644
5
@@ -137,6 +137,10 @@ by typing aplay.
6
Record. This is the default if the program is invoked
9
+\fI\-i, \-\-interactive\fP
10
+Allow interactive operation via stdin.
11
+Currently only pause/resume via space key is implemented.
13
\fI\-\-disable\-resample\fP
14
Disable automatic rate resample.
16
diff --git a/aplay/aplay.c b/aplay/aplay.c
17
index c09f23c..04959b8 100644
20
@@ -103,6 +103,7 @@ static int avail_min = -1;
21
static int start_delay = 0;
22
static int stop_delay = 0;
23
static int monotonic = 0;
24
+static int interactive = 0;
25
static int can_pause = 0;
26
static int verbose = 0;
27
static int vumeter = VUMETER_NONE;
28
@@ -200,6 +201,7 @@ _("Usage: %s [OPTION]... [FILE]...\n"
29
"-v, --verbose show PCM structure and setup (accumulative)\n"
30
"-V, --vumeter=TYPE enable VU meter (TYPE: mono or stereo)\n"
31
"-I, --separate-channels one file for each channel\n"
32
+"-i, --interactive allow interactive operation from stdin\n"
33
" --disable-resample disable automatic rate resample\n"
34
" --disable-channels disable automatic channel conversions\n"
35
" --disable-format disable automatic format conversions\n"
36
@@ -404,7 +406,7 @@ enum {
37
int main(int argc, char *argv[])
40
- static const char short_options[] = "hnlLD:qt:c:f:r:d:MNF:A:R:T:B:vV:IPC";
41
+ static const char short_options[] = "hnlLD:qt:c:f:r:d:MNF:A:R:T:B:vV:IPCi";
42
static const struct option long_options[] = {
44
{"version", 0, 0, OPT_VERSION},
45
@@ -442,6 +444,7 @@ int main(int argc, char *argv[])
46
{"max-file-time", 1, 0, OPT_MAX_FILE_TIME},
47
{"process-id-file", 1, 0, OPT_PROCESS_ID_FILE},
48
{"use-strftime", 0, 0, OPT_USE_STRFTIME},
49
+ {"interactive", 0, 0, 'i'},
52
char *pcm_name = "default";
53
@@ -608,6 +611,9 @@ int main(int argc, char *argv[])
54
if (file_type == FORMAT_DEFAULT)
55
file_type = FORMAT_WAVE;
60
case OPT_DISABLE_RESAMPLE:
61
open_mode |= SND_PCM_NO_AUTO_RESAMPLE;
63
@@ -1206,6 +1212,8 @@ static void init_stdin(void)
69
tcgetattr(fileno(stdin), &term);
70
term_c_lflag = term.c_lflag;
71
if (fd == fileno(stdin))
72
@@ -1221,6 +1229,8 @@ static void done_stdin(void)
78
if (fd == fileno(stdin) || term_c_lflag == -1)
80
tcgetattr(fileno(stdin), &term);
81
@@ -1258,6 +1268,8 @@ static void check_stdin(void)
87
if (fd != fileno(stdin)) {
88
while (read(fileno(stdin), &b, 1) == 1) {
89
if (b == ' ' || b == '\r') {