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