[vlc-commits] Use soft gain by default to achieve 200% with directsound
Denis Charmet
git at videolan.org
Wed Aug 14 21:56:47 CEST 2013
vlc/vlc-2.1 | branch: master | Denis Charmet <typx at dinauz.org> | Thu Aug 8 10:08:17 2013 +0200| [d1672f50c9052b793f7c6be8d7e82feb8a1f7bd0] | committer: Denis Charmet
Use soft gain by default to achieve 200% with directsound
Since directsound doesn't support amplification, we use a default *2 soft gain and map DSBVOLUME_MAX to 200%.
> http://git.videolan.org/gitweb.cgi/vlc/vlc-2.1.git/?a=commit;h=d1672f50c9052b793f7c6be8d7e82feb8a1f7bd0
---
modules/audio_output/directx.c | 9 ++++-----
1 file changed, 4 insertions(+), 5 deletions(-)
diff --git a/modules/audio_output/directx.c b/modules/audio_output/directx.c
index 2f47c47..04dc919 100644
--- a/modules/audio_output/directx.c
+++ b/modules/audio_output/directx.c
@@ -331,11 +331,8 @@ static int VolumeSet( audio_output_t *p_aout, float volume )
aout_sys_t *sys = p_aout->sys;
int ret = 0;
- /* Convert UI volume to linear factor (cube) */
- float vol = volume * volume * volume;
-
- /* millibels from linear amplification */
- LONG mb = lroundf(2000.f * log10f(vol));
+ /* millibels from linear amplification map 200% on DSBVOLUME_MAX */
+ LONG mb = lroundf( 5000.f * log10f( volume / 2.f ));
/* Clamp to allowed DirectSound range */
static_assert( DSBVOLUME_MIN < DSBVOLUME_MAX, "DSBVOLUME_* confused" );
@@ -504,6 +501,7 @@ static int CreateDSBuffer( audio_output_t *p_aout, int i_format,
waveformat.Format.wBitsPerSample;
waveformat.Format.wFormatTag = WAVE_FORMAT_IEEE_FLOAT;
waveformat.SubFormat = _KSDATAFORMAT_SUBTYPE_IEEE_FLOAT;
+ aout_GainRequest(p_aout, 8.f);
break;
case VLC_CODEC_S16N:
@@ -512,6 +510,7 @@ static int CreateDSBuffer( audio_output_t *p_aout, int i_format,
waveformat.Format.wBitsPerSample;
waveformat.Format.wFormatTag = WAVE_FORMAT_PCM;
waveformat.SubFormat = _KSDATAFORMAT_SUBTYPE_PCM;
+ aout_GainRequest(p_aout, 8.f);
break;
}
More information about the vlc-commits
mailing list