PulseAudio example
PulseAudio APIs pa_simple_new pa_simple_write pa_simple_drain pa_simple_free https://freedesktop.org/software/pulseaudio/doxygen/examples.html build command gcc -o pulse pulse.c `pkg-config --cflags --libs libpulse-simple` source #ifdef HAVE_CONFIG_H #include <config.h> #endif #include <stdio.h> #include <unistd.h> #include <string.h> #include <errno.h> #include <fcntl.h> #include <pulse/simple.h> #include <pulse/error.h> #define BUFSIZE 1024 int main(int argc, char* argv[]) { /* The Sample format to use */ static const pa_sample_spec ss = { .format = PA_SAMPLE_S16LE, .rate = 44100, .channels = 2}; pa_simple* s = NULL; int ret = 1; int error; /* replace STDIN with the specified file if needed */ if (argc > 1) { int fd; if ((fd = open(argv[1], O_RDONLY)) < 0) { fprintf(stderr, __FILE__ ": open() failed: %s\n", strerror(errno)); goto finish; } if (dup2(fd, STDIN_