changeset 2171:7267fc6b2c67 trunk

[svn] -added analyzer vis to windowshade mode -changed order of windowshade visualizers to analyzer->Scope->VU -tweaked voiceprint in doublesize mode
author marvin
date Mon, 18 Dec 2006 16:37:47 -0800
parents d0312301163f
children 9a02f5ea1a9c
files ChangeLog audacious/visualization.c audacious/widgets/svis.c audacious/widgets/vis.c
diffstat 4 files changed, 134 insertions(+), 102 deletions(-) [+]
line wrap: on
line diff
--- a/ChangeLog	Mon Dec 18 14:47:48 2006 -0800
+++ b/ChangeLog	Mon Dec 18 16:37:47 2006 -0800
@@ -1,3 +1,10 @@
+2006-12-18 22:47:48 +0000  Giacomo Lozito <james@develia.org>
+  revision [3345]
+  fixed bug #699 about playlist->queue with patch provided by bug reporter
+  trunk/audacious/playlist.c |    1 +
+  1 file changed, 1 insertion(+)
+
+
 2006-12-18 22:01:29 +0000  Troels Bang Jensen <marvin@fnuck.dk>
   revision [3343]
   Added subsampling and nonlinear transfer function to the voiceprint 
--- a/audacious/visualization.c	Mon Dec 18 14:47:48 2006 -0800
+++ b/audacious/visualization.c	Mon Dec 18 16:37:47 2006 -0800
@@ -329,36 +329,6 @@
         return;
 
     if (cfg.vis_type == VIS_ANALYZER) {
-        if (cfg.player_shaded && cfg.player_visible) {
-            /* VU */
-            gint vu, val;
-
-            if (!stereo_pcm_calced)
-                calc_stereo_pcm(stereo_pcm, pcm_data, nch);
-            vu = 0;
-            for (i = 0; i < 512; i++) {
-                val = abs(stereo_pcm[0][i]);
-                if (val > vu)
-                    vu = val;
-            }
-            intern_vis_data[0] = (vu * 37) >> 15;
-            if (intern_vis_data[0] > 37)
-                intern_vis_data[0] = 37;
-            if (nch == 2) {
-                vu = 0;
-                for (i = 0; i < 512; i++) {
-                    val = abs(stereo_pcm[1][i]);
-                    if (val > vu)
-                        vu = val;
-                }
-                intern_vis_data[1] = (vu * 37) >> 15;
-                if (intern_vis_data[1] > 37)
-                    intern_vis_data[1] = 37;
-            }
-            else
-                intern_vis_data[1] = intern_vis_data[0];
-        }
-        else {
             /* Spectrum analyzer */
             /* 76 values */
             const gint long_xscale[] =
@@ -409,19 +379,50 @@
                 else
                     intern_vis_data[i] = 0;
             }
-        }
+        
     }
     else if(cfg.vis_type == VIS_VOICEPRINT){
-      if (!mono_freq_calced)
-	calc_mono_freq(mono_freq, pcm_data, nch);
-      
-      /* Subsampling; 8 frequencies per sample*/
-      for(i = 0; i < 256 ; i++)
-	intern_vis_data[i] = (mono_freq[0][i] >> 9);
+        if (cfg.player_shaded && cfg.player_visible) {
+            /* VU */
+            gint vu, val;
 
-      /* Nonlinear transfer function makes the tones stand out*/
-      for(i = 0; i < 16 ; i++)
-	intern_vis_data[i] = pow(2, intern_vis_data[i]);
+            if (!stereo_pcm_calced)
+                calc_stereo_pcm(stereo_pcm, pcm_data, nch);
+            vu = 0;
+            for (i = 0; i < 512; i++) {
+                val = abs(stereo_pcm[0][i]);
+                if (val > vu)
+                    vu = val;
+            }
+            intern_vis_data[0] = (vu * 37) >> 15;
+            if (intern_vis_data[0] > 37)
+                intern_vis_data[0] = 37;
+            if (nch == 2) {
+                vu = 0;
+                for (i = 0; i < 512; i++) {
+                    val = abs(stereo_pcm[1][i]);
+                    if (val > vu)
+                        vu = val;
+                }
+                intern_vis_data[1] = (vu * 37) >> 15;
+                if (intern_vis_data[1] > 37)
+                    intern_vis_data[1] = 37;
+            }
+            else
+                intern_vis_data[1] = intern_vis_data[0];
+        }
+	else{ /*Voiceprint*/
+	  if (!mono_freq_calced)
+	    calc_mono_freq(mono_freq, pcm_data, nch);
+	  
+	  /* Subsampling; 8 frequencies per sample*/
+	  for(i = 0; i < 256 ; i++)
+	    intern_vis_data[i] = (mono_freq[0][i] >> 9);
+	  
+	  /* Nonlinear transfer function makes the tones stand out*/
+	  for(i = 0; i < 16 ; i++)
+	    intern_vis_data[i] = pow(2, intern_vis_data[i]);
+	}
     }
     else { /* (cfg.vis_type == VIS_SCOPE) */
 
--- a/audacious/widgets/svis.c	Mon Dec 18 14:47:48 2006 -0800
+++ b/audacious/widgets/svis.c	Mon Dec 18 16:37:47 2006 -0800
@@ -65,7 +65,7 @@
 
     }
 
-    if (cfg.vis_type == INPUT_VIS_ANALYZER) {
+    if (cfg.vis_type == VIS_VOICEPRINT) {
         if (micros > 14000)
             falloff = TRUE;
 
@@ -120,36 +120,43 @@
     if (!cfg.doublesize) {
         memset(rgb_data, 0, SVIS_WIDTH * SVIS_HEIGHT);
         if (cfg.vis_type == VIS_ANALYZER) {
-            switch (cfg.vu_mode) {
-            case VU_NORMAL:
-                for (y = 0; y < 2; y++) {
-                    ptr = rgb_data + ((y * 3) * 38);
-                    h = (svis->vs_data[y] * 7) / 37;
-                    for (x = 0; x < h; x++, ptr += 5) {
-                        c = svis_vu_normal_colors[x];
-                        *(ptr) = c;
-                        *(ptr + 1) = c;
-                        *(ptr + 2) = c;
-                        *(ptr + 38) = c;
-                        *(ptr + 39) = c;
-                        *(ptr + 40) = c;
-                    }
-                }
-                break;
-            case VU_SMOOTH:
-                for (y = 0; y < 2; y++) {
-                    ptr = rgb_data + ((y * 3) * SVIS_WIDTH);
-                    for (x = 0; x < svis->vs_data[y]; x++, ptr++) {
-                        c = 17 - ((x * 15) / 37);
-                        *(ptr) = c;
-                        *(ptr + 38) = c;
-                    }
-                }
-                break;
-            }
+	  for(y=0; y < SVIS_HEIGHT; y++){
+	    for(x=0;x< SVIS_WIDTH; x++){
+	      if(svis->vs_data[x] > y << 1)
+		{
+		  rgb_data[x + (SVIS_HEIGHT - y) * SVIS_WIDTH] = 23;
+		}
+	    }
+	  }
         }
 	else if (cfg.vis_type == VIS_VOICEPRINT){
-	  
+	  switch (cfg.vu_mode) {
+	  case VU_NORMAL:
+	    for (y = 0; y < 2; y++) {
+	      ptr = rgb_data + ((y * 3) * 38);
+	      h = (svis->vs_data[y] * 7) / 37;
+	      for (x = 0; x < h; x++, ptr += 5) {
+		c = svis_vu_normal_colors[x];
+		*(ptr) = c;
+		*(ptr + 1) = c;
+		*(ptr + 2) = c;
+		*(ptr + 38) = c;
+		*(ptr + 39) = c;
+		*(ptr + 40) = c;
+	      }
+	    }
+	    break;
+	  case VU_SMOOTH:
+	    for (y = 0; y < 2; y++) {
+	      ptr = rgb_data + ((y * 3) * SVIS_WIDTH);
+	      for (x = 0; x < svis->vs_data[y]; x++, ptr++) {
+		c = 17 - ((x * 15) / 37);
+		*(ptr) = c;
+		*(ptr + 38) = c;
+	      }
+	    }
+	    break;
+	  }	  
 	}
         else if (cfg.vis_type == VIS_SCOPE) {
             for (x = 0; x < 38; x++) {
@@ -170,34 +177,45 @@
 
         memset(rgb_data, 0, SVIS_WIDTH * 2 * SVIS_HEIGHT * 2);
         if (cfg.vis_type == VIS_ANALYZER) {
-            switch (cfg.vu_mode) {
-            case VU_NORMAL:
-                for (y = 0; y < 2; y++) {
-                    ptr = rgb_data + ((y * 3) * 152);
-                    h = (svis->vs_data[y] * 8) / 37;
-                    for (x = 0; x < h; x++, ptr += 10) {
-                        c = svis_vu_normal_colors[x];
-                        DRAW_DS_PIXEL(ptr, c);
-                        DRAW_DS_PIXEL(ptr + 2, c);
-                        DRAW_DS_PIXEL(ptr + 4, c);
-                        DRAW_DS_PIXEL(ptr + 152, c);
-                        DRAW_DS_PIXEL(ptr + 154, c);
-                        DRAW_DS_PIXEL(ptr + 156, c);
-                    }
-                }
-                break;
-            case VU_SMOOTH:
-                for (y = 0; y < 2; y++) {
-                    ptr = rgb_data + ((y * 3) * 152);
-                    for (x = 0; x < svis->vs_data[y]; x++, ptr += 2) {
-                        c = 17 - ((x * 15) / 37);
-                        DRAW_DS_PIXEL(ptr, c);
-                        DRAW_DS_PIXEL(ptr + 152, c);
-                    }
-                }
-                break;
-            }
+	  for(y=0; y < SVIS_HEIGHT; y++){
+	    for(x=0;x< SVIS_WIDTH; x++){
+	      if(svis->vs_data[x] > y << 1)
+		{
+		  ptr = rgb_data + x * 2 + (SVIS_HEIGHT - y) * SVIS_WIDTH * 2;
+		  DRAW_DS_PIXEL(ptr, 23);
+		}
+	    }
+	  }
         }
+	else if (cfg.vis_type == VIS_VOICEPRINT){
+	  switch (cfg.vu_mode) {
+	  case VU_NORMAL:
+	    for (y = 0; y < 2; y++) {
+	      ptr = rgb_data + ((y * 3) * 152);
+	      h = (svis->vs_data[y] * 8) / 37;
+	      for (x = 0; x < h; x++, ptr += 10) {
+		c = svis_vu_normal_colors[x];
+		DRAW_DS_PIXEL(ptr, c);
+		DRAW_DS_PIXEL(ptr + 2, c);
+		DRAW_DS_PIXEL(ptr + 4, c);
+		DRAW_DS_PIXEL(ptr + 152, c);
+		DRAW_DS_PIXEL(ptr + 154, c);
+		DRAW_DS_PIXEL(ptr + 156, c);
+	      }
+	    }
+	    break;
+	  case VU_SMOOTH:
+	    for (y = 0; y < 2; y++) {
+	      ptr = rgb_data + ((y * 3) * 152);
+	      for (x = 0; x < svis->vs_data[y]; x++, ptr += 2) {
+		c = 17 - ((x * 15) / 37);
+		DRAW_DS_PIXEL(ptr, c);
+		DRAW_DS_PIXEL(ptr + 152, c);
+	      }
+	    }
+	    break;
+	  }  
+	}
         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 14:47:48 2006 -0800
+++ b/audacious/widgets/vis.c	Mon Dec 18 16:37:47 2006 -0800
@@ -101,7 +101,8 @@
     else if (cfg.vis_type == VIS_VOICEPRINT && data){
       for(i = 0; i < 16; i++)
 	{
-	  vis->vs_data[i] = data[15 - i] > 23 ? 23 : data[15-i];
+	  /*The color palette is in the range [2-23]. This makes sure we stay there.*/
+	  vis->vs_data[i] = data[15 - i] > 23 ? 23 : data[15-i] ^ 1;
 	}
     }
     else if (data) {
@@ -337,18 +338,23 @@
             }
         }
 	else if (cfg.vis_type == VIS_VOICEPRINT) {
-	  for (y = 0; y < 16; y ++) {
+	  for (y = 0; y < 15; 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)];
+		ptr = rgb_data + (x << 1) + y * 304;
+		vs_data_ext[x + y * 76] = vs_data_ext[x - 1 + y * 76];
+		*ptr = vs_data_ext[x - 1 + y * 76];
+		*(ptr+1) = vs_data_ext[x - 1 + y * 76];
+
+		//FIXME. Currently only every other line is shown in
+		//doublesize mode.
+		//*(ptr+304) = vs_data_ext[x + y * 76];
+		//*(ptr+1+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++) {