changeset 3486:96baf555b449 trunk

Get rid of "XMMS Multiple Effect Plugin support" hack. Effects processing is handled in produce_audio() now days.
author William Pitcock <nenolod@atheme.org>
date Tue, 11 Sep 2007 05:14:38 -0500
parents 87003549ac36
children ef08e1a4f5b7
files src/audacious/effect.c src/audacious/effect.h src/audacious/output.c
diffstat 3 files changed, 25 insertions(+), 58 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/effect.c	Mon Sep 10 17:14:45 2007 +0930
+++ b/src/audacious/effect.c	Tue Sep 11 05:14:38 2007 -0500
@@ -35,7 +35,7 @@
     NULL
 };
 
-static gint
+gint
 effect_do_mod_samples(gpointer * data, gint length,
                       AFormat fmt, gint srate, gint nch)
 {
@@ -53,7 +53,7 @@
     return length;
 }
 
-static void
+void
 effect_do_query_format(AFormat * fmt, gint * rate, gint * nch)
 {
     GList *l = ep_data.enabled_list;
@@ -68,36 +68,6 @@
     }
 }
 
-static EffectPlugin pseudo_effect_plugin = {
-    NULL,
-    NULL,
-    "XMMS Multiple Effects Support",
-    NULL,
-    NULL,
-    NULL,
-    NULL,
-    TRUE,
-    effect_do_mod_samples,
-    effect_do_query_format
-};
-
-/* get_current_effect_plugin() and effects_enabled() are still to be used by 
- * output plugins as they were when we only supported one effects plugin at
- * a time. We now had a pseudo-effects-plugin that chains all the enabled
- * plugins. -- Jakdaw */
-
-EffectPlugin *
-get_current_effect_plugin(void)
-{
-    return &pseudo_effect_plugin;
-}
-
-gboolean
-effects_enabled(void)
-{
-    return TRUE;
-}
-
 GList *
 get_effect_enabled_list(void)
 {
--- a/src/audacious/effect.h	Mon Sep 10 17:14:45 2007 +0930
+++ b/src/audacious/effect.h	Tue Sep 11 05:14:38 2007 -0500
@@ -40,6 +40,9 @@
 void enable_effect_plugin(gint i, gboolean enable);
 gchar *effect_stringify_enabled_list(void);
 void effect_enable_from_stringified_list(const gchar * list);
+gint effect_do_mod_samples(gpointer * data, gint length, AFormat fmt, 
+	gint srate, gint nch);
+void effect_do_query_format(AFormat * fmt, gint * rate, gint * nch);
 
 extern EffectPluginData ep_data;
 
--- a/src/audacious/output.c	Mon Sep 10 17:14:45 2007 +0930
+++ b/src/audacious/output.c	Tue Sep 11 05:14:38 2007 -0500
@@ -432,7 +432,6 @@
     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();
-    EffectPlugin *ep = get_current_effect_plugin();
     int writeoffs;
     AFormat new_format;
     gint new_rate;
@@ -500,32 +499,26 @@
     input_add_vis_pcm(time, fmt, nch, length, ptr);
 
     /* do effect plugin(s) */
-    if (effects_enabled() && ep && ep->query_format) {
-        new_format = op_state.fmt;
-        new_rate = op_state.rate;
-        new_nch = op_state.nch;
+    new_format = op_state.fmt;
+    new_rate = op_state.rate;
+    new_nch = op_state.nch;
 
-        ep->query_format(&new_format, &new_rate, &new_nch);
+    effect_do_query_format(&new_format, &new_rate, &new_nch);
 
-        if (new_format != op_state.fmt ||
-            new_rate != op_state.rate ||
-            new_nch != op_state.nch) {
-            /*
-             * The effect plugin changes the stream format. Reopen the
-             * audio device.
-             */
-            if (0 == output_open_audio(new_format, new_rate, new_nch)) {
-                /*
-                 * Fatal error.
-                 */
-                return;
-            }
-        }
+    if (new_format != op_state.fmt ||
+        new_rate != op_state.rate ||
+        new_nch != op_state.nch)
+    {
+        /*
+         * The effect plugin changes the stream format. Reopen the
+         * audio device.
+         */
+        if (!output_open_audio(new_format, new_rate, new_nch))
+            return;
     }
 
-    if (effects_enabled() && ep && ep->mod_samples)
-        length = ep->mod_samples(&ptr, length, op_state.fmt,
-                op_state.rate, op_state.nch);
+    length = effect_do_mod_samples(&ptr, length, op_state.fmt, op_state.rate, 
+        op_state.nch);
 
     writeoffs = 0;
     while (writeoffs < length)
@@ -538,14 +531,15 @@
         if (writable == 0)
             return;
 
-        while (op->buffer_free() < writable) { /* wait output buf */
+        while (op->buffer_free() < writable)   /* wait output buf */
+        {
             if (going && !*going)              /* thread stopped? */
                 return;                        /* so finish */
 
-                if (ip_data.stop)              /* has a stop been requested? */
+            if (ip_data.stop)                  /* has a stop been requested? */
                 return;                        /* yes, so finish */
 
-                g_usleep(10000);               /* else sleep for retry */
+            g_usleep(10000);                   /* else sleep for retry */
         }
 
         if (ip_data.stop)