summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorVal Doroshchuk <valentyn.doroshchuk@qt.io>2019-04-08 11:03:36 +0200
committerVaL Doroshchuk <valentyn.doroshchuk@qt.io>2019-04-08 11:30:47 +0000
commitc785e8fcfd0202a88a5e28f8a1410a83f95a9c9f (patch)
treee73adfd8d6d42921d62c0bfab8ae32c4c8cea106
parent3f8b0a916e9e0ca4e17900e1399ee8ad6bbf35b8 (diff)
QWindowsAudioInput: Set volume only if it has been requested
Currently if the device gets opened, also its volume is set to 100%. The volume should be set only if it has been requested. Change-Id: I9dc4ab29ad71f3ac6556c6dd32c7b8e5d69efab2 Fixes: QTBUG-75024 Reviewed-by: Oliver Wolff <oliver.wolff@qt.io> Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
-rw-r--r--src/plugins/windowsaudio/qwindowsaudioinput.cpp6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/plugins/windowsaudio/qwindowsaudioinput.cpp b/src/plugins/windowsaudio/qwindowsaudioinput.cpp
index 00b36cfe4..717baaff0 100644
--- a/src/plugins/windowsaudio/qwindowsaudioinput.cpp
+++ b/src/plugins/windowsaudio/qwindowsaudioinput.cpp
@@ -74,7 +74,7 @@ QWindowsAudioInput::QWindowsAudioInput(const QByteArray &device)
waveBlockOffset = 0;
mixerID = 0;
- cachedVolume = 1.0f;
+ cachedVolume = -1.0f;
memset(&mixerLineControls, 0, sizeof(mixerLineControls));
}
@@ -228,7 +228,7 @@ qreal QWindowsAudioInput::volume() const
return detailsUnsigned.dwValue / 65535.0;
}
- return cachedVolume;
+ return qFuzzyCompare(cachedVolume, qreal(-1.0f)) ? 1.0f : cachedVolume;
}
void QWindowsAudioInput::setFormat(const QAudioFormat& fmt)
@@ -429,7 +429,7 @@ void QWindowsAudioInput::initMixer()
mixerLineControls.pamxctrl = new MIXERCONTROL[mixerLineControls.cControls];
if (mixerGetLineControls(mixerID, &mixerLineControls, MIXER_GETLINECONTROLSF_ALL) != MMSYSERR_NOERROR)
closeMixer();
- else
+ else if (!qFuzzyCompare(cachedVolume, qreal(-1.0f)))
setVolume(cachedVolume);
}
}