diff options
author | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2007-08-26 08:32:39 +0000 |
---|---|---|
committer | Jacob Meuser <jakemsr@cvs.openbsd.org> | 2007-08-26 08:32:39 +0000 |
commit | 4b5bc1edf9dc6f6d46a9abe261201e882bd7ce6c (patch) | |
tree | 7732f79a2efa78ca8a184af3f929b2b8626b2618 /regress | |
parent | 03e2dc743caa490af3863d6a863288cfd7a23e31 (diff) |
add a function to trigger recording and use it for full-duplex mode
Diffstat (limited to 'regress')
-rw-r--r-- | regress/sys/dev/audio_rw/audiotest_rw.c | 22 |
1 files changed, 21 insertions, 1 deletions
diff --git a/regress/sys/dev/audio_rw/audiotest_rw.c b/regress/sys/dev/audio_rw/audiotest_rw.c index f2dd634009a..5aa6e0468de 100644 --- a/regress/sys/dev/audio_rw/audiotest_rw.c +++ b/regress/sys/dev/audio_rw/audiotest_rw.c @@ -1,4 +1,4 @@ -/* $OpenBSD: audiotest_rw.c,v 1.4 2007/07/31 03:34:13 jakemsr Exp $ */ +/* $OpenBSD: audiotest_rw.c,v 1.5 2007/08/26 08:32:38 jakemsr Exp $ */ /* * Copyright (c) 2007 Jacob Meuser <jakemsr@sdf.lonestar.org> @@ -37,6 +37,7 @@ extern char *__progname; void useage(void); int audio_set_duplex(int, char *, int); int audio_set_info(int, u_int, u_int, u_int, u_int, u_int); +int audio_trigger_record(int); int audio_wait_frame(int, u_int, int, int); int audio_do_frame(int, size_t , char *, char *, u_int, int, int); int audio_do_test(int, size_t, char *, char *, u_int, int, int, int, int); @@ -193,6 +194,21 @@ u_int precision; return 0; } +int +audio_trigger_record(int audio_fd) +{ +audio_info_t audio_if; + + AUDIO_INITINFO(&audio_if); + audio_if.record.pause = 0; + if (ioctl(audio_fd, AUDIO_SETINFO, &audio_if) < 0) { + warn("AUDIO_SETINFO: audio_if.record.pause = %d", + audio_if.record.pause); + return 1; + } + + return 0; +} /* return 0 on error, 1 if read, 2 if write, 3 if both read and write */ int @@ -601,6 +617,10 @@ extern int optind; warnx("buffer_size: %lu", (unsigned long)buffer_size); } + /* need to trigger recording in duplex mode */ + if (use_duplex && (mode & AUMODE_RECORD)) + if (audio_trigger_record(audio_fd)) + exit(1); if (audio_do_test(audio_fd, buffer_size, input_file, output_file, mode, use_poll, use_select, loops, verbose)) |