changeset 3977:81b4e186765f

Multiple changes. - Introduce a new variable that stores the volume. - Set volume on playback start.
author Jonathan Schleifer <js@webkeks.org>
date Mon, 19 Nov 2007 21:35:25 +0100
parents 608590ec4548
children 40db2fe8d073
files src/audacious/input.c src/audacious/output.c
diffstat 2 files changed, 12 insertions(+), 10 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/input.c	Mon Nov 19 18:50:23 2007 +0100
+++ b/src/audacious/input.c	Mon Nov 19 21:35:25 2007 +0100
@@ -76,6 +76,7 @@
 };
 
 static GList *vis_list = NULL;
+static int volume_l = -1, volume_r = -1;
 
 InputPlayback *
 get_current_input_playback(void)
@@ -755,17 +756,11 @@
 void
 input_get_volume(gint * l, gint * r)
 {
-    InputPlayback *playback;
+    if (volume_l == -1 || volume_r == -1)
+	output_get_volume(&volume_l, &volume_r);
 
-    *l = -1;
-    *r = -1;
-    if (playback_get_playing()) {
-        if ((playback = get_current_input_playback()) != NULL &&
-            playback->plugin->get_volume &&
-            playback->plugin->get_volume(l, r))
-            return;
-    }
-    output_get_volume(l, r);
+    *l = volume_l;
+    *r = volume_r;
 }
 
 void
@@ -786,6 +781,9 @@
         return;
 
     output_set_volume(l, r);
+
+    volume_l = l;
+    volume_r = r;
 }
 
 void
--- a/src/audacious/output.c	Mon Nov 19 18:50:23 2007 +0100
+++ b/src/audacious/output.c	Mon Nov 19 21:35:25 2007 +0100
@@ -256,6 +256,7 @@
 {
     gint ret;
     OutputPlugin *op;
+    int l, r;
     
 #ifdef USE_SRC
     ConfigDb *db;
@@ -324,6 +325,9 @@
         op_state.nch = nch;
     }
 
+    input_get_volume(&l, &r);
+    op->set_volume(l, r);
+
     return ret;
 }