changeset 3677:30ef1287da19

Seperate the 10hz loop dependent code from the rest of the remaining polling loop. Also change the primary polling loop to 100hz (but really the rest can mostly be done with callbacks, or selectively).
author William Pitcock <nenolod@atheme.org>
date Mon, 01 Oct 2007 00:41:25 -0500
parents 4920d6d4ac6e
children e82ad057d1db fbe7468efaea
files src/audacious/playback.c src/audacious/ui_main.c src/audacious/ui_main.h
diffstat 3 files changed, 17 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/playback.c	Sun Sep 30 12:02:15 2007 -0500
+++ b/src/audacious/playback.c	Mon Oct 01 00:41:25 2007 -0500
@@ -59,8 +59,20 @@
 #include "playback.h"
 #include "playback_evlisteners.h"
 
-static int song_info_timeout_source = 0;
+static gint song_info_timeout_source = 0;
+static gint update_vis_timeout_source = 0;
 
+/* XXX: there has to be a better way than polling here! */
+static gboolean
+playback_update_vis_func(gpointer unused)
+{
+    if (!playback_get_playing())
+        return FALSE;
+
+    input_update_vis(playback_get_time());
+
+    return TRUE;
+}
 
 static gint
 playback_set_pb_ready(InputPlayback *playback)
@@ -153,6 +165,9 @@
     song_info_timeout_source = g_timeout_add(1000,
         (GSourceFunc) mainwin_update_song_info, NULL);
 
+    update_vis_timeout_source = g_timeout_add(10,
+        (GSourceFunc) playback_update_vis_func, NULL);
+
     if (cfg.player_shaded) {
         gtk_widget_show(mainwin_stime_min);
         gtk_widget_show(mainwin_stime_sec);
--- a/src/audacious/ui_main.c	Sun Sep 30 12:02:15 2007 -0500
+++ b/src/audacious/ui_main.c	Mon Oct 01 00:41:25 2007 -0500
@@ -2666,9 +2666,6 @@
 {
     static gint count = 0;
 
-    if (playback_get_playing())  
-        input_update_vis(playback_get_time());    
-
     GDK_THREADS_ENTER();
 
     if (!count) {
--- a/src/audacious/ui_main.h	Sun Sep 30 12:02:15 2007 -0500
+++ b/src/audacious/ui_main.h	Mon Oct 01 00:41:25 2007 -0500
@@ -35,7 +35,7 @@
 #define MAINWIN_SHADED_WIDTH     MAINWIN_WIDTH
 #define MAINWIN_SHADED_HEIGHT    MAINWIN_TITLEBAR_HEIGHT
 
-#define MAINWIN_UPDATE_INTERVAL  10
+#define MAINWIN_UPDATE_INTERVAL  100
 
 #define MAINWIN_DEFAULT_POS_X    20
 #define MAINWIN_DEFAULT_POS_Y    20