changeset 3553:a140fadd741d trunk

software volumecontrol->flow manager API
author William Pitcock <nenolod@atheme.org>
date Tue, 18 Sep 2007 13:13:20 -0500
parents e840c5086a15
children 3ff87aafe1a4
files src/audacious/output.c src/audacious/volumecontrol.c src/audacious/volumecontrol.h
diffstat 3 files changed, 22 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/output.c	Tue Sep 18 12:58:03 2007 -0500
+++ b/src/audacious/output.c	Tue Sep 18 13:13:20 2007 -0500
@@ -36,6 +36,8 @@
 #include "playlist.h"
 #include "configdb.h"
 
+#include "flow.h"
+
 #include "effect.h"
 #include "volumecontrol.h"
 
@@ -428,6 +430,7 @@
               int *going        /* 0 when time to stop  */
               )
 {
+    static Flow *postproc_flow = NULL;
     static int init = 0;
     int swapped = 0;
     guint myorder = G_BYTE_ORDER == G_LITTLE_ENDIAN ? FMT_S16_LE : FMT_S16_BE;
@@ -438,6 +441,12 @@
     gint new_rate;
     gint new_nch;
 
+    if (postproc_flow == NULL)
+    {
+        postproc_flow = flow_new();
+        flow_link_element(postproc_flow, volumecontrol_flow);
+    }
+
 #ifdef USE_SRC
     if(src_state != NULL&&length > 0)
       {
@@ -521,8 +530,7 @@
     length = effect_do_mod_samples(&ptr, length, op_state.fmt, op_state.rate, 
         op_state.nch);
 
-    if (cfg.software_volume_control)
-        volumecontrol_pad_audio(ptr, length, op_state.fmt, op_state.nch);
+    flow_execute(postproc_flow, ptr, length, op_state.fmt, op_state.rate, op_state.nch);
 
     writeoffs = 0;
     while (writeoffs < length)
--- a/src/audacious/volumecontrol.c	Tue Sep 18 12:58:03 2007 -0500
+++ b/src/audacious/volumecontrol.c	Tue Sep 18 13:13:20 2007 -0500
@@ -160,3 +160,12 @@
     vc_state_.left = l;
     vc_state_.right = r;
 }
+
+void
+volumecontrol_flow(FlowContext *context)
+{
+    if (!cfg.software_volume_control)
+        return;
+
+    volumecontrol_pad_audio(context->data, context->len, context->fmt, context->channels);
+}
--- a/src/audacious/volumecontrol.h	Tue Sep 18 12:58:03 2007 -0500
+++ b/src/audacious/volumecontrol.h	Tue Sep 18 13:13:20 2007 -0500
@@ -20,6 +20,8 @@
 
 #include <glib.h>
 
+#include "flow.h"
+
 #ifndef __VOLUMECONTROL_H__
 #define __VOLUMECONTROL_H__
 
@@ -27,5 +29,6 @@
     gint channels);
 void volumecontrol_get_volume_state(gint *l, gint *r);
 void volumecontrol_set_volume_state(gint l, gint r);
+void volumecontrol_flow(FlowContext *context);
 
 #endif