[Rhythmbox-devel] Patch: Logarithmic Volume Control With Remote Control



Hi:

When the volume is changed with the volume buttons on the remote control,
we really should make the change logarithmic instead of linear and also a
bit more fine-grained. With 0.1-changes and a good music system a volume
of 0.1 may still be way too loud and a volume of 0.0 obviously too soft.
Here's my patch, which applies against 0.8.8 with James Cotton's lirc
patch applied (<URL:mid:a08e8e760504131746e11ad9f mail gmail com>, posted
on this list 13 Apr 2005.)

--- /tmp/rb-shell-player.c	2005-06-29 01:43:01.000000000 -0500
+++ shell/rb-shell-player.c	2005-06-29 01:54:11.000000000 -0500
@@ -2211,7 +2211,13 @@
 		break;
 	case RB_REMOTE_COMMAND_VOLUME_UP:
 		mmplayer = rb_shell_player_get_mm_player (player);
-		volume = rb_player_get_volume (mmplayer) + .1;
+
+                volume = rb_player_get_volume (mmplayer);
+
+                if (volume < 0.01)
+                        volume = 0.01;
+
+		volume = volume * 1.04;
 
 		if (volume > 1.0)
 			volume = 1.0;
@@ -2226,9 +2232,9 @@
 		break;
 	case RB_REMOTE_COMMAND_VOLUME_DOWN:
 		mmplayer = rb_shell_player_get_mm_player (player);
-		volume = rb_player_get_volume (mmplayer) - .1;
+		volume = rb_player_get_volume (mmplayer) / 1.04;
 		
-		if (volume < 0.0)
+		if (volume < 0.01)
 			volume = 0.0;
 			
 		if (player->priv->muted_volume == -1) {

Regards,

        Oliver




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