Page 1 sur 1

patch son

Posté : 10 janv. 2009, 21:12
par MatMaul
petit patch qui utilise le logarithme pour calculer la valeur à passer à put_Volume => le changement de volume devient linéaire.
passage à des palliers de 5 pour le volume.
=> comportement identique à MPC

Code : Tout sélectionner

Index: channels.cpp
===================================================================
--- channels.cpp	(revision 163)
+++ channels.cpp	(working copy)
@@ -25,6 +25,7 @@
  * See http://pouchintv.baysse.fr/ for updates.
  */
 
+#include <math.h>
 #include "base.h"
 #include "channels.h"
 #include "main.h"
@@ -492,6 +493,10 @@
 {
 	CComQIPtr<IBasicAudio> pBas(pGraph);
 
-	if (pBas)
-		pBas->put_Volume(volume);
+	if (pBas) {
+		if (volume > 0)
+			pBas->put_Volume((int)((log10(1.0*volume)-2)*5000));
+		else
+			pBas->put_Volume(-8000);
+	}
 }
Index: ini.cpp
===================================================================
--- ini.cpp	(revision 163)
+++ ini.cpp	(working copy)
@@ -1213,7 +1213,7 @@
 #if USE_CONSOLE==1
 	save_config_winpos(ini_position_console, GetConsoleWindow());
 #endif // #if USE_CONSOLE==1
-	save_config_int(ini_volume, (volumeCourant + 10000) / 100);
+	save_config_int(ini_volume, volumeCourant);
 	save_config_assoc(ini_epg_typerecvideo, aEpgRecVideo, epg_typerecvideo);
 	save_config_assoc(ini_epg_typerecaudio, aEpgRecAudio, epg_typerecaudio);
 	save_config_raccourcis();
@@ -1491,7 +1491,7 @@
 	video_pan_mode			= (PanModes)load_config_assoc(ini_video_pan_mode, aPanModeTable, pm_Normal);
 
 	zoom_ratio				= load_config_int(ini_zoom_ratio, 100);
-	volumeCourant			= load_config_int(ini_volume, 100) * 100 - 10000;
+	volumeCourant			= load_config_int(ini_volume, 100);
 
 	epg_typerecvideo		= load_config_assoc(ini_epg_typerecvideo, aEpgRecVideo, 0);
 	epg_typerecaudio		= load_config_assoc(ini_epg_typerecaudio, aEpgRecAudio, 0);
Index: main.cpp
===================================================================
--- main.cpp	(revision 163)
+++ main.cpp	(working copy)
@@ -838,7 +838,7 @@
 		}
 
 		if (!use_osd) {
-			_stprintf_s(str, TEXT("%s %i"), muted ? TEXT("Volume") : TEXT("Sourdine"), (volumeCourant+8000)/80);
+			_stprintf_s(str, TEXT("%s %i"), muted ? TEXT("Volume") : TEXT("Sourdine"), volumeCourant);
 			SendMessage(hMainStatus, SB_SETTEXT, 5, (LPARAM)str);
 		}
 	}
@@ -1293,7 +1293,7 @@
 	lcd.Mute(muted);
 #endif // #ifdef USE_LOGITECH_LCD
 
-	set_volume(muted ? -8000 : (volumeCourant < 0 ? volumeCourant : 0));
+	set_volume(muted ? 0 : volumeCourant);
 
 	if (pOSD)
 		pOSD->DisplayMute(muted);
@@ -1302,10 +1302,10 @@
 
 static void update_volume(bool augmente)
 {
-	if (augmente && volumeCourant < 0)
-		volumeCourant += 80;
-	else if (!augmente && volumeCourant > -8000)
-		volumeCourant -= 80;
+	if (augmente && volumeCourant < 100)
+		volumeCourant += 5;
+	else if (!augmente && volumeCourant > 0)
+		volumeCourant -= 5;
 
 	if (!muted)
 		set_volume(volumeCourant);

Re: patch son

Posté : 10 janv. 2009, 21:35
par Gingko
Merci, je vais regarder ça.

Gingko

Re: patch son

Posté : 11 janv. 2009, 00:44
par Gingko
Voilà, c'est dans le SVN.

Gingko