marlin r1283 - in trunk: marlin src src/other



Author: iain
Date: Wed Oct  1 23:04:02 2008
New Revision: 1283
URL: http://svn.gnome.org/viewvc/marlin?rev=1283&view=rev

Log:
Draw the levels correctly.


Modified:
   trunk/marlin/ChangeLog
   trunk/marlin/marlin-jack.c
   trunk/src/ChangeLog
   trunk/src/marlin-window.c
   trunk/src/other/gtkvumeter.c

Modified: trunk/marlin/marlin-jack.c
==============================================================================
--- trunk/marlin/marlin-jack.c	(original)
+++ trunk/marlin/marlin-jack.c	Wed Oct  1 23:04:02 2008
@@ -317,5 +317,5 @@
 	}
 
 	g_signal_emit (jack, signals[LEVEL_CHANGED], 0,
-		       priv->channels, peak, rms);
+		       priv->channels, rms, peak);
 }

Modified: trunk/src/marlin-window.c
==============================================================================
--- trunk/src/marlin-window.c	(original)
+++ trunk/src/marlin-window.c	Wed Oct  1 23:04:02 2008
@@ -1114,10 +1114,8 @@
 
 	/* -96.0 is the MIN_DB in src/other/gtkvumeter.c 
 	   Should be a public constant */
-	gtk_vumeter_set_levels (GTK_VUMETER (window->priv->left_vu), 
-				MARLIN_MIN_DB, MARLIN_MIN_DB);
-	gtk_vumeter_set_levels (GTK_VUMETER (window->priv->right_vu), 
-				MARLIN_MIN_DB, MARLIN_MIN_DB);
+	gtk_vumeter_set_levels (GTK_VUMETER (window->priv->left_vu), 0.0, 0.0);
+	gtk_vumeter_set_levels (GTK_VUMETER (window->priv->right_vu), 0.0, 0.0);
 
 #if 0
 	if (window->priv->repeating) {
@@ -2586,12 +2584,10 @@
 
 	/* Reset the VUMeters */
 	if (priv->left_vu) {
-		gtk_vumeter_set_levels (GTK_VUMETER (priv->left_vu), 
-					MARLIN_MIN_DB, MARLIN_MIN_DB);
+		gtk_vumeter_set_levels (GTK_VUMETER (priv->left_vu), 0.0, 0.0);
 	}
 	if (priv->right_vu) {
-		gtk_vumeter_set_levels (GTK_VUMETER (priv->right_vu), 
-					MARLIN_MIN_DB, MARLIN_MIN_DB);
+		gtk_vumeter_set_levels (GTK_VUMETER (priv->right_vu), 0.0, 0.0);
 	}
 }
 

Modified: trunk/src/other/gtkvumeter.c
==============================================================================
--- trunk/src/other/gtkvumeter.c	(original)
+++ trunk/src/other/gtkvumeter.c	Wed Oct  1 23:04:02 2008
@@ -81,8 +81,8 @@
 	vumeter->fg_gc = NULL;
 	vumeter->bg_gc = NULL;
 
-	vumeter->rms_level = MARLIN_MIN_DB;
-	vumeter->peak_level = MARLIN_MIN_DB;
+	vumeter->rms_level = 0.0;
+	vumeter->peak_level = 0.0;
 	vumeter->scale = MARLIN_SCALE_LOG;
 }
 
@@ -301,20 +301,23 @@
 			       NULL, widget, "", 0, 0,
 			       widget->allocation.width, height);
 
-		for (index = peak_level; index < rms_level; index++) {
+		/* Reduce height by three to draw bars inside the trough */
+		height -= 3;
+
+		for (index = rms_level; index < peak_level; index++) {
 			gdk_gc_set_foreground (vumeter->bg_gc,
 					       &vumeter->b_colors[index]);
 			gdk_draw_line (widget->window, vumeter->bg_gc,
-				       1, index + 1,
-				       width, index + 1);
+				       1, height - index,
+				       width, height - index);
 		}
 
-		for (index = widget->allocation.height - 3; index > rms_level; index--) {
+		for (index = 0; index < rms_level; index++) {
 			gdk_gc_set_foreground (vumeter->fg_gc,
 					       &vumeter->f_colors[index]);
 			gdk_draw_line (widget->window, vumeter->fg_gc,
-				       1, index + 1,
-				       width, index + 1);
+				       1, height - index,
+				       width, height - index);
 		}
 
 		break;
@@ -482,15 +485,15 @@
 {
 	double draw_level;
 	double height;
-	double log_level;
+	/* double log_level; */
 
 	height = GTK_WIDGET (vumeter)->allocation.height - 2;
 
 	if (vumeter->scale == MARLIN_SCALE_LINEAR) {
 		draw_level = 0;
 	} else {
-		log_level = level / MARLIN_MIN_DB;
-		draw_level = log_level * height;
+		/* log_level = level / MARLIN_MIN_DB; */
+		draw_level = level * height;
 	}
 
 	return (int) draw_level;
@@ -504,8 +507,8 @@
 	g_return_if_fail (vumeter != NULL);
 	g_return_if_fail (GTK_IS_VUMETER (vumeter));
 
-	vumeter->rms_level = MARLIN_MIN_DB - (rms * MARLIN_MIN_DB);
-	vumeter->peak_level = MARLIN_MIN_DB - (peak * MARLIN_MIN_DB);
+	vumeter->rms_level = rms;
+	vumeter->peak_level = peak;
 
 	gtk_widget_queue_draw (GTK_WIDGET (vumeter));
 }



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]