From e7a3408bb1381cb464c24663c19125dca70e2ced Mon Sep 17 00:00:00 2001 From: P. J. McDermott Date: Sat, 01 Oct 2022 11:09:07 -0400 Subject: bin/snd-pcm-open.c: Add --- (limited to 'bin') diff --git a/bin/snd-pcm-open.c b/bin/snd-pcm-open.c new file mode 100644 index 0000000..abda286 --- /dev/null +++ b/bin/snd-pcm-open.c @@ -0,0 +1,27 @@ +#include +#include +#include + +int +main(int argc __attribute__((__unused__)), + char *argv[] __attribute__((__unused__))) +{ + int e; + snd_pcm_t *pcm; + + e = snd_pcm_open(&pcm, "default", SND_PCM_STREAM_PLAYBACK, 0); + if (e < 0) { + fprintf(stderr, "Failed to open PCM: %s\n", snd_strerror(e)); + return EXIT_FAILURE; + } + + pause(); + + e = snd_pcm_close(pcm); + if (e < 0) { + fprintf(stderr, "Failed to close PCM: %s\n", snd_strerror(e)); + return EXIT_FAILURE; + } + + return EXIT_SUCCESS; +} -- cgit v0.9.1