summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rwxr-xr-x.gitignore.d/fluxbox2
-rwxr-xr-x.xinitrc.d/snd-pcm-open8
-rw-r--r--bin/snd-pcm-open.c27
3 files changed, 37 insertions, 0 deletions
diff --git a/.gitignore.d/fluxbox b/.gitignore.d/fluxbox
index 6d56015..cf9e573 100755
--- a/.gitignore.d/fluxbox
+++ b/.gitignore.d/fluxbox
@@ -18,9 +18,11 @@
!/.xinitrc
!/.xinitrc.d/
!/.xinitrc.d/.placeholder
+!/.xinitrc.d/snd-pcm-open
!/.xsession
!/bin/
!/bin/bright
+!/bin/snd-pcm-open.c
!/bin/xsession
!/lib/
!/lib/panel/
diff --git a/.xinitrc.d/snd-pcm-open b/.xinitrc.d/snd-pcm-open
new file mode 100755
index 0000000..7d15ee3
--- /dev/null
+++ b/.xinitrc.d/snd-pcm-open
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+if ! [ -e bin/snd-pcm-open ] && [ -e bin/snd-pcm-open.c ]; then
+ gcc -Wall -Wextra -pedantic -o bin/snd-pcm-open bin/snd-pcm-open.c \
+ -lasound
+fi
+
+bin/snd-pcm-open &
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;
+}