summaryrefslogtreecommitdiffstats
path: root/bin
diff options
context:
space:
mode:
authorP. J. McDermott <pj@pehjota.net>2022-10-01 11:09:07 (EDT)
committer P. J. McDermott <pj@pehjota.net>2022-10-01 11:09:07 (EDT)
commite7a3408bb1381cb464c24663c19125dca70e2ced (patch)
tree11bc224e5d5e8e83c1d720bc0605be0aabb18716 /bin
parent86787984c637871f005d372e51f0b85d5521c026 (diff)
downloadfluxbox-host/alsvid3.zip
fluxbox-host/alsvid3.tar.gz
fluxbox-host/alsvid3.tar.bz2
bin/snd-pcm-open.c: Addhost/alsvid3
Diffstat (limited to 'bin')
-rw-r--r--bin/snd-pcm-open.c27
1 files changed, 27 insertions, 0 deletions
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 <alsa/asoundlib.h>
+#include <stdio.h>
+#include <stdlib.h>
+
+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;
+}