added PCM_NONBLOCK macro
diff --git a/src/pcm.c b/src/pcm.c
index ef38c9c..7a67cfe 100644
--- a/src/pcm.c
+++ b/src/pcm.c
@@ -818,9 +818,13 @@
     snprintf(fn, sizeof(fn), "/dev/snd/pcmC%uD%u%c", card, device,
              flags & PCM_IN ? 'c' : 'p');
 
-    fd = open(fn, O_RDWR);
+    if (flags & PCM_NONBLOCK)
+        fd = open(fn, O_RDWR | O_NONBLOCK);
+    else
+        fd = open(fn, O_RDWR);
+
     if (fd < 0) {
-        fprintf(stderr, "cannot open device '%s'\n", fn);
+        fprintf(stderr, "cannot open device '%s': %s\n", fn, strerror(errno));
         goto err_open;
     }
 
@@ -1073,7 +1077,12 @@
              flags & PCM_IN ? 'c' : 'p');
 
     pcm->flags = flags;
-    pcm->fd = open(fn, O_RDWR);
+
+    if (flags & PCM_NONBLOCK)
+        pcm->fd = open(fn, O_RDWR | O_NONBLOCK);
+    else
+        pcm->fd = open(fn, O_RDWR);
+
     if (pcm->fd < 0) {
         oops(pcm, errno, "cannot open device '%s'", fn);
         return pcm;