changeset 4590:df2b2c6810e1

Automated merge with ssh://hg.atheme.org//hg/audacious
author Matti Hamalainen <ccr@tnsp.org>
date Sun, 25 May 2008 18:10:08 +0300
parents ab8bc8a89a52 (diff) 714bc6fa7c40 (current diff)
children 44a552c67021
files
diffstat 5 files changed, 26 insertions(+), 30 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/input.c	Sun May 25 18:09:59 2008 +0300
+++ b/src/audacious/input.c	Sun May 25 18:10:08 2008 +0300
@@ -725,7 +725,7 @@
     h_vol[0] = l;
     h_vol[1] = r;
     hook_call("volume set", h_vol);
-    
+
     if (playback_get_playing())
         if ((playback = get_current_input_playback()) != NULL)
 	    if (playback->plugin->set_volume != NULL)
--- a/src/audacious/main.c	Sun May 25 18:09:59 2008 +0300
+++ b/src/audacious/main.c	Sun May 25 18:10:08 2008 +0300
@@ -765,7 +765,10 @@
          * but not if we're running headless --nenolod
          */
         mainwin_setup_menus();
-        ui_main_set_initial_volume();
+
+        gint h_vol[2];
+        input_get_volume(&h_vol[0], &h_vol[1]);
+        hook_call("volume set", h_vol);
 
         /* FIXME: delayed, because it deals directly with the plugin
          * interface to set menu items */
--- a/src/audacious/ui_main.c	Sun May 25 18:09:59 2008 +0300
+++ b/src/audacious/ui_main.c	Sun May 25 18:10:08 2008 +0300
@@ -1948,29 +1948,6 @@
     GDK_THREADS_LEAVE();
 }
 
-void
-ui_main_set_initial_volume(void)
-{
-    gint vl, vr, b, v;
-
-    input_get_volume(&vl, &vr);
-
-    vl = CLAMP(vl, 0, 100);
-    vr = CLAMP(vr, 0, 100);
-    v = MAX(vl, vr);
-    if (vl > vr)
-        b = (gint) rint(((gdouble) vr / vl) * 100) - 100;
-    else if (vl < vr)
-        b = 100 - (gint) rint(((gdouble) vl / vr) * 100);
-    else
-        b = 0;
-
-    mainwin_set_volume_slider(v);
-    equalizerwin_set_volume_slider(v);
-    mainwin_set_balance_slider(b);
-    equalizerwin_set_balance_slider(b);
-}
-
 static void
 set_timer_mode(TimerMode mode)
 {
--- a/src/audacious/ui_main.h	Sun May 25 18:09:59 2008 +0300
+++ b/src/audacious/ui_main.h	Sun May 25 18:10:08 2008 +0300
@@ -115,7 +115,6 @@
 extern GtkWidget *mainwin_position, *mainwin_sposition;
 
 void mainwin_create(void);
-void ui_main_set_initial_volume(void);
 
 void mainwin_lock_info_text(const gchar * text);
 void mainwin_release_info_text(void);
--- a/src/audacious/ui_main_evlisteners.c	Sun May 25 18:09:59 2008 +0300
+++ b/src/audacious/ui_main_evlisteners.c	Sun May 25 18:10:08 2008 +0300
@@ -94,16 +94,19 @@
 }
 
 static void
+ui_main_evlistener_playback_initiate(gpointer hook_data, gpointer user_data)
+{
+    playback_initiate();
+}
+
+static void
 ui_main_evlistener_playback_begin(gpointer hook_data, gpointer user_data)
 {
     PlaylistEntry *entry = (PlaylistEntry*)hook_data;
     g_return_if_fail(entry != NULL);
 
     equalizerwin_load_auto_preset(entry->filename);
-    input_set_eq(cfg.equalizer_active, cfg.equalizer_preamp,
-                 cfg.equalizer_bands);
-    output_set_eq(cfg.equalizer_active, cfg.equalizer_preamp,
-                  cfg.equalizer_bands);
+    hook_call("equalizer changed", NULL);
 
     ui_vis_clear_data(mainwin_vis);
     ui_svis_clear_data(mainwin_svis);
@@ -278,12 +281,24 @@
                     cfg.mainwin_use_bitmapfont);
 }
 
+static void
+ui_main_evlistener_equalizer_changed(gpointer hook_data, gpointer user_data)
+{
+    /* um .. i think we need both of these for xmms compatibility ..
+       not sure. -larne */
+    input_set_eq(cfg.equalizer_active, cfg.equalizer_preamp,
+                 cfg.equalizer_bands);
+    output_set_eq(cfg.equalizer_active, cfg.equalizer_preamp,
+                  cfg.equalizer_bands);
+}
+
 void
 ui_main_evlistener_init(void)
 {
     hook_associate("title change", ui_main_evlistener_title_change, NULL);
     hook_associate("hide seekbar", ui_main_evlistener_hide_seekbar, NULL);
     hook_associate("volume set", ui_main_evlistener_volume_change, NULL);
+    hook_associate("playback initiate", ui_main_evlistener_playback_initiate, NULL);
     hook_associate("playback begin", ui_main_evlistener_playback_begin, NULL);
     hook_associate("playback stop", ui_main_evlistener_playback_stop, NULL);
     hook_associate("playback pause", ui_main_evlistener_playback_pause, NULL);
@@ -302,5 +317,7 @@
     hook_associate("filebrowser hide", ui_main_evlistener_filebrowser_hide, NULL);
     hook_associate("visualization timeout", ui_main_evlistener_visualization_timeout, NULL);
     hook_associate("config save", ui_main_evlistener_config_save, NULL);
+
+    hook_associate("equalizer changed", ui_main_evlistener_equalizer_changed, NULL);
 }