changeset 929:54b23650fac1 trunk

[svn] - experimental produce-audio changes via shd of the UADE team
author nenolod
date Thu, 13 Apr 2006 08:32:17 -0700
parents 5184f7737324
children 26faaefca088
files audacious/output.c
diffstat 1 files changed, 18 insertions(+), 6 deletions(-) [+]
line wrap: on
line diff
--- a/audacious/output.c	Wed Apr 12 19:53:19 2006 -0700
+++ b/audacious/output.c	Thu Apr 13 08:32:17 2006 -0700
@@ -356,6 +356,7 @@
     guint myorder = G_BYTE_ORDER == G_LITTLE_ENDIAN ? FMT_S16_LE : FMT_S16_BE;
     int caneq = (fmt == FMT_S16_NE || fmt == myorder);
     OutputPlugin *op = get_current_output_plugin();
+    int writeoffs;
 
     if (!caneq && cfg.equalizer_active) {    /* wrong byte order         */
         byteswap(length, ptr);               /*  so convert              */
@@ -380,12 +381,23 @@
     /* do vis plugin(s) */
     input_add_vis_pcm(time, fmt, nch, length, ptr);
 
-    while (op->buffer_free() < length) { /* wait output buf          */
-        if (going && !*going)            /*   thread stopped?        */
-            return;                      /*     so finish            */
+    writeoffs = 0;
+    while (writeoffs < length) {
+	int writable = length - writeoffs;
+
+	if (writable > 2048)
+	    writable = 2048;
 
-        g_usleep(10000);                 /*   else sleep for retry   */
-    }                                    
+	while (op->buffer_free() < writable) { /* wait output buf          */
+	    if (going && !*going)              /*   thread stopped?        */
+		return;                        /*     so finish            */
+
+	    g_usleep(10000);                   /*   else sleep for retry   */
+	}
 
-    op->write_audio(ptr, length);        /* do output                */
+	/* do output */
+	op->write_audio(((guint8 *) ptr) + writeoffs, writable);
+
+	writeoffs += writable;
+    }
 }