# HG changeset patch # User nenolod # Date 1144942337 25200 # Node ID 54b23650fac1271a7890654c2e661993f9ebd089 # Parent 5184f7737324554a24a41cfb8988d357db5d39f8 [svn] - experimental produce-audio changes via shd of the UADE team diff -r 5184f7737324 -r 54b23650fac1 audacious/output.c --- 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; + } }