summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@qt.io>2016-07-08 14:49:37 +0200
committerYoann Lopes <yoann.lopes@qt.io>2016-09-28 11:29:53 +0000
commit2f3cf6bca788c6a08357a9d672deb4119877a1fd (patch)
tree5fafd5ed6861dae38061c38a9837d8f1b504e424
parent91d12e6242bac85f0ea59db2d98235792f82dd44 (diff)
Clamp out-of-range volume values in QAudioInput and QAudioOutput
Change-Id: I6da76524533e16f6987fad6029b1f42960972383 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r--src/multimedia/audio/qaudioinput.cpp3
-rw-r--r--src/multimedia/audio/qaudiooutput.cpp3
2 files changed, 4 insertions, 2 deletions
diff --git a/src/multimedia/audio/qaudioinput.cpp b/src/multimedia/audio/qaudioinput.cpp
index 5f827d01..8df8696d 100644
--- a/src/multimedia/audio/qaudioinput.cpp
+++ b/src/multimedia/audio/qaudioinput.cpp
@@ -332,7 +332,8 @@ int QAudioInput::notifyInterval() const
*/
void QAudioInput::setVolume(qreal volume)
{
- d->setVolume(volume);
+ qreal v = qBound(qreal(0.0), volume, qreal(1.0));
+ d->setVolume(v);
}
/*!
diff --git a/src/multimedia/audio/qaudiooutput.cpp b/src/multimedia/audio/qaudiooutput.cpp
index 5c866663..f3c59f3e 100644
--- a/src/multimedia/audio/qaudiooutput.cpp
+++ b/src/multimedia/audio/qaudiooutput.cpp
@@ -349,7 +349,8 @@ QAudio::State QAudioOutput::state() const
*/
void QAudioOutput::setVolume(qreal volume)
{
- d->setVolume(volume);
+ qreal v = qBound(qreal(0.0), volume, qreal(1.0));
+ d->setVolume(v);
}
/*!