Index: roard/driver_portaudio.c
===================================================================
--- roard/driver_portaudio.c	(revision 3751)
+++ roard/driver_portaudio.c	(revision 3869)
@@ -33,4 +33,7 @@
 #ifdef ROAR_HAVE_LIBPABLIO
  long flags = PABLIO_WRITE;
+#elif defined(ROAR_HAVE_LIBPORTAUDIO_V0_19)
+ PaError err;
+ PaStreamParameters params;
 #endif
 
@@ -102,4 +105,42 @@
 
  return 0;
+#elif defined(ROAR_HAVE_LIBPORTAUDIO_V0_19)
+ params.device                    = Pa_GetDefaultOutputDevice();
+ params.channelCount              = info->channels;
+ params.sampleFormat              = fmt;
+ params.suggestedLatency          = Pa_GetDeviceInfo(params.device)->defaultLowOutputLatency;
+ params.hostApiSpecificStreamInfo = NULL;
+
+ // TODO: FIXME: use libroar for this.
+ self->framesize = info->bits * info->channels / 8;
+
+ // Sets up blocking I/O stream.
+#if 0
+ err = Pa_OpenStream(&(self->stream),
+                     NULL,
+                     &params,
+                     info->rate,
+                     128 /*FIXME:frames*/,
+                     paClipOff,
+                     NULL,
+                     NULL
+                    );
+#endif
+
+ if ( err != paNoError ) {
+  ROAR_ERR("driver_portaudio_open(*): Could not open PortAudio device: \"%s\".", Pa_GetErrorText(err));
+  roar_mm_free(self);
+  return -1;
+ }
+
+ err = Pa_StartStream(self->stream);
+
+ if ( err != paNoError ) {
+  ROAR_ERR("driver_portaudio_open(*): Could not start stream: \"%s\".", Pa_GetErrorText(err));
+  roar_mm_free(self);
+  return -1;
+ }
+
+ return 0;
 #else
  return -1;
@@ -110,4 +151,6 @@
  struct driver_portaudio * self = vio->inst;
 
+ // TODO: cleanup common code.
+
 #ifdef ROAR_HAVE_LIBPABLIO
  CloseAudioStream(self->ostream);
@@ -116,4 +159,15 @@
 
  roar_mm_free(self);
+
+ return 0;
+#elif defined(ROAR_HAVE_LIBPORTAUDIO_V0_19)
+ if ( (self != NULL) && (self->stream != NULL) ) {
+  Pa_StopStream(self->stream);
+  Pa_CloseStream(self->stream);
+ }
+
+ roar_mm_free(self);
+
+ Pa_Terminate();
 
  return 0;
@@ -132,4 +186,18 @@
  ROAR_DBG("driver_portaudio_write(vio=%p, buf=%p, count=%llu) = ? // PABLIO mode", vio, buf, (long long unsigned int)count);
  return WriteAudioStream(self->ostream, buf, count) * self->ostream->bytesPerFrame;
+#elif defined(ROAR_HAVE_LIBPORTAUDIO_V0_19)
+ size_t write_frames = count / self->framesize;
+ PaError err;
+
+ ROAR_DBG("driver_portaudio_write(vio=%p, buf=%p, size=%llu) = ?", vio, buf, (long long unsigned int)size);
+
+ // I'm not 100% sure if you could write arbitrary number of frames to Pa_WriteStream(), but it seems to be backend dependent.
+ err = Pa_WriteStream(self->stream, buf, write_frames);
+
+ if ( err < 0 && err != paOutputUnderflowed )
+  return -1;
+
+ // PA always seems to write requested size, or it will error out.
+ return count;
 #else
  return -1;
Index: roard/include/driver_portaudio.h
===================================================================
--- roard/include/driver_portaudio.h	(revision 3751)
+++ roard/include/driver_portaudio.h	(revision 3869)
@@ -27,6 +27,9 @@
 #define _DRIVER_PORTAUDIO_H_
 
+//#undef ROAR_HAVE_LIBPABLIO
+//#define ROAR_HAVE_LIBPORTAUDIO_V0_19
+
 #ifdef ROAR_HAVE_LIBPORTAUDIO
-#if defined(ROAR_HAVE_LIBPABLIO)
+#if defined(ROAR_HAVE_LIBPABLIO) || defined(ROAR_HAVE_LIBPORTAUDIO_V0_19)
 #define _DRIVER_PORTAUDIO_CAN_OPERATE
 #endif
@@ -38,6 +41,33 @@
 #ifdef ROAR_HAVE_LIBPABLIO
  PABLIO_Stream * ostream;
+#elif defined(ROAR_HAVE_LIBPORTAUDIO_V0_19)
+ PaStream *stream;
+ int framesize;
 #endif
 };
+
+typedef struct {
+/*
+ params.device                    = Pa_GetDefaultOutputDevice();
+ params.channelCount              = info->channels;
+ params.sampleFormat              = fmt;
+ params.suggestedLatency          = Pa_GetDeviceInfo(params.device)->defaultLowOutputLatency;
+ params.hostApiSpecificStreamInfo = NULL;
+*/
+ void * device;
+ int channelCount;
+ PaSampleFormat sampleFormat;
+ int suggestedLatency;
+ void * hostApiSpecificStreamInfo;
+} PaStreamParameters;
+
+#define paOutputUnderflowed -1
+
+void *  Pa_GetDefaultOutputDevice(void);
+// Pa_WriteStream(device->stream, buf, write_frames);
+PaError  Pa_WriteStream(PaStream * stream, void *, size_t);
+PaError Pa_StartStream(PaStream * stream);
+PaError Pa_StopStream(PaStream * stream);
+PaError Pa_CloseStream(PaStream * stream);
 
 int driver_portaudio_open(struct roar_vio_calls * inst, char * device, struct roar_audio_info * info, int fh, struct roar_stream_server * sstream);
