158bcbc
There is no callback feature in Audacious < 2.2 that moves the UI's volume
158bcbc
slider when external volume controls are used. Hence stick to the internal
158bcbc
volume level and don't get confused when trying to save/restore external
158bcbc
volume levels.
158bcbc
158bcbc
diff -Nur audacious-plugins-1.5.1-orig/src/pulse_audio/pulse_audio.c audacious-plugins-1.5.1/src/pulse_audio/pulse_audio.c
158bcbc
--- audacious-plugins-1.5.1-orig/src/pulse_audio/pulse_audio.c	2008-05-24 00:44:20.000000000 +0200
158bcbc
+++ audacious-plugins-1.5.1/src/pulse_audio/pulse_audio.c	2009-10-19 16:46:47.527799161 +0200
158bcbc
@@ -83,6 +83,8 @@
158bcbc
 }
158bcbc
 
158bcbc
 static void info_cb(struct pa_context *c, const struct pa_sink_input_info *i, int is_last, void *userdata) {
158bcbc
+    return;  /* we don't do anything useful with this callback */
158bcbc
+
158bcbc
     assert(c);
158bcbc
 
158bcbc
     if (!i)
158bcbc
@@ -685,6 +687,18 @@
158bcbc
         goto unlock_and_fail;
158bcbc
     }
158bcbc
 
158bcbc
+    pa_operation_unref(o);
158bcbc
+    /* set initial volume */
158bcbc
+    if (!(o = pa_context_set_sink_input_volume(context, pa_stream_get_index(stream), &volume, NULL, NULL))) {
158bcbc
+        g_warning("pa_context_set_sink_input_volume() failed: %s", pa_strerror(pa_context_errno(context)));
158bcbc
+        goto unlock_and_fail;
158bcbc
+    }
158bcbc
+    while (pa_operation_get_state(o) != PA_OPERATION_DONE) {
158bcbc
+        CHECK_DEAD_GOTO(fail, 1);
158bcbc
+        pa_threaded_mainloop_wait(mainloop);
158bcbc
+    }
158bcbc
+    pa_operation_unref(o);
158bcbc
+
158bcbc
     do_trigger = 0;
158bcbc
     written = 0;
158bcbc
     time_offset_msec = 0;