Clamp out-of-range volume values in QAudioInput and QAudioOutput

Change-Id: I6da76524533e16f6987fad6029b1f42960972383
Reviewed-by: Christian Stromme <christian.stromme@qt.io>
This commit is contained in:
Yoann Lopes
2016-07-08 14:49:37 +02:00
parent 91d12e6242
commit 2f3cf6bca7
2 changed files with 4 additions and 2 deletions

View File

@@ -332,7 +332,8 @@ int QAudioInput::notifyInterval() const
*/ */
void QAudioInput::setVolume(qreal volume) void QAudioInput::setVolume(qreal volume)
{ {
d->setVolume(volume); qreal v = qBound(qreal(0.0), volume, qreal(1.0));
d->setVolume(v);
} }
/*! /*!

View File

@@ -349,7 +349,8 @@ QAudio::State QAudioOutput::state() const
*/ */
void QAudioOutput::setVolume(qreal volume) void QAudioOutput::setVolume(qreal volume)
{ {
d->setVolume(volume); qreal v = qBound(qreal(0.0), volume, qreal(1.0));
d->setVolume(v);
} }
/*! /*!