summaryrefslogtreecommitdiffstats
path: root/src/imports
diff options
context:
space:
mode:
authorYoann Lopes <yoann.lopes@theqtcompany.com>2016-06-13 13:58:26 +0200
committerYoann Lopes <yoann.lopes@qt.io>2016-06-14 09:43:38 +0000
commitef467807ee19cee8a041a79a4fb191a9fd781a72 (patch)
treec16ccd0c6d8cca0ee82369356cb7293a2666ddc6 /src/imports
parentf9061183cc6ec0ab2a597e561290984eb0f1817e (diff)
Add LogarithmicVolumeScale to VolumeScale enum.
Change-Id: I0b556b5f705825fc8c8135305bda4bc860ffbf14 Reviewed-by: Christian Stromme <christian.stromme@qt.io>
Diffstat (limited to 'src/imports')
-rw-r--r--src/imports/multimedia/qdeclarativemultimediaglobal.cpp16
-rw-r--r--src/imports/multimedia/qdeclarativemultimediaglobal_p.h1
2 files changed, 10 insertions, 7 deletions
diff --git a/src/imports/multimedia/qdeclarativemultimediaglobal.cpp b/src/imports/multimedia/qdeclarativemultimediaglobal.cpp
index bb1b9c9d8..999f086d5 100644
--- a/src/imports/multimedia/qdeclarativemultimediaglobal.cpp
+++ b/src/imports/multimedia/qdeclarativemultimediaglobal.cpp
@@ -191,18 +191,20 @@ QJSValue QDeclarativeMultimediaGlobal::availableCameras() const
Depending on the context, different scales are used to represent audio volume. All Qt Multimedia
classes that have an audio volume use a linear scale, the reason is that the loudness of a
speaker is controlled by modulating its voltage on a linear scale. The human ear on the other
- hand, perceives loudness in a logarithmic way. That is why the decibel scale, being a logarithmic
- scale, is typically used to define sound levels. UI volume controls in professional audio
- applications usually use a decibel scale. The cubic scale is a computationally cheap
- approximation of a logarithmic scale, most applications should use a cubic scale for their UI
- volume controls.
+ hand, perceives loudness in a logarithmic way. Using a logarithmic scale for volume controls
+ is therefore appropriate in most applications. The decibel scale is logarithmic by nature and
+ is commonly used to define sound levels, it is usually used for UI volume controls in
+ professional audio applications. The cubic scale is a computationally cheap approximation of a
+ logarithmic scale, it provides more control over lower volume levels.
Valid values for \a from and \a to are:
\list
\li QtMultimedia.LinearVolumeScale - Linear scale. \c 0.0 (0%) is silence and \c 1.0 (100%) is
full volume. All Qt Multimedia types that have an audio volume use a linear scale.
\li QtMultimedia.CubicVolumeScale - Cubic scale. \c 0.0 (0%) is silence and \c 1.0 (100%) is full
- volume. UI volume controls should usually use a cubic scale.
+ volume.
+ \li QtMultimedia.LogarithmicVolumeScale - Logarithmic scale. \c 0.0 (0%) is silence and \c 1.0
+ (100%) is full volume. UI volume controls should usually use a logarithmic scale.
\li QtMultimedia.DecibelVolumeScale - Decibel (dB, amplitude) logarithmic scale. \c -200 is
silence and \c 0 is full volume.
\endlist
@@ -216,7 +218,7 @@ QJSValue QDeclarativeMultimediaGlobal::availableCameras() const
id: volumeSlider
property real volume: QtMultimedia.convertVolume(volumeSlider.value,
- QtMultimedia.CubicVolumeScale,
+ QtMultimedia.LogarithmicVolumeScale,
QtMultimedia.LinearVolumeScale)
}
diff --git a/src/imports/multimedia/qdeclarativemultimediaglobal_p.h b/src/imports/multimedia/qdeclarativemultimediaglobal_p.h
index a8413cc09..101bd899a 100644
--- a/src/imports/multimedia/qdeclarativemultimediaglobal_p.h
+++ b/src/imports/multimedia/qdeclarativemultimediaglobal_p.h
@@ -70,6 +70,7 @@ public:
enum VolumeScale {
LinearVolumeScale = QAudio::LinearVolumeScale,
CubicVolumeScale = QAudio::CubicVolumeScale,
+ LogarithmicVolumeScale = QAudio::LogarithmicVolumeScale,
DecibelVolumeScale = QAudio::DecibelVolumeScale
};