changeset 2161:c12319817d7e trunk

[svn] - patch to add a scrolling voiceprint to the mini visualizer. Patch by: Troels Bang Jensen ([Marvin] on #audacious).
author nenolod
date Mon, 18 Dec 2006 08:44:33 -0800
parents fe6e7b9b4aac
children 48c8ecbfb282
files ChangeLog audacious/mainwin.c audacious/visualization.c audacious/widgets/svis.c audacious/widgets/vis.c audacious/widgets/vis.h
diffstat 6 files changed, 66 insertions(+), 5 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 18 07:31:51 2006 -0800
+++ b/ChangeLog	Mon Dec 18 08:44:33 2006 -0800
@@ -1,3 +1,11 @@
+2006-12-18 15:31:51 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
+  revision [3325]
+  - suppress noise on transition from pause to stop.
+  
+  trunk/audacious/playback.c |   10 ++++++----
+  1 file changed, 6 insertions(+), 4 deletions(-)
+
+
 2006-12-18 14:53:52 +0000  Yoshiki Yazawa <yaz@cc.rim.or.jp>
   revision [3323]
   - change the cleanup order in mainwin_quit_cb() to avoid freeze on quit.
--- a/audacious/mainwin.c	Mon Dec 18 07:31:51 2006 -0800
+++ b/audacious/mainwin.c	Mon Dec 18 08:44:33 2006 -0800
@@ -125,7 +125,7 @@
 };
 
 enum {
-    MAINWIN_VIS_ANALYZER, MAINWIN_VIS_SCOPE, MAINWIN_VIS_OFF,
+    MAINWIN_VIS_ANALYZER, MAINWIN_VIS_SCOPE, MAINWIN_VIS_VOICEPRINT, MAINWIN_VIS_OFF,
     MAINWIN_VIS_ANALYZER_NORMAL, MAINWIN_VIS_ANALYZER_FIRE,
     MAINWIN_VIS_ANALYZER_VLINES,
     MAINWIN_VIS_ANALYZER_LINES, MAINWIN_VIS_ANALYZER_BARS,
@@ -266,6 +266,8 @@
      MAINWIN_VIS_ANALYZER, "<RadioItem>", NULL},
     {N_("/Visualization Mode/Scope"), NULL, mainwin_vis_menu_callback,
      MAINWIN_VIS_SCOPE, "/Visualization Mode/Analyzer", NULL},
+    {N_("/Visualization Mode/Voiceprint"), NULL, mainwin_vis_menu_callback,
+     MAINWIN_VIS_VOICEPRINT, "/Visualization Mode/Analyzer", NULL},
     {N_("/Visualization Mode/Off"), NULL, mainwin_vis_menu_callback,
      MAINWIN_VIS_OFF, "/Visualization Mode/Analyzer", NULL},
     {N_("/Analyzer Mode"), NULL, NULL, 0, "<Branch>", NULL},
@@ -2958,6 +2960,7 @@
     switch (action) {
     case MAINWIN_VIS_ANALYZER:
     case MAINWIN_VIS_SCOPE:
+    case MAINWIN_VIS_VOICEPRINT:
     case MAINWIN_VIS_OFF:
         mainwin_vis_set_type_menu_cb(action - MAINWIN_VIS_ANALYZER);
         break;
--- a/audacious/visualization.c	Mon Dec 18 07:31:51 2006 -0800
+++ b/audacious/visualization.c	Mon Dec 18 08:44:33 2006 -0800
@@ -411,9 +411,17 @@
             }
         }
     }
-    else {                      /* (cfg.vis_type == VIS_SCOPE) */
+    else if(cfg.vis_type == VIS_VOICEPRINT){
+      if (!mono_freq_calced)
+	calc_mono_freq(mono_freq, pcm_data, nch);
+      for(i = 0; i < 16 ; i++)
+	{
+	  intern_vis_data[i] = mono_freq[0][i << 4];
+	}
+    }
+    else { /* (cfg.vis_type == VIS_SCOPE) */
 
-        /* Osciloscope */
+        /* Oscilloscope */
         gint pos, step;
 
         if (!mono_pcm_calced)
--- a/audacious/widgets/svis.c	Mon Dec 18 07:31:51 2006 -0800
+++ b/audacious/widgets/svis.c	Mon Dec 18 08:44:33 2006 -0800
@@ -148,6 +148,9 @@
                 break;
             }
         }
+	else if (cfg.vis_type == VIS_VOICEPRINT){
+	  
+	}
         else if (cfg.vis_type == VIS_SCOPE) {
             for (x = 0; x < 38; x++) {
                 h = svis->vs_data[x << 1] / 3;
--- a/audacious/widgets/vis.c	Mon Dec 18 07:31:51 2006 -0800
+++ b/audacious/widgets/vis.c	Mon Dec 18 08:44:33 2006 -0800
@@ -34,6 +34,8 @@
 static const gint vis_redraw_delays[] = { 1, 2, 4, 8 };
 static const guint8 vis_scope_colors[] =
     { 21, 21, 20, 20, 19, 19, 18, 19, 19, 20, 20, 21, 21 };
+static guint8 vs_data_ext[1216];
+
 
 void
 vis_timeout_func(Vis * vis, guchar * data)
@@ -41,7 +43,7 @@
     static GTimer *timer = NULL;
     gulong micros = 9999999;
     gboolean falloff = FALSE;
-    gint i;
+    gint i, n;
 
     if (!timer) {
         timer = g_timer_new();
@@ -96,6 +98,13 @@
             }
         }
     }
+    else if (cfg.vis_type == VIS_VOICEPRINT && data){
+      for(i = 0; i < 16; i++)
+	{
+	  vis->vs_data[i] = data[16 - i] >> 5 > 16 ? 16 : data[16-i] >> 5;
+       
+	}
+    }
     else if (data) {
         for (i = 0; i < 75; i++)
             vis->vs_data[i] = data[i];
@@ -176,6 +185,21 @@
                 }
             }
         }
+	else if (cfg.vis_type == VIS_VOICEPRINT) {
+	  for (y = 0; y < 16; y ++) {
+
+            for (x = 74; x > 0; x--)
+	      {
+		vs_data_ext[x + (y * 76)] = vs_data_ext[x-1+(y*76)];
+	      }
+	      } 
+	  for(y=0;y<16;y++){
+	    vs_data_ext[y * 76] = vis->vs_data[y];
+	  }
+	  
+	  memcpy(rgb_data, vs_data_ext,1216);
+	  
+	}
         else if (cfg.vis_type == VIS_SCOPE) {
             for (x = 0; x < 75; x++) {
                 switch (cfg.scope_mode) {
@@ -313,6 +337,20 @@
                 }
             }
         }
+	else if (cfg.vis_type == VIS_VOICEPRINT) {
+	  for (y = 0; y < 16; y ++) {
+            for (x = 74; x > 0; x--)
+	      {
+		vs_data_ext[x + (y * 76)] = vs_data_ext[x-1+(y*76)];
+		rgb_data[(x << 1)+ y * 304] = vs_data_ext[x-1+(y*76)];
+	      }
+	  } 
+	  for(y=0;y<16;y++){
+	    vs_data_ext[y * 76] = vis->vs_data[y];
+	  }
+	  //	  memcpy(rgb_data, vs_data_ext,1216);
+	  
+	}
         else if (cfg.vis_type == VIS_SCOPE) {
             for (x = 0; x < 75; x++) {
                 switch (cfg.scope_mode) {
--- a/audacious/widgets/vis.h	Mon Dec 18 07:31:51 2006 -0800
+++ b/audacious/widgets/vis.h	Mon Dec 18 08:44:33 2006 -0800
@@ -32,7 +32,7 @@
 #include "widget.h"
 
 typedef enum {
-    VIS_ANALYZER, VIS_SCOPE, VIS_OFF
+    VIS_ANALYZER, VIS_SCOPE, VIS_VOICEPRINT, VIS_OFF
 } VisType;
 
 typedef enum {
@@ -69,6 +69,7 @@
     gboolean vs_doublesize;
 };
 
+
 typedef struct _Vis Vis;
 
 void vis_draw(Widget * w);