summaryrefslogtreecommitdiffstats
path: root/src/multimedia/audio/qsoundeffect.cpp
diff options
context:
space:
mode:
authorChristian Strømme <christian.stromme@digia.com>2013-11-25 14:17:51 +0100
committerThe Qt Project <gerrit-noreply@qt-project.org>2013-11-28 14:12:22 +0100
commit0fd995ac8b58b460f0740699cee9a221a66f6b56 (patch)
treee06e560fb8329c7d1726c1c97f6384e1e2567fd6 /src/multimedia/audio/qsoundeffect.cpp
parent1cf737648b2c5cf9636e6be814b4879b67d7e0a0 (diff)
Don't use integers to describe volume internally in QSoundEffect.
The public api takes floating point values and so does most of the back- ends. Conversion should be done in the back-ends that expect other value types to avoid unnecessary float -> int -> float conversions. Change-Id: I0ee1bfbe350f985294c20f897ffa3bd55288b4c9 Reviewed-by: Yoann Lopes <yoann.lopes@digia.com>
Diffstat (limited to 'src/multimedia/audio/qsoundeffect.cpp')
-rw-r--r--src/multimedia/audio/qsoundeffect.cpp10
1 files changed, 5 insertions, 5 deletions
diff --git a/src/multimedia/audio/qsoundeffect.cpp b/src/multimedia/audio/qsoundeffect.cpp
index 437d3a4e6..cd7a9ad5d 100644
--- a/src/multimedia/audio/qsoundeffect.cpp
+++ b/src/multimedia/audio/qsoundeffect.cpp
@@ -265,7 +265,7 @@ int QSoundEffect::loopsRemaining() const
*/
qreal QSoundEffect::volume() const
{
- return qreal(d->volume()) / 100;
+ return d->volume();
}
/*!
@@ -273,15 +273,15 @@ qreal QSoundEffect::volume() const
*/
void QSoundEffect::setVolume(qreal volume)
{
- if (volume < 0 || volume > 1) {
+ if (volume < qreal(0.0) || volume > qreal(1.0)) {
qWarning("SoundEffect: volume should be between 0.0 and 1.0");
return;
}
- int iVolume = qRound(volume * 100);
- if (d->volume() == iVolume)
+
+ if (qFuzzyCompare(d->volume(), volume))
return;
- d->setVolume(iVolume);
+ d->setVolume(volume);
}
/*!