mciqtz32: Use dB unit when setting audio volume.

Signed-off-by: Akihiro Sagawa <sagawa.aki@gmail.com>
Signed-off-by: Andrew Eikum <aeikum@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Akihiro Sagawa 2016-07-09 17:50:52 +09:00 committed by Alexandre Julliard
parent 3d94c1ac4d
commit cab9db9d95
1 changed files with 7 additions and 2 deletions

View File

@ -19,6 +19,7 @@
*/
#include <stdarg.h>
#include <math.h>
#include "windef.h"
#include "winbase.h"
#include "winuser.h"
@ -1070,7 +1071,7 @@ static DWORD MCIQTZ_mciSetAudio(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETAUDIO_P
switch (lpParms->dwItem) {
case MCI_DGV_SETAUDIO_VOLUME:
if (dwFlags & MCI_DGV_SETAUDIO_VALUE) {
long vol = -10000;
long vol;
HRESULT hr;
if (lpParms->dwValue > 1000) {
ret = MCIERR_OUTOFRANGE;
@ -1078,7 +1079,11 @@ static DWORD MCIQTZ_mciSetAudio(UINT wDevID, DWORD dwFlags, LPMCI_DGV_SETAUDIO_P
}
if (dwFlags & MCI_TEST)
break;
vol += (long)lpParms->dwValue * 10;
if (lpParms->dwValue != 0)
vol = (long)(2000.0 * (log10(lpParms->dwValue) - 3.0));
else
vol = -10000;
TRACE("Setting volume to %ld\n", vol);
hr = IBasicAudio_put_Volume(wma->audio, vol);
if (FAILED(hr)) {
WARN("Cannot set volume (hr = %x)\n", hr);