Index: app/audio.c
--- app/audio.c.orig
+++ app/audio.c
@@ -53,6 +53,11 @@
 #include "tracer.h"
 #include "xm-player.h"
 
+#ifdef DRIVER_SNDIO
+#include <sndio.h>
+void * sndio_driver_get_hdl(void *);
+#endif
+
 st_mixer* mixer = NULL;
 st_driver* playback_driver = NULL;
 st_driver* editing_driver = NULL;
@@ -473,6 +478,10 @@ audio_thread(void)
     void* b;
     float af;
 
+#ifdef DRIVER_SNDIO
+    struct sio_hdl *hdl;
+#endif
+
     audio_raise_priority();
 
 loop:
@@ -480,10 +489,27 @@ loop:
 
     for (pl = inputs, npl = 1; pl; pl = pl->next, npl++) {
         pi = pl->data;
+
+#ifdef DRIVER_SNDIO
+	if (pi->fd == -1) {
+	    hdl = sndio_driver_get_hdl(pi->data);
+	    if (!hdl || !(pi->condition & GDK_INPUT_WRITE)) {
+	        inputs = g_list_remove(inputs, pi);
+	        goto loop;
+	    }
+	    if (sio_nfds(hdl) != 1) {
+		printf("too many sndio file handles\n");
+	    } else {
+		sio_pollfd(hdl, &pfd[npl], POLLOUT);
+	    }
+	    continue;
+	}
+#else
         if (pi->fd == -1) {
             inputs = g_list_remove(inputs, pi);
             goto loop;
         }
+#endif
         pfd[npl].events = pfd[npl].revents = 0;
         pfd[npl].fd = pi->fd;
         if (pi->condition & GDK_INPUT_READ)
@@ -579,8 +605,20 @@ loop:
 
     for (pl = inputs, i = 1; i < npl; pl = pl->next, i++) {
         pi = pl->data;
+#ifdef DRIVER_SNDIO
+		if(pi->fd == -1) {
+		    hdl = sndio_driver_get_hdl(pi->data);
+		    if (hdl && (pi->condition & GDK_INPUT_WRITE)) {
+			pfd[i].revents = sio_revents(hdl, &pfd[i]);
+		    } else {
+			continue;
+		    }
+		    pfd[i].events = POLLOUT;
+		}
+#else
         if (pi->fd == -1)
             continue;
+#endif
         if (pfd[i].revents & pfd[i].events) {
             int x = 0;
             if (pfd[i].revents & POLLIN)
