Fix QAudioOutput::setVolume() limited 50% on 32-bit Windows

A signed 16 bit integer was being used to pack a normalised double into
half of a DWORD. It needed to be unsigned 16-bit to get the full range
of the Windows volume control.

Task-number: QTBUG-33160

Change-Id: Ic17f572a188401ee686c6e6af3984d52328ccda6
Reviewed-by: Alex Blasche <alexander.blasche@digia.com>
Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
This commit is contained in:
Bill Somerville
2013-08-24 20:51:24 +01:00
committed by The Qt Project
parent 13a53a5056
commit 4715ec52b1

View File

@@ -702,7 +702,7 @@ void QAudioOutputPrivate::setVolume(qreal v)
volumeCache = normalizedVolume;
return;
}
const qint16 scaled = normalizedVolume * 0xFFFF;
const quint16 scaled = normalizedVolume * 0xFFFF;
DWORD vol = MAKELONG(scaled, scaled);
MMRESULT res = waveOutSetVolume(hWaveOut, vol);
if (res == MMSYSERR_NOERROR)