changeset 2203:60bd49189fde trunk

[svn] - two realcolour modes for voiceprint vis: Fire and Ice - removed duplicate code from vis.c
author marvin
date Fri, 22 Dec 2006 20:10:22 -0800
parents d1804718c5cc
children ad13a4414f45
files ChangeLog audacious/main.c audacious/main.h audacious/mainwin.c audacious/visualization.c audacious/widgets/svis.c audacious/widgets/vis.c audacious/widgets/vis.h
diffstat 8 files changed, 361 insertions(+), 295 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Fri Dec 22 17:35:11 2006 -0800
+++ b/ChangeLog	Fri Dec 22 20:10:22 2006 -0800
@@ -1,3 +1,12 @@
+2006-12-23 01:35:11 +0000  Giacomo Lozito <james@develia.org>
+  revision [3409]
+  - playlist manager, work done for data consistency; now it should react and update when it is active and playlists are created/modified/deleted outside the manager (i.e. with keyboard shortcuts)
+  trunk/audacious/playlist.c         |   20 ++++++++++++++
+  trunk/audacious/playlist_manager.c |   52 ++++++++++++++++++++++++++++++++-----
+  trunk/audacious/playlist_manager.h |    1 
+  3 files changed, 66 insertions(+), 7 deletions(-)
+
+
 2006-12-23 00:29:35 +0000  Giacomo Lozito <james@develia.org>
   revision [3407]
   - added initial code for playlist manager, that allows to create, delete and switch playlists
--- a/audacious/main.c	Fri Dec 22 17:35:11 2006 -0800
+++ b/audacious/main.c	Fri Dec 22 20:10:22 2006 -0800
@@ -174,6 +174,7 @@
     ANALYZER_NORMAL,            /* analyzer mode */
     ANALYZER_BARS,              /* analyzer type */
     SCOPE_DOT,                  /* scope mode */
+    VOICEPRINT_NORMAL,          /* voiceprint mode */
     VU_SMOOTH,                  /* VU mode */
     REFRESH_FULL,               /* visualizer refresh rate */
     FALLOFF_FAST,               /* analyzer fall off rate */
@@ -323,6 +324,7 @@
     {"analyzer_type", &cfg.analyzer_type, TRUE},
     {"scope_mode", &cfg.scope_mode, TRUE},
     {"vu_mode", &cfg.vu_mode, TRUE},
+    {"voiceprint_mode", &cfg.voiceprint_mode, TRUE},
     {"vis_refresh_rate", &cfg.vis_refresh, TRUE},
     {"analyzer_falloff", &cfg.analyzer_falloff, TRUE},
     {"peaks_falloff", &cfg.peaks_falloff, TRUE},
--- a/audacious/main.h	Fri Dec 22 17:35:11 2006 -0800
+++ b/audacious/main.h	Fri Dec 22 20:10:22 2006 -0800
@@ -97,6 +97,7 @@
     gint vis_type;
     gint analyzer_mode, analyzer_type;
     gint scope_mode;
+    gint voiceprint_mode;
     gint vu_mode, vis_refresh;
     gint analyzer_falloff, peaks_falloff;
     gint playlist_position;
--- a/audacious/mainwin.c	Fri Dec 22 17:35:11 2006 -0800
+++ b/audacious/mainwin.c	Fri Dec 22 20:10:22 2006 -0800
@@ -83,7 +83,7 @@
 #define TRISTATE_THRESHOLD 200
 
 /*
- * If you change the menu above change these defines also
+ * If you change the menu below change these defines also
  */
 
 #define MAINWIN_VIS_MENU_VIS_MODE               1
@@ -95,13 +95,15 @@
 #define MAINWIN_VIS_MENU_ANALYZER_PEAKS         13
 #define MAINWIN_VIS_MENU_SCOPE_MODE             15
 #define MAINWIN_VIS_MENU_NUM_SCOPE_MODE         3
-#define MAINWIN_VIS_MENU_WSHADEVU_MODE          19
+#define MAINWIN_VIS_MENU_VOICEPRINT_MODE        19
+#define MAINWIN_VIS_MENU_NUM_VOICEPRINT_MODE    3
+#define MAINWIN_VIS_MENU_WSHADEVU_MODE          23
 #define MAINWIN_VIS_MENU_NUM_WSHADEVU_MODE      2
-#define MAINWIN_VIS_MENU_REFRESH_RATE           22
+#define MAINWIN_VIS_MENU_REFRESH_RATE           26
 #define MAINWIN_VIS_MENU_NUM_REFRESH_RATE       4
-#define MAINWIN_VIS_MENU_AFALLOFF               27
+#define MAINWIN_VIS_MENU_AFALLOFF               31
 #define MAINWIN_VIS_MENU_NUM_AFALLOFF           5
-#define MAINWIN_VIS_MENU_PFALLOFF               33
+#define MAINWIN_VIS_MENU_PFALLOFF               37
 #define MAINWIN_VIS_MENU_NUM_PFALLOFF           5
 
 #define VOLSET_DISP_TIMES 5
@@ -138,6 +140,7 @@
     MAINWIN_VIS_ANALYZER_LINES, MAINWIN_VIS_ANALYZER_BARS,
     MAINWIN_VIS_ANALYZER_PEAKS,
     MAINWIN_VIS_SCOPE_DOT, MAINWIN_VIS_SCOPE_LINE, MAINWIN_VIS_SCOPE_SOLID,
+    MAINWIN_VIS_VOICEPRINT_NORMAL, MAINWIN_VIS_VOICEPRINT_FIRE, MAINWIN_VIS_VOICEPRINT_ICE,
     MAINWIN_VIS_VU_NORMAL, MAINWIN_VIS_VU_SMOOTH,
     MAINWIN_VIS_REFRESH_FULL, MAINWIN_VIS_REFRESH_HALF,
     MAINWIN_VIS_REFRESH_QUARTER, MAINWIN_VIS_REFRESH_EIGHTH,
@@ -301,6 +304,13 @@
      MAINWIN_VIS_SCOPE_LINE, "/Scope Mode/Dot Scope", NULL},
     {N_("/Scope Mode/Solid Scope"), NULL, mainwin_vis_menu_callback,
      MAINWIN_VIS_SCOPE_SOLID, "/Scope Mode/Dot Scope", NULL},
+    {N_("/Voiceprint mode"), NULL, NULL, 0, "<Branch>", NULL},
+    {N_("/Voiceprint mode/Normal"), NULL, mainwin_vis_menu_callback,
+    MAINWIN_VIS_VOICEPRINT_NORMAL, "<RadioItem>", NULL},
+    {N_("/Voiceprint mode/Fire"), NULL, mainwin_vis_menu_callback,
+    MAINWIN_VIS_VOICEPRINT_FIRE, "/Voiceprint mode/Normal", NULL},
+    {N_("/Voiceprint mode/Ice"), NULL, mainwin_vis_menu_callback,
+    MAINWIN_VIS_VOICEPRINT_ICE, "/Voiceprint mode/Normal", NULL},
     {N_("/WindowShade VU Mode"), NULL, NULL, 0, "<Branch>", NULL},
     {N_("/WindowShade VU Mode/Normal"), NULL, mainwin_vis_menu_callback,
      MAINWIN_VIS_VU_NORMAL, "<RadioItem>", NULL},
@@ -2976,7 +2986,7 @@
                           guint action,
                           GtkWidget * item)
 {
-    switch (action) {
+  switch (action) {
     case MAINWIN_VIS_ANALYZER:
     case MAINWIN_VIS_SCOPE:
     case MAINWIN_VIS_VOICEPRINT:
@@ -3000,6 +3010,11 @@
     case MAINWIN_VIS_SCOPE_SOLID:
         cfg.scope_mode = action - MAINWIN_VIS_SCOPE_DOT;
         break;
+    case MAINWIN_VIS_VOICEPRINT_NORMAL:
+    case MAINWIN_VIS_VOICEPRINT_FIRE:
+    case MAINWIN_VIS_VOICEPRINT_ICE:
+        cfg.voiceprint_mode = action - MAINWIN_VIS_VOICEPRINT_NORMAL;
+        break;
     case MAINWIN_VIS_VU_NORMAL:
     case MAINWIN_VIS_VU_SMOOTH:
         cfg.vu_mode = action - MAINWIN_VIS_VU_NORMAL;
--- a/audacious/visualization.c	Fri Dec 22 17:35:11 2006 -0800
+++ b/audacious/visualization.c	Fri Dec 22 20:10:22 2006 -0800
@@ -425,12 +425,19 @@
 	  if (!mono_freq_calced)
 	    calc_mono_freq(mono_freq, pcm_data, nch);
 	  memset(intern_vis_data, 0, 256);
-	  /* Subsampling; 8 frequencies per sample*/
-	  for(i = 0; i < 256 ; i++)
-	    intern_vis_data[i>>2] += (mono_freq[0][i] >> 8);
-	  /* Nonlinear transfer function makes the tones stand out*/
-	  //for(i = 0; i < 16 ; i++)
-	  // intern_vis_data[i] = pow(1.2, intern_vis_data[i]);
+	  /* For the values [0-16] we use the frequency that's 3/2 as much.
+	  If we assume the 512 values calculated by calc_mono_freq to cover 0-22kHz linearly
+	  we get a range of [0-16] * 3/2 * 22000/512 = [0-1,031] Hz.
+	  Most stuff above that is harmonics and we want to utilize the 16 samples we have
+	  to the max[tm]
+	  */
+	  for(i = 0; i < 50 ; i+=3){
+	    intern_vis_data[i/3] += (mono_freq[0][i/2] >> 5);
+	    
+	    /*Boost frequencies above 257Hz a little*/
+	    //if(i > 4 * 3)
+	    //  intern_vis_data[i/3] += 8;
+	  }
 	}
     }
     else { /* (cfg.vis_type == VIS_SCOPE) */
--- a/audacious/widgets/svis.c	Fri Dec 22 17:35:11 2006 -0800
+++ b/audacious/widgets/svis.c	Fri Dec 22 20:10:22 2006 -0800
@@ -119,7 +119,7 @@
 
     if (!cfg.doublesize) {
       memset(rgb_data, 0, SVIS_WIDTH * SVIS_HEIGHT);
-      if (cfg.vis_type == VIS_ANALYZER) {
+      if (cfg.vis_type == VIS_ANALYZER  && !bmp_playback_get_paused() && bmp_playback_get_playing()){
 	for(y=0; y < SVIS_HEIGHT; y++){
 	  if (cfg.analyzer_type == ANALYZER_BARS){
 	    for(x=0;x< SVIS_WIDTH; x++){
@@ -188,7 +188,7 @@
     else {                      /* doublesize */
 
         memset(rgb_data, 0, SVIS_WIDTH * 2 * SVIS_HEIGHT * 2);
-        if (cfg.vis_type == VIS_ANALYZER) {
+        if (cfg.vis_type == VIS_ANALYZER && !bmp_playback_get_paused() && bmp_playback_get_playing()){
 	  for(y=0; y < SVIS_HEIGHT; y++){
             if (cfg.analyzer_type == ANALYZER_BARS){
               for(x=0;x< SVIS_WIDTH; x++){
--- a/audacious/widgets/vis.c	Fri Dec 22 17:35:11 2006 -0800
+++ b/audacious/widgets/vis.c	Fri Dec 22 20:10:22 2006 -0800
@@ -34,8 +34,9 @@
 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];
-
+static guint8 vs_data_ext[76 * 16 * 4];
+static guint8 voiceprint_data_normal[76*16];
+static guint8 voiceprint_data_rgb[76*16*4];
 
 void
 vis_timeout_func(Vis * vis, guchar * data)
@@ -50,12 +51,10 @@
         g_timer_start(timer);
     }
     else {
-        g_timer_elapsed(timer, &micros);
-        if (micros > 14000)
-            g_timer_reset(timer);
-
+      g_timer_elapsed(timer, &micros);
+      if (micros > 14000)
+	g_timer_reset(timer);
     }
-
     if (cfg.vis_type == VIS_ANALYZER) {
         if (micros > 14000)
             falloff = TRUE;
@@ -102,7 +101,8 @@
       for(i = 0; i < 16; i++)
 	{
 	  /*The color palette is in the range [0-17]. This makes sure we stay there.*/
-	  vis->vs_data[i] = data[15 - i] > 17 ? 17 : data[15-i];
+	  /* x 4*/
+	  vis->vs_data[i] = data[15 - i] > 17 * 8 ? 17 * 8 : data[15-i];
 	}
     }
     else if (data) {
@@ -119,14 +119,13 @@
         vis->vs_refresh_delay--;
     }
 }
-
 void
 vis_draw(Widget * w)
 {
     Vis *vis = (Vis *) w;
-    gint x, y, h = 0, h2;
+    gint x, y, n, h = 0, h2;
     guchar vis_color[24][3];
-    guchar rgb_data[152 * 32], *ptr, c;
+    guchar rgb_data[76 * 16 * 3 * 2 * 2], *ptr, c;
     guint32 colors[24];
     GdkRgbCmap *cmap;
 
@@ -141,289 +140,304 @@
     cmap = gdk_rgb_cmap_new(colors, 24);
 
     if (!vis->vs_doublesize) {
-        memset(rgb_data, 0, 76 * 16);
-        for (y = 1; y < 16; y += 2) {
-            ptr = rgb_data + (y * 76);
-            for (x = 0; x < 76; x += 2, ptr += 2)
-                *ptr = 1;
-        }
-        if (cfg.vis_type == VIS_ANALYZER) {
-            for (x = 0; x < 75; x++) {
-                if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0)
-                    h = vis->vs_data[x >> 2];
-                else if (cfg.analyzer_type == ANALYZER_LINES)
-                    h = vis->vs_data[x];
-                if (h && (cfg.analyzer_type == ANALYZER_LINES ||
-                          (x % 4) != 3)) {
-                    ptr = rgb_data + ((16 - h) * 76) + x;
-                    switch (cfg.analyzer_mode) {
-                    case ANALYZER_NORMAL:
-                        for (y = 0; y < h; y++, ptr += 76)
-                            *ptr = 18 - h + y;
-                        break;
-                    case ANALYZER_FIRE:
-                        for (y = 0; y < h; y++, ptr += 76)
-                            *ptr = y + 2;
-                        break;
-                    case ANALYZER_VLINES:
-                        for (y = 0; y < h; y++, ptr += 76)
-                            *ptr = 18 - h;
-                        break;
-                    }
-                }
-            }
-            if (cfg.analyzer_peaks) {
-                for (x = 0; x < 75; x++) {
-                    if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0)
-                        h = vis->vs_peak[x >> 2];
-                    else if (cfg.analyzer_type == ANALYZER_LINES)
-                        h = vis->vs_peak[x];
-                    if (h
-                        && (cfg.analyzer_type == ANALYZER_LINES
-                            || (x % 4) != 3))
-                        rgb_data[(16 - h) * 76 + x] = 23;
-                }
-            }
-        }
-	else if (cfg.vis_type == VIS_VOICEPRINT) {
-	  if(!bmp_playback_get_paused() && bmp_playback_get_playing()){/*Don't scroll when it's paused or stopped*/
-	    for (y = 0; y < 16; y ++) 
+      memset(rgb_data, 0, 76 * 16);
+      for (y = 1; y < 16; y += 2) {
+	ptr = rgb_data + (y * 76);
+	for (x = 0; x < 76; x += 2, ptr += 2)
+	  *ptr = 1;
+      }
+    }
+    else{
+      memset(rgb_data, 0, 152 * 32);
+      for (y = 1; y < 16; y += 2) {
+	ptr = rgb_data + (y * 304);
+	for (x = 0; x < 76; x += 2, ptr += 4) {
+	  *ptr = 1;
+	  *(ptr + 1) = 1;
+	  *(ptr + 152) = 1;
+	  *(ptr + 153) = 1;
+	}
+      }
+    }
+    if (cfg.vis_type == VIS_ANALYZER) {
+      for (x = 0; x < 75; x++) {
+	if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0)
+	  h = vis->vs_data[x >> 2];
+	else if (cfg.analyzer_type == ANALYZER_LINES)
+	  h = vis->vs_data[x];
+	if (h && (cfg.analyzer_type == ANALYZER_LINES ||
+		  (x % 4) != 3)) {
+	  if (!vis->vs_doublesize) {
+	    ptr = rgb_data + ((16 - h) * 76) + x;
+	    switch (cfg.analyzer_mode) {
+	    case ANALYZER_NORMAL:
+	      for (y = 0; y < h; y++, ptr += 76)
+		*ptr = 18 - h + y;
+	      break;
+	    case ANALYZER_FIRE:
+	      for (y = 0; y < h; y++, ptr += 76)
+		*ptr = y + 2;
+	      break;
+	    case ANALYZER_VLINES:
+	      for (y = 0; y < h; y++, ptr += 76)
+		*ptr = 18 - h;
+	      break;
+	    }
+	  }
+	  else{
+	    ptr = rgb_data + ((16 - h) * 304) + (x << 1);
+	    switch (cfg.analyzer_mode) {
+	    case ANALYZER_NORMAL:
+	      for (y = 0; y < h; y++, ptr += 304) {
+		*ptr = 18 - h + y;
+		*(ptr + 1) = 18 - h + y;
+		*(ptr + 152) = 18 - h + y;
+		*(ptr + 153) = 18 - h + y;
+	      }
+	      break;
+	    case ANALYZER_FIRE:
+	      for (y = 0; y < h; y++, ptr += 304) {
+		*ptr = y + 2;
+		*(ptr + 1) = y + 2;
+		*(ptr + 152) = y + 2;
+		*(ptr + 153) = y + 2;
+	      }
+	      break;
+	    case ANALYZER_VLINES:
+	      for (y = 0; y < h; y++, ptr += 304) {
+		*ptr = 18 - h;
+		*(ptr + 1) = 18 - h;
+		*(ptr + 152) = 18 - h;
+		*(ptr + 153) = 18 - h;
+	      }
+	      
+	      break;
+	    }
+	  }
+	}
+      }
+      if (cfg.analyzer_peaks) {
+	for (x = 0; x < 75; x++) {
+	  if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0)
+	    h = vis->vs_peak[x >> 2];
+	  else if (cfg.analyzer_type == ANALYZER_LINES)
+	    h = vis->vs_peak[x];
+	  if (h && (cfg.analyzer_type == ANALYZER_LINES || (x % 4) != 3)){
+	    
+	    if (!vis->vs_doublesize) {
+	      rgb_data[(16 - h) * 76 + x] = 23;
+	    }
+	    else{
+	      ptr = rgb_data + (16 - h) * 304 + (x << 1);
+	      *ptr = 23;
+	      *(ptr + 1) = 23;
+	      *(ptr + 152) = 23;
+	      *(ptr + 153) = 23;
+	    }
+	  }
+	}
+      }
+    }
+    else if (cfg.vis_type == VIS_VOICEPRINT) {
+      if(!bmp_playback_get_paused() && bmp_playback_get_playing()){/*Don't scroll when it's paused or stopped*/
+	if(cfg.voiceprint_mode == VOICEPRINT_NORMAL){
+	  for (y = 0; y < 16; y ++) 
+	    for (x = 75; x > 0; x--)
+	      voiceprint_data_normal[x + y * 76] = voiceprint_data_normal[x-1+y*76];
+	  for(y=0;y<16;y++)
+	    voiceprint_data_normal[y * 76] = vis->vs_data[y] / 6;
+	  if (!vis->vs_doublesize) {
+	    memcpy(rgb_data, voiceprint_data_normal,16*76);	    
+	  }
+	  else{
+	    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];
+		{
+		  ptr = rgb_data + (x << 1) + y * 304;
+		  /*draw a 2x2 area with the same data*/
+		  *ptr = voiceprint_data_normal[x + y * 76];
+		  *(ptr + 1) = voiceprint_data_normal[x + y * 76];
+		  *(ptr + 152) = voiceprint_data_normal[x + y * 76];
+		  *(ptr + 153) = voiceprint_data_normal[x + y * 76];
+		}
+	    }
 	  }
-	  memcpy(rgb_data, vs_data_ext,1216);
 	}
-        else if (cfg.vis_type == VIS_SCOPE) {
-            for (x = 0; x < 75; x++) {
-                switch (cfg.scope_mode) {
-                case SCOPE_DOT:
-                    h = vis->vs_data[x];
-                    ptr = rgb_data + ((14 - h) * 76) + x;
-                    *ptr = vis_scope_colors[h + 1];
-                    break;
-                case SCOPE_LINE:
-                    if (x != 74) {
-                        h = 14 - vis->vs_data[x];
-                        h2 = 14 - vis->vs_data[x + 1];
-                        if (h > h2) {
-                            y = h;
-                            h = h2;
-                            h2 = y;
-                        }
-                        ptr = rgb_data + (h * 76) + x;
-                        for (y = h; y <= h2; y++, ptr += 76)
-                            *ptr = vis_scope_colors[y - 2];
+	else { /* RGB modes */
+	  if(cfg.voiceprint_mode == VOICEPRINT_FIRE){
+	    for(x=76*16*3;x > 2;x--)
+	      voiceprint_data_rgb[x] = voiceprint_data_rgb[x-3];  
+	    for(y=0;y<16;y++)
+	      {
+		gfloat d = vis->vs_data[y] * 1.8;
+		voiceprint_data_rgb[y * 76*3] = d < 128 ? (d * 2) : 255; //R
+		voiceprint_data_rgb[y * 76*3+1] = d < 128 ? 0 : (d < 192 ? (d-128) * 4 : 255); //G
+		voiceprint_data_rgb[y * 76*3+2] = d < 192 ? 0 : (d-192) * 4; //B
+	      }
+	    
+	    
+	  }
+	  else if(cfg.voiceprint_mode == VOICEPRINT_ICE){	    
+	    for(x=76*16*3;x > 2;x--)
+	      voiceprint_data_rgb[x] = voiceprint_data_rgb[x-3];  
+	    for(y=0;y<16;y++)
+	      {
+		gfloat d = vis->vs_data[y] * 1.8;
+		voiceprint_data_rgb[y * 76*3] = d < 192 ? 0 : (d-192) * 4; //R
+		voiceprint_data_rgb[y * 76*3+1] = d < 192 ? 0 : (d-192) * 4; //G
+		voiceprint_data_rgb[y * 76*3+2] = d < 128 ? d * 2 : 255; //B
+	      }
+	  }
+	  if(!vis->vs_doublesize){
+	    memcpy(rgb_data, voiceprint_data_rgb,16*76*4);
+	  }
+	  else{
+	    for (y = 0; y < 16; y++) {
+	      for (x = 0; x < 76; x++)
+		{
+		  ptr = rgb_data + x * 3 * 2 + y * 2 * 76 * 3 * 2;
+		  for(n=0;n<3;n++)
+		    {
+		      /*draw a 2x2 area with the same data*/
+		      *(ptr + n) = voiceprint_data_rgb[x * 3 + n + y * 76 * 3];
+		      *(ptr + n + 3) = voiceprint_data_rgb[x * 3 + n + y * 76  * 3];
+		      *(ptr + n + 76 * 2 * 3) = voiceprint_data_rgb[x * 3 + n + y * 76 * 3];
+		      *(ptr + n + 3 + 76 * 2 * 3) = voiceprint_data_rgb[x * 3 + n + y * 76 * 3];
+		    }
+		}
+	    }
+	  }
+	}
+      }
+    }
+    else if (cfg.vis_type == VIS_SCOPE) {
+      for (x = 0; x < 75; x++) {
+	switch (cfg.scope_mode) {
+	case SCOPE_DOT:
+	  h = vis->vs_data[x];
+	  if (!vis->vs_doublesize) {
+	  ptr = rgb_data + ((14 - h) * 76) + x;
+	    *ptr = vis_scope_colors[h + 1];
+	  }else{
+	    ptr = rgb_data + ((14 - h) * 304) + (x << 1);
+	    *ptr = vis_scope_colors[h + 1];
+	    *(ptr + 1) = vis_scope_colors[h + 1];
+	    *(ptr + 152) = vis_scope_colors[h + 1];
+	    *(ptr + 153) = vis_scope_colors[h + 1];
+	  }
+	  break;
+	case SCOPE_LINE:
+	  if (x != 74) {
+	    h = 14 - vis->vs_data[x];
+	    h2 = 14 - vis->vs_data[x + 1];
+	    if (h > h2) {
+	      y = h;
+	      h = h2;
+	      h2 = y;
+	    }
+	    if (!vis->vs_doublesize) {
+	    ptr = rgb_data + (h * 76) + x;
+	    for (y = h; y <= h2; y++, ptr += 76)
+	      *ptr = vis_scope_colors[y - 2];
+	    }
+	    else{
+	      ptr = rgb_data + (h * 304) + (x << 1);
+	      for (y = h; y <= h2; y++, ptr += 304) {
+		*ptr = vis_scope_colors[y - 2];
+		*(ptr + 1) = vis_scope_colors[y - 2];
+		*(ptr + 152) = vis_scope_colors[y - 2];
+		*(ptr + 153) = vis_scope_colors[y - 2];
+	      }
+	    }
+	  }
+	  else {
+	    h = 14 - vis->vs_data[x];
+	    if (!vis->vs_doublesize) {
+	      ptr = rgb_data + (h * 76) + x;
+	      *ptr = vis_scope_colors[h + 1];
+	    }else{
+	      ptr = rgb_data + (h * 304) + (x << 1);
+	      *ptr = vis_scope_colors[h + 1];
+	      *(ptr + 1) = vis_scope_colors[h + 1];
+	      *(ptr + 152) = vis_scope_colors[h + 1];
+	      *(ptr + 153) = vis_scope_colors[h + 1];
+	    }
+	  }
+	  break;
+	case SCOPE_SOLID:
+	  h = 14 - vis->vs_data[x];
+	  h2 = 8;
+	  c = vis_scope_colors[(gint) vis->vs_data[x]];
+	  if (h > h2) {
+	    y = h;
+	    h = h2;
+	    h2 = y;
+	  }
+	  if (!vis->vs_doublesize) {
+	    ptr = rgb_data + (h * 76) + x;
+	    for (y = h; y <= h2; y++, ptr += 76)
+	      *ptr = c;
+	  }else{
+	    ptr = rgb_data + (h * 304) + (x << 1);
+	    for (y = h; y <= h2; y++, ptr += 304) {
+	      *ptr = c;
+	      *(ptr + 1) = c;
+	      *(ptr + 152) = c;
+	      *(ptr + 153) = c;
+	    }
+	  }
+	  break;
+	}
+      }
+    }
+    
 
-                    }
-                    else {
-                        h = 14 - vis->vs_data[x];
-                        ptr = rgb_data + (h * 76) + x;
-                        *ptr = vis_scope_colors[h + 1];
-                    }
-                    break;
-                case SCOPE_SOLID:
-                    h = 14 - vis->vs_data[x];
-                    h2 = 8;
-                    c = vis_scope_colors[(gint) vis->vs_data[x]];
-                    if (h > h2) {
-                        y = h;
-                        h = h2;
-                        h2 = y;
-                    }
-                    ptr = rgb_data + (h * 76) + x;
-                    for (y = h; y <= h2; y++, ptr += 76)
-                        *ptr = c;
-                    break;
-                }
-            }
-        }
-
-        /* FIXME: The check "shouldn't" be neccessary? */
-/*	if (GTK_IS_WINDOW(vis->vs_window)) { */
+    
+    if (!vis->vs_doublesize) {
         GDK_THREADS_ENTER();
-        gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc,
-                               vis->vs_widget.x, vis->vs_widget.y,
-                               vis->vs_widget.width, vis->vs_widget.height,
-                               GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data,
-                               76, cmap);
+	if (cfg.vis_type == VIS_VOICEPRINT && cfg.voiceprint_mode != VOICEPRINT_NORMAL){
+	  gdk_draw_rgb_image(vis->vs_window, vis->vs_widget.gc,
+			     vis->vs_widget.x, vis->vs_widget.y,
+			     vis->vs_widget.width, vis->vs_widget.height,
+			     GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data,
+			     76 * 3);
+	}
+	else{
+	  gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc,
+				 vis->vs_widget.x, vis->vs_widget.y,
+				 vis->vs_widget.width, vis->vs_widget.height,
+				 GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data,
+				 76, cmap);
+	}
         GDK_THREADS_LEAVE();
-/*	} else {
-		vis->vs_window = mainwin->window;
-	        GDK_THREADS_ENTER();
-	        gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc,
-                               vis->vs_widget.x, vis->vs_widget.y,
-                               vis->vs_widget.width, vis->vs_widget.height,
-                               GDK_RGB_DITHER_NORMAL, (guchar *) rgb_data,
-                               76, cmap);
-	        GDK_THREADS_LEAVE();
-        }
-*/
     }
     else {
-        memset(rgb_data, 0, 152 * 32);
-        for (y = 1; y < 16; y += 2) {
-            ptr = rgb_data + (y * 304);
-            for (x = 0; x < 76; x += 2, ptr += 4) {
-                *ptr = 1;
-                *(ptr + 1) = 1;
-                *(ptr + 152) = 1;
-                *(ptr + 153) = 1;
-            }
-        }
-        if (cfg.vis_type == VIS_ANALYZER) {
-            for (x = 0; x < 75; x++) {
-                if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0)
-                    h = vis->vs_data[x >> 2];
-                else if (cfg.analyzer_type == ANALYZER_LINES)
-                    h = vis->vs_data[x];
-                if (h
-                    && (cfg.analyzer_type == ANALYZER_LINES
-                        || (x % 4) != 3)) {
-                    ptr = rgb_data + ((16 - h) * 304) + (x << 1);
-                    switch (cfg.analyzer_mode) {
-                    case ANALYZER_NORMAL:
-                        for (y = 0; y < h; y++, ptr += 304) {
-                            *ptr = 18 - h + y;
-                            *(ptr + 1) = 18 - h + y;
-                            *(ptr + 152) = 18 - h + y;
-                            *(ptr + 153) = 18 - h + y;
-                        }
-                        break;
-                    case ANALYZER_FIRE:
-                        for (y = 0; y < h; y++, ptr += 304) {
-                            *ptr = y + 2;
-                            *(ptr + 1) = y + 2;
-                            *(ptr + 152) = y + 2;
-                            *(ptr + 153) = y + 2;
-                        }
-                        break;
-                    case ANALYZER_VLINES:
-                        for (y = 0; y < h; y++, ptr += 304) {
-                            *ptr = 18 - h;
-                            *(ptr + 1) = 18 - h;
-                            *(ptr + 152) = 18 - h;
-                            *(ptr + 153) = 18 - h;
-                        }
-
-                        break;
-                    }
-
-                }
-            }
-            if (cfg.analyzer_peaks) {
-
-                for (x = 0; x < 75; x++) {
-                    if (cfg.analyzer_type == ANALYZER_BARS && (x % 4) == 0)
-                        h = vis->vs_peak[x >> 2];
-                    else if (cfg.analyzer_type == ANALYZER_LINES)
-                        h = vis->vs_peak[x];
-
-                    if (h
-                        && (cfg.analyzer_type == ANALYZER_LINES
-                            || (x % 4) != 3)) {
-                        ptr = rgb_data + (16 - h) * 304 + (x << 1);
-                        *ptr = 23;
-                        *(ptr + 1) = 23;
-                        *(ptr + 152) = 23;
-                        *(ptr + 153) = 23;
-                    }
-                }
-            }
-        }
-	else if (cfg.vis_type == VIS_VOICEPRINT) {
-	  if(!bmp_playback_get_paused() && bmp_playback_get_playing()){/*Don't scroll when it's paused or stopped*/
-	    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];
-	  }
-	  for (y = 0; y < 16; y ++) {
-            for (x = 74; x > 0; x--)
-	      {
-		ptr = rgb_data + (x << 1) + y * 304;
-		/*draw a 2x2 area with the same data*/
-		*ptr = vs_data_ext[x + y * 76];
-		*(ptr + 1) = vs_data_ext[x + y * 76];
-		*(ptr + 152) = vs_data_ext[x + y * 76];
-		*(ptr + 153) = vs_data_ext[x + y * 76];
-	      }
-	  }
+      GDK_THREADS_ENTER();
+	if (cfg.vis_type == VIS_VOICEPRINT && cfg.voiceprint_mode != VOICEPRINT_NORMAL){
+	  gdk_draw_rgb_image(vis->vs_window, vis->vs_widget.gc,
+				 vis->vs_widget.x << 1,
+				 vis->vs_widget.y << 1,
+				 vis->vs_widget.width << 1,
+				 vis->vs_widget.height << 1,
+				 GDK_RGB_DITHER_NONE, (guchar *) rgb_data,
+				 76 * 2 * 3);
 	}
-        else if (cfg.vis_type == VIS_SCOPE) {
-            for (x = 0; x < 75; x++) {
-                switch (cfg.scope_mode) {
-                case SCOPE_DOT:
-                    h = vis->vs_data[x];
-                    ptr = rgb_data + ((14 - h) * 304) + (x << 1);
-                    *ptr = vis_scope_colors[h + 1];
-                    *(ptr + 1) = vis_scope_colors[h + 1];
-                    *(ptr + 152) = vis_scope_colors[h + 1];
-                    *(ptr + 153) = vis_scope_colors[h + 1];
-                    break;
-                case SCOPE_LINE:
-                    if (x != 74) {
-                        h = 14 - vis->vs_data[x];
-                        h2 = 14 - vis->vs_data[x + 1];
-                        if (h > h2) {
-                            y = h;
-                            h = h2;
-                            h2 = y;
-                        }
-                        ptr = rgb_data + (h * 304) + (x << 1);
-                        for (y = h; y <= h2; y++, ptr += 304) {
-                            *ptr = vis_scope_colors[y - 2];
-                            *(ptr + 1) = vis_scope_colors[y - 2];
-                            *(ptr + 152) = vis_scope_colors[y - 2];
-                            *(ptr + 153) = vis_scope_colors[y - 2];
-                        }
-                    }
-                    else {
-                        h = 14 - vis->vs_data[x];
-                        ptr = rgb_data + (h * 304) + (x << 1);
-                        *ptr = vis_scope_colors[h + 1];
-                        *(ptr + 1) = vis_scope_colors[h + 1];
-                        *(ptr + 152) = vis_scope_colors[h + 1];
-                        *(ptr + 153) = vis_scope_colors[h + 1];
-                    }
-                    break;
-                case SCOPE_SOLID:
-                    h = 14 - vis->vs_data[x];
-                    h2 = 8;
-                    c = vis_scope_colors[(gint) vis->vs_data[x]];
-                    if (h > h2) {
-                        y = h;
-                        h = h2;
-                        h2 = y;
-                    }
-                    ptr = rgb_data + (h * 304) + (x << 1);
-                    for (y = h; y <= h2; y++, ptr += 304) {
-                        *ptr = c;
-                        *(ptr + 1) = c;
-                        *(ptr + 152) = c;
-                        *(ptr + 153) = c;
-                    }
-                    break;
-                }
-            }
-        }
-
-        GDK_THREADS_ENTER();
-        gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc,
-                               vis->vs_widget.x << 1,
-                               vis->vs_widget.y << 1,
-                               vis->vs_widget.width << 1,
-                               vis->vs_widget.height << 1,
-                               GDK_RGB_DITHER_NONE, (guchar *) rgb_data,
-                               152, cmap);
-        GDK_THREADS_LEAVE();
+	else{
+      gdk_draw_indexed_image(vis->vs_window, vis->vs_widget.gc,
+			     vis->vs_widget.x << 1,
+			     vis->vs_widget.y << 1,
+			     vis->vs_widget.width << 1,
+			     vis->vs_widget.height << 1,
+			     GDK_RGB_DITHER_NONE, (guchar *) rgb_data,
+			     76 * 2 , cmap);
+	}
+      GDK_THREADS_LEAVE();
     }
-
     gdk_rgb_cmap_free(cmap);
 }
 
+	    
+
 void
 vis_clear_data(Vis * vis)
 {
@@ -464,6 +478,19 @@
     vis->vs_window = window;
 }
 
+void vis_draw_pixel(Vis * vis, guchar* texture, gint x, gint y, guint8 colour){
+  if(vis->vs_doublesize){
+    texture[y * 76 + x] = colour;
+    texture[y * 76 + x + 1] = colour;
+    texture[y * 76 * 4 + x] = colour;
+    texture[y * 76 * 4 + x + 1] = colour;
+  }
+  else{
+    texture[y * 76 + x] = colour;
+  }
+}
+
+
 Vis *
 create_vis(GList ** wlist,
            GdkPixmap * parent,
--- a/audacious/widgets/vis.h	Fri Dec 22 17:35:11 2006 -0800
+++ b/audacious/widgets/vis.h	Fri Dec 22 20:10:22 2006 -0800
@@ -46,6 +46,10 @@
 typedef enum {
     SCOPE_DOT, SCOPE_LINE, SCOPE_SOLID
 } ScopeMode;
+typedef enum {
+  VOICEPRINT_NORMAL, VOICEPRINT_FIRE, VOICEPRINT_ICE
+} VoiceprintMode;
+
 
 typedef enum {
     VU_NORMAL, VU_SMOOTH
@@ -73,6 +77,7 @@
 typedef struct _Vis Vis;
 
 void vis_draw(Widget * w);
+void vis_draw_pixel(Vis * vis, guchar *texture, gint x, gint y, guint8 colour);
 
 Vis *create_vis(GList ** wlist, GdkPixmap * parent, GdkWindow * window,
                 GdkGC * gc, gint x, gint y, gint width, gboolean doublesize);