]>
code.delx.au - pulseaudio/blob - polyp/pacat-simple.c
4 This file is part of polypaudio.
6 polypaudio is free software; you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published
8 by the Free Software Foundation; either version 2 of the License,
9 or (at your option) any later version.
11 polypaudio is distributed in the hope that it will be useful, but
12 WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with polypaudio; if not, write to the Free Software
18 Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
31 #include "polyplib-simple.h"
32 #include "polyplib-error.h"
36 int main(int argc
, char*argv
[]) {
37 static const struct pa_sample_spec ss
= {
38 .format
= PA_SAMPLE_S16LE
,
42 struct pa_simple
*s
= NULL
;
46 if (!(s
= pa_simple_new(NULL
, argv
[0], PA_STREAM_PLAYBACK
, NULL
, "playback", &ss
, NULL
, &error
))) {
47 fprintf(stderr
, __FILE__
": pa_simple_new() failed: %s\n", pa_strerror(error
));
55 if ((r
= read(STDIN_FILENO
, buf
, sizeof(buf
))) <= 0) {
59 fprintf(stderr
, __FILE__
": read() failed: %s\n", strerror(errno
));
63 if (pa_simple_write(s
, buf
, r
, &error
) < 0) {
64 fprintf(stderr
, __FILE__
": pa_simple_write() failed: %s\n", pa_strerror(error
));
69 /* Make sure that every single sample way played */
70 if (pa_simple_drain(s
, &error
) < 0) {
71 fprintf(stderr
, __FILE__
": pa_simple_drain() failed: %s\n", pa_strerror(error
));