diff options
author | Lennart Poettering <lennart@poettering.net> | 2004-08-17 17:17:22 +0000 |
---|---|---|
committer | Lennart Poettering <lennart@poettering.net> | 2004-08-17 17:17:22 +0000 |
commit | ca2265f37277081b4fe82e375923483c2e03931d (patch) | |
tree | 1766658296f7ea550e9148bd467e6d0a89781c10 /polyp/parec-simple.c | |
parent | f693aa4c8811b67377a4fcc55887d03876fb48be (diff) |
Documentation work
add pkg-config support for GLIB main loop
git-svn-id: file:///home/lennart/svn/public/pulseaudio/trunk@133 fefdeb5f-60dc-0310-8127-8f9354f1896f
Diffstat (limited to 'polyp/parec-simple.c')
-rw-r--r-- | polyp/parec-simple.c | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/polyp/parec-simple.c b/polyp/parec-simple.c index e12b8e00..74f0a0f7 100644 --- a/polyp/parec-simple.c +++ b/polyp/parec-simple.c @@ -33,6 +33,7 @@ #define BUFSIZE 1024 +/* A simple routine calling UNIX write() in a loop */ static ssize_t loop_write(int fd, const void*data, size_t size) { ssize_t ret = 0; @@ -54,6 +55,7 @@ static ssize_t loop_write(int fd, const void*data, size_t size) { } int main(int argc, char*argv[]) { + /* The sample type to use */ static const struct pa_sample_spec ss = { .format = PA_SAMPLE_S16LE, .rate = 44100, @@ -63,6 +65,7 @@ int main(int argc, char*argv[]) { int ret = 1; int error; + /* Create the recording stream */ if (!(s = pa_simple_new(NULL, argv[0], PA_STREAM_RECORD, NULL, "record", &ss, NULL, &error))) { fprintf(stderr, __FILE__": pa_simple_new() failed: %s\n", pa_strerror(error)); goto finish; @@ -72,11 +75,13 @@ int main(int argc, char*argv[]) { uint8_t buf[BUFSIZE]; ssize_t r; + /* Record some data ... */ if (pa_simple_read(s, buf, sizeof(buf), &error) < 0) { fprintf(stderr, __FILE__": pa_simple_read() failed: %s\n", pa_strerror(error)); goto finish; } - + + /* And write it to STDOUT */ if ((r = loop_write(STDOUT_FILENO, buf, sizeof(buf))) <= 0) { fprintf(stderr, __FILE__": write() failed: %s\n", strerror(errno)); goto finish; |