[vlc-commits] WaveOut: map volume max to VLC max (fix #4554)

Rémi Denis-Courmont git at videolan.org
Tue Jul 26 18:44:27 CEST 2011


vlc | branch: master | Rémi Denis-Courmont <remi at remlab.net> | Tue Jul 26 19:42:27 2011 +0300| [5c437c34d2c79072d0bf1c7ddba86d9ed084a166] | committer: Rémi Denis-Courmont

WaveOut: map volume max to VLC max (fix #4554)

The formula should be changed in any case. WaveOut has a logarithmic
scale, which is not consistent with the other audio outputs.

> http://git.videolan.org/gitweb.cgi/vlc.git/?a=commit;h=5c437c34d2c79072d0bf1c7ddba86d9ed084a166
---

 modules/audio_output/waveout.c |   10 ++++++++--
 1 files changed, 8 insertions(+), 2 deletions(-)

diff --git a/modules/audio_output/waveout.c b/modules/audio_output/waveout.c
index 18e39a7..52f1954 100644
--- a/modules/audio_output/waveout.c
+++ b/modules/audio_output/waveout.c
@@ -33,6 +33,7 @@
 #include <vlc_common.h>
 #include <vlc_plugin.h>
 #include <vlc_aout.h>
+#include <vlc_aout_intf.h>
 #include <vlc_charset.h>                        /* FromLocaleDup, LocaleFree */
 #include <vlc_atomic.h>
 
@@ -1003,8 +1004,13 @@ static int VolumeSet( audio_output_t * p_aout, float volume, bool mute )
     if( mute )
         volume = 0.;
 
-    unsigned long i_waveout_vol = volume * 0x7FFF;
-    i_waveout_vol = (i_waveout_vol << 16) | (i_waveout_vol & 0xFFFF);
+    unsigned long i_waveout_vol = volume
+        * (0xFFFF * AOUT_VOLUME_DEFAULT / AOUT_VOLUME_MAX);
+
+    if( i_waveout_vol <= 0xFFFF )
+        i_waveout_vol |= i_waveout_vol << 16;
+    else
+        i_waveout_vol = 0xFFFFFFFF;
 
 #ifdef UNDER_CE
     waveOutSetVolume( 0, i_waveout_vol );



More information about the vlc-commits mailing list