changeset 1703:6f939852584b

Automated merge with ssh://hg.atheme.org//hg/audacious-plugins-tc
author William Pitcock <nenolod@atheme.org>
date Tue, 11 Sep 2007 09:15:24 -0500
parents 2e8adf61c54f (diff) cecf5f34a671 (current diff)
children a8e2403a32b5
files src/filewriter/filewriter.c
diffstat 9 files changed, 142 insertions(+), 595 deletions(-) [+]
line wrap: on
line diff
--- a/src/OSS/audio.c	Tue Sep 11 02:28:47 2007 +0300
+++ b/src/OSS/audio.c	Tue Sep 11 09:15:24 2007 -0500
@@ -47,7 +47,7 @@
 static gint fragsize, device_buffer_size;
 static gchar *device_name;
 static GThread *buffer_thread;
-static gboolean realtime, select_works;
+static gboolean select_works;
 
 static int (*oss_convert_func) (void **data, int length);
 static int (*oss_stereo_convert_func) (void **data, int length, int fmt);
@@ -197,8 +197,6 @@
     if (!fd || !going)
         return 0;
 
-    if (realtime)
-        oss_calc_device_buffer_used();
     bytes = output_bytes < device_buffer_used ?
         0 : output_bytes - device_buffer_used;
 
@@ -208,13 +206,10 @@
 static int
 oss_used(void)
 {
-    if (realtime)
-        return 0;
-    else {
-        if (wr_index >= rd_index)
-            return wr_index - rd_index;
-        return buffer_size - (rd_index - wr_index);
-    }
+    if (wr_index >= rd_index)
+        return wr_index - rd_index;
+
+    return buffer_size - (rd_index - wr_index);
 }
 
 gint
@@ -222,8 +217,6 @@
 {
     if (!going)
         return 0;
-    if (realtime)
-        oss_calc_device_buffer_used();
     if (!oss_used() && (device_buffer_used - (3 * blk_size)) <= 0)
         return FALSE;
 
@@ -233,22 +226,18 @@
 gint
 oss_free(void)
 {
-    if (!realtime) {
-        if (remove_prebuffer && prebuffer) {
-            prebuffer = FALSE;
-            remove_prebuffer = FALSE;
-        }
-        if (prebuffer)
-            remove_prebuffer = TRUE;
+    if (remove_prebuffer && prebuffer) {
+        prebuffer = FALSE;
+        remove_prebuffer = FALSE;
+    }
 
-        if (rd_index > wr_index)
-            return (rd_index - wr_index) - device_buffer_size - 1;
-        return (buffer_size - (wr_index - rd_index)) - device_buffer_size - 1;
-    }
-    else if (paused)
-        return 0;
-    else
-        return 1000000;
+    if (prebuffer)
+        remove_prebuffer = TRUE;
+
+    if (rd_index > wr_index)
+        return (rd_index - wr_index) - device_buffer_size - 1;
+
+    return (buffer_size - (wr_index - rd_index)) - device_buffer_size - 1;
 }
 
 static inline ssize_t
@@ -274,42 +263,6 @@
 {
 
     audio_buf_info abuf_info;
-#if 0
-    AFormat new_format;
-    int new_frequency, new_channels;
-    EffectPlugin *ep;
-
-    new_format = input.format.xmms;
-    new_frequency = input.frequency;
-    new_channels = input.channels;
-
-
-    ep = get_current_effect_plugin();
-    if (effects_enabled() && ep && ep->query_format) {
-        ep->query_format(&new_format, &new_frequency, &new_channels);
-    }
-
-    if (new_format != effect.format.xmms ||
-        new_frequency != effect.frequency ||
-        new_channels != effect.channels) {
-        output_time_offset += (output_bytes * 1000) / output.bps;
-        output_bytes = 0;
-        close(fd);
-        fd = open(device_name, O_WRONLY);
-        oss_setup_format(new_format, new_frequency, new_channels);
-    }
-    if (effects_enabled() && ep && ep->mod_samples)
-        length = ep->mod_samples(&data, length,
-                                 input.format.xmms,
-                                 input.frequency, input.channels);
-#endif
-    if (realtime && !ioctl(fd, SNDCTL_DSP_GETOSPACE, &abuf_info)) {
-        while (abuf_info.bytes < length) {
-            g_usleep(10000);
-            if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &abuf_info))
-                break;
-        }
-    }
 
     if (oss_convert_func != NULL)
         length = oss_convert_func(&data, length);
@@ -465,23 +418,15 @@
 {
     int cnt, off = 0;
 
-    if (!realtime) {
-        remove_prebuffer = FALSE;
+    remove_prebuffer = FALSE;
 
-        written += length;
-        while (length > 0) {
-            cnt = MIN(length, buffer_size - wr_index);
-            memcpy(buffer + wr_index, (char *) ptr + off, cnt);
-            wr_index = (wr_index + cnt) % buffer_size;
-            length -= cnt;
-            off += cnt;
-        }
-    }
-    else {
-        if (paused)
-            return;
-        oss_write_audio(ptr, length);
-        written += length;
+    written += length;
+    while (length > 0) {
+        cnt = MIN(length, buffer_size - wr_index);
+        memcpy(buffer + wr_index, (char *) ptr + off, cnt);
+        wr_index = (wr_index + cnt) % buffer_size;
+        length -= cnt;
+        off += cnt;
     }
 }
 
@@ -491,12 +436,9 @@
     if (!going)
         return;
     going = 0;
-    if (!realtime)
-        g_thread_join(buffer_thread);
-    else {
-        ioctl(fd, SNDCTL_DSP_RESET, 0);
-        close(fd);
-    }
+
+    g_thread_join(buffer_thread);
+
     g_free(device_name);
     oss_free_convert_buffer();
     wr_index = 0;
@@ -508,34 +450,18 @@
 void
 oss_flush(gint time)
 {
-    if (!realtime) {
-        flush = time;
-        while (flush != -1)
-            g_usleep(10000);
-    }
-    else {
-        ioctl(fd, SNDCTL_DSP_RESET, 0);
-        close(fd);
-        fd = open(device_name, O_WRONLY);
-        oss_set_audio_params();
-        output_time_offset = time;
-        written = ((guint64) time * input.bps) / 1000;
-        output_bytes = 0;
-    }
+    flush = time;
+    while (flush != -1)
+        g_usleep(10000);
 }
 
 void
 oss_pause(short p)
 {
-    if (!realtime) {
-        if (p == TRUE)
-            do_pause = TRUE;
-        else
-            unpause = TRUE;
-    }
+    if (p == TRUE)
+        do_pause = TRUE;
     else
-        paused = p;
-
+        unpause = TRUE;
 }
 
 gpointer
@@ -694,19 +620,18 @@
 
     oss_setup_format(fmt, rate, nch);
 
-    realtime = xmms_check_realtime_priority();
+    buffer_size = (oss_cfg.buffer_size * input.bps) / 1000;
+
+    if (buffer_size < 8192)
+        buffer_size = 8192;
 
-    if (!realtime) {
-        buffer_size = (oss_cfg.buffer_size * input.bps) / 1000;
-        if (buffer_size < 8192)
-            buffer_size = 8192;
-        prebuffer_size = (buffer_size * oss_cfg.prebuffer) / 100;
-        if (buffer_size - prebuffer_size < 4096)
-            prebuffer_size = buffer_size - 4096;
+    prebuffer_size = (buffer_size * oss_cfg.prebuffer) / 100;
+    if (buffer_size - prebuffer_size < 4096)
+        prebuffer_size = buffer_size - 4096;
 
-        buffer_size += device_buffer_size;
-        buffer = g_malloc0(buffer_size);
-    }
+    buffer_size += device_buffer_size;
+    buffer = g_malloc0(buffer_size);
+
     flush = -1;
     prebuffer = TRUE;
     wr_index = rd_index = output_time_offset = written = output_bytes = 0;
@@ -716,8 +641,9 @@
     remove_prebuffer = FALSE;
 
     going = 1;
-    if (!realtime)
-        buffer_thread = g_thread_create(oss_loop, NULL, TRUE, NULL);
+
+    buffer_thread = g_thread_create(oss_loop, NULL, TRUE, NULL);
+
     return 1;
 }
 
--- a/src/OSS4/audio.c	Tue Sep 11 02:28:47 2007 +0300
+++ b/src/OSS4/audio.c	Tue Sep 11 09:15:24 2007 -0500
@@ -47,7 +47,7 @@
 static gint fragsize, device_buffer_size;
 static gchar *device_name;
 static GThread *buffer_thread;
-static gboolean realtime, select_works;
+static gboolean select_works;
 
 static int (*oss_convert_func) (void **data, int length);
 static int (*oss_stereo_convert_func) (void **data, int length, int fmt);
@@ -197,8 +197,6 @@
     if (!fd || !going)
         return 0;
 
-    if (realtime)
-        oss_calc_device_buffer_used();
     bytes = output_bytes < device_buffer_used ?
         0 : output_bytes - device_buffer_used;
 
@@ -208,13 +206,10 @@
 static int
 oss_used(void)
 {
-    if (realtime)
-        return 0;
-    else {
-        if (wr_index >= rd_index)
-            return wr_index - rd_index;
-        return buffer_size - (rd_index - wr_index);
-    }
+    if (wr_index >= rd_index)
+        return wr_index - rd_index;
+
+    return buffer_size - (rd_index - wr_index);
 }
 
 gint
@@ -222,8 +217,6 @@
 {
     if (!going)
         return 0;
-    if (realtime)
-        oss_calc_device_buffer_used();
     if (!oss_used() && (device_buffer_used - (3 * blk_size)) <= 0)
         return FALSE;
 
@@ -233,22 +226,18 @@
 gint
 oss_free(void)
 {
-    if (!realtime) {
-        if (remove_prebuffer && prebuffer) {
-            prebuffer = FALSE;
-            remove_prebuffer = FALSE;
-        }
-        if (prebuffer)
-            remove_prebuffer = TRUE;
+    if (remove_prebuffer && prebuffer) {
+        prebuffer = FALSE;
+        remove_prebuffer = FALSE;
+    }
 
-        if (rd_index > wr_index)
-            return (rd_index - wr_index) - device_buffer_size - 1;
-        return (buffer_size - (wr_index - rd_index)) - device_buffer_size - 1;
-    }
-    else if (paused)
-        return 0;
-    else
-        return 1000000;
+    if (prebuffer)
+        remove_prebuffer = TRUE;
+
+    if (rd_index > wr_index)
+        return (rd_index - wr_index) - device_buffer_size - 1;
+
+    return (buffer_size - (wr_index - rd_index)) - device_buffer_size - 1;
 }
 
 static inline ssize_t
@@ -274,42 +263,6 @@
 {
 
     audio_buf_info abuf_info;
-#if 0
-    AFormat new_format;
-    int new_frequency, new_channels;
-    EffectPlugin *ep;
-
-    new_format = input.format.xmms;
-    new_frequency = input.frequency;
-    new_channels = input.channels;
-
-
-    ep = get_current_effect_plugin();
-    if (effects_enabled() && ep && ep->query_format) {
-        ep->query_format(&new_format, &new_frequency, &new_channels);
-    }
-
-    if (new_format != effect.format.xmms ||
-        new_frequency != effect.frequency ||
-        new_channels != effect.channels) {
-        output_time_offset += (output_bytes * 1000) / output.bps;
-        output_bytes = 0;
-        close(fd);
-        fd = open(device_name, O_WRONLY);
-        oss_setup_format(new_format, new_frequency, new_channels);
-    }
-    if (effects_enabled() && ep && ep->mod_samples)
-        length = ep->mod_samples(&data, length,
-                                 input.format.xmms,
-                                 input.frequency, input.channels);
-#endif
-    if (realtime && !ioctl(fd, SNDCTL_DSP_GETOSPACE, &abuf_info)) {
-        while (abuf_info.bytes < length) {
-            g_usleep(10000);
-            if (ioctl(fd, SNDCTL_DSP_GETOSPACE, &abuf_info))
-                break;
-        }
-    }
 
     if (oss_convert_func != NULL)
         length = oss_convert_func(&data, length);
@@ -465,23 +418,15 @@
 {
     int cnt, off = 0;
 
-    if (!realtime) {
-        remove_prebuffer = FALSE;
+    remove_prebuffer = FALSE;
 
-        written += length;
-        while (length > 0) {
-            cnt = MIN(length, buffer_size - wr_index);
-            memcpy(buffer + wr_index, (char *) ptr + off, cnt);
-            wr_index = (wr_index + cnt) % buffer_size;
-            length -= cnt;
-            off += cnt;
-        }
-    }
-    else {
-        if (paused)
-            return;
-        oss_write_audio(ptr, length);
-        written += length;
+    written += length;
+    while (length > 0) {
+        cnt = MIN(length, buffer_size - wr_index);
+        memcpy(buffer + wr_index, (char *) ptr + off, cnt);
+        wr_index = (wr_index + cnt) % buffer_size;
+        length -= cnt;
+        off += cnt;
     }
 }
 
@@ -491,12 +436,9 @@
     if (!going)
         return;
     going = 0;
-    if (!realtime)
-        g_thread_join(buffer_thread);
-    else {
-        ioctl(fd, SNDCTL_DSP_RESET, 0);
-        close(fd);
-    }
+
+    g_thread_join(buffer_thread);
+
     g_free(device_name);
     oss_free_convert_buffer();
     wr_index = 0;
@@ -508,34 +450,18 @@
 void
 oss_flush(gint time)
 {
-    if (!realtime) {
-        flush = time;
-        while (flush != -1)
-            g_usleep(10000);
-    }
-    else {
-        ioctl(fd, SNDCTL_DSP_RESET, 0);
-        close(fd);
-        fd = open(device_name, O_WRONLY);
-        oss_set_audio_params();
-        output_time_offset = time;
-        written = ((guint64) time * input.bps) / 1000;
-        output_bytes = 0;
-    }
+    flush = time;
+    while (flush != -1)
+        g_usleep(10000);
 }
 
 void
 oss_pause(short p)
 {
-    if (!realtime) {
-        if (p == TRUE)
-            do_pause = TRUE;
-        else
-            unpause = TRUE;
-    }
+    if (p == TRUE)
+        do_pause = TRUE;
     else
-        paused = p;
-
+        unpause = TRUE;
 }
 
 gpointer
@@ -694,19 +620,18 @@
 
     oss_setup_format(fmt, rate, nch);
 
-    realtime = xmms_check_realtime_priority();
+    buffer_size = (oss_cfg.buffer_size * input.bps) / 1000;
+
+    if (buffer_size < 8192)
+        buffer_size = 8192;
 
-    if (!realtime) {
-        buffer_size = (oss_cfg.buffer_size * input.bps) / 1000;
-        if (buffer_size < 8192)
-            buffer_size = 8192;
-        prebuffer_size = (buffer_size * oss_cfg.prebuffer) / 100;
-        if (buffer_size - prebuffer_size < 4096)
-            prebuffer_size = buffer_size - 4096;
+    prebuffer_size = (buffer_size * oss_cfg.prebuffer) / 100;
+    if (buffer_size - prebuffer_size < 4096)
+        prebuffer_size = buffer_size - 4096;
 
-        buffer_size += device_buffer_size;
-        buffer = g_malloc0(buffer_size);
-    }
+    buffer_size += device_buffer_size;
+    buffer = g_malloc0(buffer_size);
+
     flush = -1;
     prebuffer = TRUE;
     wr_index = rd_index = output_time_offset = written = output_bytes = 0;
@@ -716,8 +641,9 @@
     remove_prebuffer = FALSE;
 
     going = 1;
-    if (!realtime)
-        buffer_thread = g_thread_create(oss_loop, NULL, TRUE, NULL);
+
+    buffer_thread = g_thread_create(oss_loop, NULL, TRUE, NULL);
+
     return 1;
 }
 
--- a/src/alsa/audio.c	Tue Sep 11 02:28:47 2007 +0300
+++ b/src/alsa/audio.c	Tue Sep 11 09:15:24 2007 -0500
@@ -708,36 +708,6 @@
 	if (paused)
 		return;
 
-#if 0
-	new_freq = inputf->rate;
-	new_chn = inputf->channels;
-	f = inputf->xmms_format;
-
-	if (effects_enabled() && (ep = get_current_effect_plugin()) &&
-	    ep->query_format)
-		ep->query_format(&f, &new_freq, &new_chn);
-
-	if (f != effectf->xmms_format || (unsigned int)new_freq != effectf->rate ||
-	    (unsigned int)new_chn != effectf->channels)
-	{
-		debug("Changing audio format for effect plugin");
-		g_free(effectf);
-		effectf = snd_format_from_xmms(f, new_freq, new_chn);
-		if (alsa_reopen(effectf) < 0)
-		{
-			/* fatal error... */
-			alsa_close();
-			return;
-		}
-	}
-
-	if (ep)
-		length = ep->mod_samples(&data, length,
-					 inputf->xmms_format,
-					 inputf->rate,
-					 inputf->channels);
-#endif
-
 	if (alsa_convert_func != NULL)
 		length = alsa_convert_func(convertb, &data, length);
 	if (alsa_stereo_convert_func != NULL)
--- a/src/arts/audio.c	Tue Sep 11 02:28:47 2007 +0300
+++ b/src/arts/audio.c	Tue Sep 11 09:15:24 2007 -0500
@@ -276,48 +276,6 @@
 
 void artsxmms_write(gpointer ptr, int length)
 {
-#if 0
-	AFormat new_format;
-	int new_frequency, new_channels;
-	EffectPlugin *ep;
-	
-	new_format = input_params.format;
-	new_frequency = input_params.frequency;
-	new_channels = input_params.channels;
-
-	ep = get_current_effect_plugin();
-	if (effects_enabled() && ep && ep->query_format)
-		ep->query_format(&new_format, &new_frequency, &new_channels);
-	
-	if (new_format != output_params.format ||
-	    new_frequency != output_params.frequency ||
-	    new_channels != output_params.channels)
-	{
-		/*
-		 * The effect plugins has changed the format of the stream.
-		 */
-
-		guint64 offset = (written * 1000) / output_params.bps;
-		artsxmms_set_params(&output_params, new_format,
-				    new_frequency, new_channels);
-		arts_convert_func = arts_get_convert_func(output_params.format);
-	
-		written = (offset * output_params.bps) / 1000;
-
-		artsxmms_helper_init(&output_params);
-	}
-
-	/*
-	 * Doing the effect plugin processing here adds some latency,
-	 * but the alternative is just too frigging hairy.
-	 */
-	
-	if (effects_enabled() && ep && ep->mod_samples)
-		length = ep->mod_samples(&ptr, length, input_params.format,
-					 input_params.frequency,
-					 input_params.channels);
-#endif
-
 	if (arts_convert_func)
 		arts_convert_func(ptr, length);
 
--- a/src/esd/audio.c	Tue Sep 11 02:28:47 2007 +0300
+++ b/src/esd/audio.c	Tue Sep 11 09:15:24 2007 -0500
@@ -43,7 +43,6 @@
 static esd_format_t esd_format;
 static gint input_bps, input_format, input_frequency, input_channels;
 static GThread *buffer_thread;
-static gboolean realtime = FALSE;
 static void *(*esd_translate) (void *, gint);
 static int player_id_unique = 0;
 
@@ -227,13 +226,10 @@
 gint
 esdout_used(void)
 {
-    if (realtime)
-        return 0;
-    else {
-        if (wr_index >= rd_index)
-            return wr_index - rd_index;
-        return buffer_size - (rd_index - wr_index);
-    }
+    if (wr_index >= rd_index)
+        return wr_index - rd_index;
+
+    return buffer_size - (rd_index - wr_index);
 }
 
 gint
@@ -250,58 +246,23 @@
 gint
 esdout_free(void)
 {
-    if (!realtime) {
-        if (remove_prebuffer && prebuffer) {
-            prebuffer = FALSE;
-            remove_prebuffer = FALSE;
-        }
-        if (prebuffer)
-            remove_prebuffer = TRUE;
+    if (remove_prebuffer && prebuffer) {
+        prebuffer = FALSE;
+        remove_prebuffer = FALSE;
+    }
 
-        if (rd_index > wr_index)
-            return (rd_index - wr_index) - 1;
-        return (buffer_size - (wr_index - rd_index)) - 1;
-    }
-    else {
-        if (paused)
-            return 0;
-        else
-            return 1000000;
-    }
+    if (prebuffer)
+        remove_prebuffer = TRUE;
+
+    if (rd_index > wr_index)
+        return (rd_index - wr_index) - 1;
+
+    return (buffer_size - (wr_index - rd_index)) - 1;
 }
 
 static void
 esdout_write_audio(gpointer data, gint length)
 {
-#if 0
-    AFormat new_format;
-    gint new_frequency, new_channels;
-    EffectPlugin *ep;
-
-    new_format = input_format;
-    new_frequency = input_frequency;
-    new_channels = input_channels;
-
-    ep = get_current_effect_plugin();
-    if (effects_enabled() && ep && ep->query_format) {
-        ep->query_format(&new_format, &new_frequency, &new_channels);
-    }
-
-    if (new_format != format || new_frequency != frequency
-        || new_channels != channels) {
-        output_time_offset += (gint) ((output_bytes * 1000) / ebps);
-        output_bytes = 0;
-        esdout_setup_format(new_format, new_frequency, new_channels);
-        frequency = new_frequency;
-        channels = new_channels;
-        esd_close(fd);
-        esdout_set_audio_params();
-    }
-    if (effects_enabled() && ep && ep->mod_samples)
-        length =
-            ep->mod_samples(&data, length, input_format, input_frequency,
-                            input_channels);
-#endif
     while (length > 0) {
         int num_written;
         if (esd_translate)
@@ -322,27 +283,16 @@
 {
     gint cnt, off = 0;
 
-    if (!realtime) {
-        remove_prebuffer = FALSE;
-
-        written += length;
-        while (length > 0) {
-            cnt = MIN(length, buffer_size - wr_index);
-            memcpy((gchar *) buffer + wr_index, (gchar *) ptr + off, cnt);
-            wr_index = (wr_index + cnt) % buffer_size;
-            length -= cnt;
-            off += cnt;
+    remove_prebuffer = FALSE;
 
-        }
+    written += length;
+    while (length > 0) {
+        cnt = MIN(length, buffer_size - wr_index);
+        memcpy((gchar *) buffer + wr_index, (gchar *) ptr + off, cnt);
+        wr_index = (wr_index + cnt) % buffer_size;
+        length -= cnt;
+        off += cnt;
     }
-    else {
-        if (paused)
-            return;
-        esdout_write_audio(ptr, length);
-        written += length;
-
-    }
-
 }
 
 void
@@ -353,10 +303,7 @@
 
     going = 0;
 
-    if (!realtime)
-        g_thread_join(buffer_thread);
-    else
-        esd_close(fd);
+    g_thread_join(buffer_thread);
 
     wr_index = 0;
     rd_index = 0;
@@ -367,16 +314,10 @@
 void
 esdout_flush(gint time)
 {
-    if (!realtime) {
-        flush = time;
-        while (flush != -1)
-            g_usleep(10000);
-    }
-    else {
-        output_time_offset = time;
-        written = (guint64) (time / 10) * (guint64) (input_bps / 100);
-        output_bytes = 0;
-    }
+    flush = time;
+
+    while (flush != -1)
+        g_usleep(10000);
 }
 
 void
@@ -446,18 +387,15 @@
     input_frequency = frequency;
     input_bps = bps;
 
-    realtime = xmms_check_realtime_priority();
+    buffer_size = (esd_cfg.buffer_size * input_bps) / 1000;
+    if (buffer_size < 8192)
+        buffer_size = 8192;
+    prebuffer_size = (buffer_size * esd_cfg.prebuffer) / 100;
+    if (buffer_size - prebuffer_size < 4096)
+        prebuffer_size = buffer_size - 4096;
 
-    if (!realtime) {
-        buffer_size = (esd_cfg.buffer_size * input_bps) / 1000;
-        if (buffer_size < 8192)
-            buffer_size = 8192;
-        prebuffer_size = (buffer_size * esd_cfg.prebuffer) / 100;
-        if (buffer_size - prebuffer_size < 4096)
-            prebuffer_size = buffer_size - 4096;
+    buffer = g_malloc0(buffer_size);
 
-        buffer = g_malloc0(buffer_size);
-    }
     flush = -1;
     prebuffer = 1;
     wr_index = rd_index = output_time_offset = written = output_bytes = 0;
@@ -483,8 +421,8 @@
     }
     going = 1;
 
-    if (!realtime)
-        buffer_thread = g_thread_create(esdout_loop, NULL, TRUE, NULL);
+    buffer_thread = g_thread_create(esdout_loop, NULL, TRUE, NULL);
+
     return 1;
 }
 
--- a/src/filewriter/filewriter.c	Tue Sep 11 02:28:47 2007 +0300
+++ b/src/filewriter/filewriter.c	Tue Sep 11 09:15:24 2007 -0500
@@ -188,15 +188,6 @@
     gint rv;
     Playlist *playlist;
 
-    if (xmms_check_realtime_priority())
-    {
-        audacious_info_dialog(_("Error"),
-                          _("You cannot use the FileWriter plugin\n"
-                            "when you're running in realtime mode."),
-                          _("OK"), FALSE, NULL, NULL);
-        return 0;
-    }
-
     input.format = fmt;
     input.frequency = rate;
     input.channels = nch;
@@ -318,26 +309,6 @@
 
 static void file_write(void *ptr, gint length)
 {
-    AFormat new_format;
-    int new_frequency, new_channels;
-    EffectPlugin *ep;
-
-    new_format = input.format;
-    new_frequency = input.frequency;
-    new_channels = input.channels;
-
-    ep = get_current_effect_plugin();
-    if ( effects_enabled() && ep && ep->query_format ) {
-        ep->query_format(&new_format,&new_frequency,&new_channels);
-    }
-
-    if ( effects_enabled() && ep && ep->mod_samples ) {
-        length = ep->mod_samples(&ptr,length,
-                                 input.format,
-                                 input.frequency,
-                                 input.channels );
-    }
-
     if (input.format == FMT_S8 || input.format == FMT_S16_BE ||
         input.format == FMT_U16_LE || input.format == FMT_U16_BE ||
         input.format == FMT_U16_NE)
--- a/src/jack/jack.c	Tue Sep 11 02:28:47 2007 +0300
+++ b/src/jack/jack.c	Tue Sep 11 09:15:24 2007 -0500
@@ -429,72 +429,9 @@
 void jack_write(gpointer ptr, gint length)
 {
   long written;
-#if 0
-  EffectPlugin *ep;
-  AFormat new_format;
-  int new_frequency, new_channels;
-  long positionMS;
-#endif
 
   TRACE("starting length of %d\n", length);
 
-#if 0
-  /* copy the current values into temporary values */
-  new_format = input.format;
-  new_frequency = input.frequency;
-  new_channels = input.channels;
-
-  /* query xmms for the current plugin */
-  ep = get_current_effect_plugin();
-  if(effects_enabled() && ep && ep->query_format)
-  {
-    ep->query_format(&new_format, &new_frequency, &new_channels);
-  }
-
-  /* if the format has changed take this into account by modifying */
-  /* the time offset and reopening the device with the new format settings */
-  if (new_format != effect.format ||
-      new_frequency != effect.frequency ||
-      new_channels != effect.channels)
-  {
-    TRACE("format changed, storing new values and opening/closing jack\n");
-    TRACE("effect.format == %d, new_format == %d, effect.frequency == %ld, new_frequency == %d, effect.channels == %d, new_channels = %d\n",
-	  effect.format, new_format, effect.frequency, new_frequency, effect.channels, new_channels);
-
-    positionMS = JACK_GetPosition(driver, MILLISECONDS, PLAYED);
-
-    jack_close();
-    jack_open(new_format, new_frequency, new_channels);
-
-    /* restore the position after the open and close */
-    JACK_SetState(driver, PAUSED);
-    JACK_SetPosition(driver, MILLISECONDS, positionMS);
-    JACK_SetState(driver, PLAYING);
-  }
-
-  /* if effects are enabled and we have a plugin, run the current */
-  /* samples through the plugin */
-  if (effects_enabled() && ep && ep->mod_samples)
-  {
-    length = ep->mod_samples(&ptr, length,
-                             input.format,
-                             input.frequency,
-                             input.channels);
-    TRACE("effects_enabled(), length is now %d\n", length);
-  }
-
-  TRACE("effect.frequency == %ld, input.frequency == %ld, output.frequency == %ld\n",
-        effect.frequency, input.frequency, output.frequency);
-
-  /* if we need rate conversion, perform it here */
-  if((effect.frequency != output.frequency) && isXmmsFrequencyAvailable)
-  {
-    TRACE("performing rate conversion from '%ld'(effect) to '%ld'(output)\n", effect.frequency, output.frequency);
-    length = freq_convert (convertb, &ptr, length, effect.frequency, output.frequency);
-  }
-
-  TRACE("length = %d\n", length);
-#endif
   /* loop until we have written all the data out to the jack device */
   /* this is due to xmms' audio driver api */
   char *buf = (char*)ptr;
--- a/src/null/null.c	Tue Sep 11 02:28:47 2007 +0300
+++ b/src/null/null.c	Tue Sep 11 09:15:24 2007 -0500
@@ -149,22 +149,12 @@
 
 static void null_write(void *ptr, int length)
 {
-#if 0
-	EffectPlugin *ep;
-#endif
 	if (timer && !started)
 	{
 		g_timer_start(timer);
 		started = TRUE;
 	}
 
-#if 0
-	if ((ep = get_current_effect_plugin()) != NULL &&
-	    effects_enabled() && ep->mod_samples)
-		ep->mod_samples(&ptr, length, input_format.format,
-				input_format.frequency, input_format.channels);
-#endif
-
 	written += length;
 }
 
--- a/src/sun/audio.c	Tue Sep 11 02:28:47 2007 +0300
+++ b/src/sun/audio.c	Tue Sep 11 09:15:24 2007 -0500
@@ -35,7 +35,6 @@
 static gboolean	prebuffer, remove_prebuffer;
 static pthread_t buffer_thread;
 static int (*sun_convert)(void **, int);
-static int realtime;
 static int rd_index, wr_index;
 static int buffer_size;
 static int prebuffer_size;
@@ -233,9 +232,6 @@
 	if (!audio.fd || !audio.going)
 		return 0;
 
-	if (realtime)
-		sun_bufused();
-
 	bytes = output_bytes < device_buffer_used ?
 		0 : output_bytes - device_buffer_used;
 	return (output_time_offset + ((bytes * 1000) / output.bps));
@@ -243,9 +239,6 @@
 
 static inline int sun_used(void)
 {
-	if (realtime)
-		return 0;
-	
 	if (wr_index >= rd_index)
 		return (wr_index - rd_index);
 
@@ -257,9 +250,6 @@
 	if (!audio.going)
 		return 0;
 
-	if (realtime)
-		sun_bufused();
-
 	if (!sun_used() && (device_buffer_used - (3 * blocksize)) <= 0)
 		return (FALSE);
 
@@ -268,9 +258,6 @@
 
 int sun_free(void)
 {
-	if (realtime)
-		return (audio.paused ? 0 : 1000000);
-	
 	if (remove_prebuffer && prebuffer)
 	{
 		prebuffer = FALSE;
@@ -309,36 +296,6 @@
 
 static inline void sun_write_audio(gpointer data, int length)
 {
-#if 0
-	AFormat new_format;
-	EffectPlugin *ep;
-	int new_frequency, new_channels;
-
-	new_format = input.format.xmms;
-	new_frequency = input.frequency;
-	new_channels = input.channels;
-
-	ep = get_current_effect_plugin();
-	if (effects_enabled() && ep && ep->query_format)
-		ep->query_format(&new_format, &new_frequency, &new_channels);
-
-	if (new_format != effect.format.xmms || 
-	    new_frequency != effect.frequency ||
-	    new_channels != effect.channels)
-	{
-		output_time_offset += (output_bytes * 1000) / output.bps;
-		output_bytes = 0;
-		close(audio.fd);
-		audio.fd = open(audio.devaudio, O_RDWR);
-		sun_setformat(new_format, new_frequency, new_channels);
-	}
-	if (effects_enabled() && ep && ep->mod_samples)
-	{
-		length = ep->mod_samples(&data, length, input.format.xmms,
-					 input.frequency, input.channels);
-	}
-#endif
-
 	if (sun_convert != NULL)
 		length = sun_convert(&data, length);
 
@@ -402,15 +359,6 @@
 {
 	int cnt, off = 0;
 
-	if (realtime)
-	{
-		if (audio.paused)
-			return;
-		sun_write_audio(ptr, length);
-		written += length;
-		return;
-	}
-
 	remove_prebuffer = FALSE;
 	written += length;
 	while (length > 0)
@@ -430,15 +378,7 @@
 
 	audio.going = 0;
 
-	if (realtime)
-	{
-		ioctl(audio.fd, AUDIO_FLUSH, NULL);
-		close(audio.fd);
-	}
-	else
-	{
-		pthread_join(buffer_thread, NULL);
-	}
+	pthread_join(buffer_thread, NULL);
 
 	sun_get_convert_buffer(0);
 	wr_index = 0;
@@ -456,15 +396,10 @@
 
 void sun_pause(short p)
 {
-	if (!realtime)
-	{
-		if (p == TRUE)
-			audio.do_pause = TRUE;
-		else
-			audio.unpause = TRUE;
-	}
+	if (p == TRUE)
+		audio.do_pause = TRUE;
 	else
-		audio.paused = p;
+		audio.unpause = TRUE;
 }
 
 static void* sun_loop(void *arg)
@@ -549,25 +484,21 @@
 	input.bps = sun_bps(sun_format(fmt), rate, nch);
 	sun_setformat(fmt, rate, nch);
 
-	realtime = xmms_check_realtime_priority();
-
 	if (ioctl(audio.fd, AUDIO_GETINFO, &info) != 0)
 		blocksize = SUN_DEFAULT_BLOCKSIZE;
 	else
 		blocksize = info.blocksize;
 
-	if (!realtime)
-	{
-		buffer_size = audio.req_buffer_size;
+	buffer_size = audio.req_buffer_size;
+
+	if (buffer_size < SUN_MIN_BUFFER_SIZE)
+		buffer_size = SUN_MIN_BUFFER_SIZE;
 
-		if (buffer_size < SUN_MIN_BUFFER_SIZE)
-			buffer_size = SUN_MIN_BUFFER_SIZE;
+	prebuffer_size = (buffer_size * audio.req_prebuffer_size) / 100;
 
-		prebuffer_size = (buffer_size * audio.req_prebuffer_size) / 100;
+	buffer_size += blocksize;
+	buffer = g_malloc0(buffer_size);
 
-		buffer_size += blocksize;
-		buffer = g_malloc0(buffer_size);
-	}
 	prebuffer = TRUE;
 	wr_index = 0;
 	rd_index = 0;
@@ -581,8 +512,8 @@
 	remove_prebuffer = FALSE;
 
 	audio.going++;
-	if (!realtime)
-		pthread_create(&buffer_thread, NULL, sun_loop, NULL);
+
+	pthread_create(&buffer_thread, NULL, sun_loop, NULL);
 
 	return 1;
 }