changeset 4797:9b9bcf252a10

- provide a way to query current interface. - revive visualization when legacy interface is chosen.
author Yoshiki Yazawa <yaz@honeyplanet.jp>
date Sat, 11 Oct 2008 07:43:44 +0900
parents 62265a3a1870
children 0ea6dd6bfb5a
files src/audacious/input.c src/audacious/interface.c src/audacious/interface.h src/audacious/main.c
diffstat 4 files changed, 19 insertions(+), 8 deletions(-) [+]
line wrap: on
line diff
--- a/src/audacious/input.c	Sat Oct 11 02:32:37 2008 +0900
+++ b/src/audacious/input.c	Sat Oct 11 07:43:44 2008 +0900
@@ -155,7 +155,7 @@
     in.channels = nch;
     in.channels_order = SAD_CHORDER_INTERLEAVED;
     in.samplerate = 0;
-    
+
     out.sample_format = SAD_SAMPLE_S16;
     out.fracbits = 0;
     out.channels = nch;
@@ -171,12 +171,15 @@
 void
 input_add_vis_pcm(gint time, AFormat fmt, gint nch, gint length, gpointer ptr)
 {
-#if 0
     VisNode *vis_node;
     gint max;
-    
+    const Interface *current = interface_get_current();
+
     if (nch > 2) return;
 
+    if (current && !strstr(current->desc, "Legacy Interface"))
+        return;
+
     if (sad_state == NULL || nch != sad_nch || fmt != sad_fmt) {
         if(sad_state != NULL) SAD_dither_free(sad_state);
         sad_state = init_sad(fmt, nch);
@@ -202,7 +205,6 @@
     G_LOCK(vis_mutex);
     vis_list = g_list_append(vis_list, vis_node);
     G_UNLOCK(vis_mutex);
-#endif
 }
 
 void
@@ -398,7 +400,7 @@
         g_free(mimetype);
     } else
         ip = NULL;
-    
+
     if (ip && ip->enabled) {
         pr = input_do_check_file(ip, fd, filename_proxy, loading);
         if (pr) {
@@ -425,7 +427,7 @@
         base = g_path_get_basename(realfn);
         g_free(realfn);
         ext = strrchr(base, '.');
-    
+
         if(ext) {
             lext = g_ascii_strdown(ext+1, -1);
             list_hdr = g_hash_table_lookup(ext_hash, lext);
--- a/src/audacious/interface.c	Sat Oct 11 02:32:37 2008 +0900
+++ b/src/audacious/interface.c	Sat Oct 11 07:43:44 2008 +0900
@@ -30,6 +30,7 @@
 #include "ui_credits.h"
 
 static mowgli_dictionary_t *interface_dict_ = NULL;
+static Interface *current_interface = NULL;
 
 static InterfaceOps interface_ops = {
     .create_prefs_window = create_prefs_window,
@@ -62,6 +63,7 @@
 void
 interface_run(Interface *i)
 {
+    current_interface = i;
     i->ops = &interface_ops;
     i->init();
 }
@@ -81,3 +83,9 @@
 
     return mowgli_dictionary_retrieve(interface_dict_, id);
 }
+
+const Interface *
+interface_get_current(void)
+{
+    return current_interface;
+}
--- a/src/audacious/interface.h	Sat Oct 11 02:32:37 2008 +0900
+++ b/src/audacious/interface.h	Sat Oct 11 07:43:44 2008 +0900
@@ -57,5 +57,6 @@
 void interface_destroy(Interface *i);
 
 Interface *interface_get(gchar *id);
+const Interface *interface_get_current(void);
 
 #endif
--- a/src/audacious/main.c	Sat Oct 11 02:32:37 2008 +0900
+++ b/src/audacious/main.c	Sat Oct 11 07:43:44 2008 +0900
@@ -445,7 +445,7 @@
         gpointer def)
 {
     Playlist *playlist = playlist_new();
-    
+
     if (!playlist) {
         g_warning("Couldn't create new playlist for %s / %s\n", path, basename);
         return FALSE;
@@ -588,7 +588,7 @@
 
     g_message("Initializing plugin subsystems...");
     plugin_system_init();
-    
+
     g_message("Setting up playlists");
     playlist_system_init();