diff options
Diffstat (limited to 'src/multimedia/audio/qsoundeffect.cpp')
-rw-r--r-- | src/multimedia/audio/qsoundeffect.cpp | 34 |
1 files changed, 24 insertions, 10 deletions
diff --git a/src/multimedia/audio/qsoundeffect.cpp b/src/multimedia/audio/qsoundeffect.cpp index f093373ce..09085dca9 100644 --- a/src/multimedia/audio/qsoundeffect.cpp +++ b/src/multimedia/audio/qsoundeffect.cpp @@ -111,20 +111,34 @@ QT_BEGIN_NAMESPACE sound effects. */ +static QSoundEffectPrivate *initPrivate(QSoundEffect *self, QSoundEffectPrivate *d) +{ + QObject::connect(d, &QSoundEffectPrivate::loopsRemainingChanged, self, &QSoundEffect::loopsRemainingChanged); + QObject::connect(d, &QSoundEffectPrivate::volumeChanged, self, &QSoundEffect::volumeChanged); + QObject::connect(d, &QSoundEffectPrivate::mutedChanged, self, &QSoundEffect::mutedChanged); + QObject::connect(d, &QSoundEffectPrivate::loadedChanged, self, &QSoundEffect::loadedChanged); + QObject::connect(d, &QSoundEffectPrivate::playingChanged, self, &QSoundEffect::playingChanged); + QObject::connect(d, &QSoundEffectPrivate::statusChanged, self, &QSoundEffect::statusChanged); + QObject::connect(d, &QSoundEffectPrivate::categoryChanged, self, &QSoundEffect::categoryChanged); + + return d; +} /*! Creates a QSoundEffect with the given \a parent. */ -QSoundEffect::QSoundEffect(QObject *parent) : - QObject(parent) +QSoundEffect::QSoundEffect(QObject *parent) + : QObject(parent) + , d(initPrivate(this, new QSoundEffectPrivate(this))) +{ +} + +/*! + Creates a QSoundEffect with the given \a audioDevice and \a parent. +*/ +QSoundEffect::QSoundEffect(const QAudioDeviceInfo &audioDevice, QObject *parent) + : QObject(parent) + , d(initPrivate(this, new QSoundEffectPrivate(audioDevice, this))) { - d = new QSoundEffectPrivate(this); - connect(d, &QSoundEffectPrivate::loopsRemainingChanged, this, &QSoundEffect::loopsRemainingChanged); - connect(d, &QSoundEffectPrivate::volumeChanged, this, &QSoundEffect::volumeChanged); - connect(d, &QSoundEffectPrivate::mutedChanged, this, &QSoundEffect::mutedChanged); - connect(d, &QSoundEffectPrivate::loadedChanged, this, &QSoundEffect::loadedChanged); - connect(d, &QSoundEffectPrivate::playingChanged, this, &QSoundEffect::playingChanged); - connect(d, &QSoundEffectPrivate::statusChanged, this, &QSoundEffect::statusChanged); - connect(d, &QSoundEffectPrivate::categoryChanged, this, &QSoundEffect::categoryChanged); } /*! |