summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMarc Mutz <marc.mutz@qt.io>2022-08-09 09:39:57 +0200
committerQt Cherry-pick Bot <cherrypick_bot@qt-project.org>2022-08-09 15:27:54 +0000
commit73e852eb074753a59507f1ef15061e6cb7d6ca9b (patch)
treed99f4d6ec848aec00d8d4d0482ef133bf3a2fe03
parent060dc236870dc1a74268d8c597facd83d6561872 (diff)
downloadqtmultimedia-73e852eb074753a59507f1ef15061e6cb7d6ca9b.tar.gz
Fix QAudioEngine constructors
From API review: - QObject *parent always comes _last_, any additional ctor arguments go in front Also make the default ctor non-explicit (so = {} works to invoke it). Change-Id: I5db7c1bcbda023edb781757648c0e46eb0e4d3af Reviewed-by: Lars Knoll <lars.knoll@gmail.com> Reviewed-by: MÃ¥rten Nordheim <marten.nordheim@qt.io> (cherry picked from commit 18d1b7b8ce632d131286cfec3ffe6d047eb52d9d) Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r--src/spatialaudio/qaudioengine.cpp21
-rw-r--r--src/spatialaudio/qaudioengine.h4
2 files changed, 17 insertions, 8 deletions
diff --git a/src/spatialaudio/qaudioengine.cpp b/src/spatialaudio/qaudioengine.cpp
index fdf3864f8..e4bff71a4 100644
--- a/src/spatialaudio/qaudioengine.cpp
+++ b/src/spatialaudio/qaudioengine.cpp
@@ -323,15 +323,22 @@ QVector3D QAudioEnginePrivate::listenerPosition() const
*/
/*!
- Constructs a spatial audio engine with \a parent.
+ \fn QAudioEngine::QAudioEngine()
+ \fn QAudioEngine::QAudioEngine(QObject *parent)
+ \fn QAudioEngine::QAudioEngine(int sampleRate, QObject *parent = nullptr)
- The engine will operate with a sample rate given by \a sampleRate. Sound content that is
- not provided at that sample rate will automatically get resampled to \a sampleRate when
- being processed by the engine. The default sample rate is fine in most cases, but you can define
- a different rate if most of your sound files are sampled with a different rate, and avoid some
- CPU overhead for resampling.
+ Constructs a spatial audio engine with \a parent, if any.
+
+ The engine will operate with a sample rate given by \a sampleRate. The
+ default sample rate, if none is provided, is 44100 (44.1kHz).
+
+ Sound content that is not provided at that sample rate will automatically
+ get resampled to \a sampleRate when being processed by the engine. The
+ default sample rate is fine in most cases, but you can define a different
+ rate if most of your sound files are sampled with a different rate, and
+ avoid some CPU overhead for resampling.
*/
-QAudioEngine::QAudioEngine(QObject *parent, int sampleRate)
+QAudioEngine::QAudioEngine(int sampleRate, QObject *parent)
: QObject(parent)
, d(new QAudioEnginePrivate)
{
diff --git a/src/spatialaudio/qaudioengine.h b/src/spatialaudio/qaudioengine.h
index a88967cc1..da83c9a88 100644
--- a/src/spatialaudio/qaudioengine.h
+++ b/src/spatialaudio/qaudioengine.h
@@ -21,7 +21,9 @@ class Q_SPATIALAUDIO_EXPORT QAudioEngine : public QObject
Q_PROPERTY(bool paused READ paused WRITE setPaused NOTIFY pausedChanged)
Q_PROPERTY(float distanceScale READ distanceScale WRITE setDistanceScale NOTIFY distanceScaleChanged)
public:
- explicit QAudioEngine(QObject *parent = nullptr, int sampleRate = 44100);
+ QAudioEngine() : QAudioEngine(nullptr) {};
+ explicit QAudioEngine(QObject *parent) : QAudioEngine(44100, parent) {}
+ explicit QAudioEngine(int sampleRate, QObject *parent = nullptr);
~QAudioEngine();
enum OutputMode {