Commit 3a42671f authored by Denis Charmet's avatar 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%.
parent 9311e60a
......@@ -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;
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment