chiark / gitweb /
disobedience volume control is local if rtp play
[disorder] / disobedience / control.c
index 36282cfdf8b1fc05df7dcf0e2ff13dd16d36f762..ecdc1a6bb9f6ba8da2dfd0c8e4637511b662a3f0 100644 (file)
@@ -22,6 +22,7 @@
  */
 
 #include "disobedience.h"
+#include "mixer.h"
 
 /* Forward declarations ---------------------------------------------------- */
 
@@ -220,8 +221,6 @@ void control_monitor(void attribute((unused)) *u) {
 /** @brief Create the control bar */
 GtkWidget *control_widget(void) {
   GtkWidget *hbox = gtk_hbox_new(FALSE, 1), *vbox;
-  GtkWidget *content;
-  GdkPixbuf *pb;
   GtkWidget *v, *b;
   int n;
 
@@ -230,16 +229,7 @@ GtkWidget *control_widget(void) {
   assert(mainmenufactory);              /* ordering must be right */
   for(n = 0; n < NICONS; ++n) {
     NW(button);
-    icons[n].button = gtk_button_new();
-    if((pb = find_image(icons[n].icon))) {
-      NW(image);
-      content = gtk_image_new_from_pixbuf(pb);
-    } else {
-      NW(label);
-      content = gtk_label_new(icons[n].icon);
-    }
-    gtk_container_add(GTK_CONTAINER(icons[n].button), content);
-    gtk_tooltips_set_tip(tips, icons[n].button, icons[n].tip, "");
+    icons[n].button = iconbutton(icons[n].icon, icons[n].tip);
     g_signal_connect(G_OBJECT(icons[n].button), "clicked",
                      G_CALLBACK(clicked_icon), &icons[n]);
     /* pop the icon in a vbox so it doesn't get vertically stretch if there are
@@ -279,6 +269,8 @@ GtkWidget *control_widget(void) {
   v = gtk_hscale_new(volume_adj);
   NW(hscale);
   b = gtk_hscale_new(balance_adj);
+  gtk_widget_set_style(v, tool_style);
+  gtk_widget_set_style(b, tool_style);
   gtk_scale_set_digits(GTK_SCALE(v), 10);
   gtk_scale_set_digits(GTK_SCALE(b), 10);
   gtk_widget_set_size_request(v, 192, -1);
@@ -449,10 +441,15 @@ static void volume_adjusted(GtkAdjustment attribute((unused)) *a,
   b = nearbyint(5 * b) / 5;
   /* Set the volume.  We don't want a reply, we'll get the actual new volume
    * from the log. */
-  disorder_eclient_volume(client, 0,
-                          nearbyint(left(v, b) * 100),
-                          nearbyint(right(v, b) * 100),
-                          0);
+  if(rtp_supported) {
+    int l = nearbyint(left(v, b) * 100), r = nearbyint(right(v, b) * 100);
+    mixer_control(&l, &r, 1);
+  } else
+    /* We don't want a reply, we'll get the actual new volume from the log. */
+    disorder_eclient_volume(client, 0,
+                            nearbyint(left(v, b) * 100),
+                            nearbyint(right(v, b) * 100),
+                            0);
 }
 
 /** @brief Formats the volume value */