summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAndre Hartmann <aha_1980@gmx.de>2018-03-11 11:52:07 +0100
committerAndré Hartmann <aha_1980@gmx.de>2018-03-27 12:21:34 +0000
commitc96b95e50e71dfae82de5b822e7ab758787acd47 (patch)
tree3365a774c6038eb4221695106e999d631a0c657c
parenta7405ab8991083ef24c267b6ae6d53b260d89523 (diff)
QSound(Effect): Use C++11 member initializationv5.11.0-beta3
Change-Id: Iec7442f4621ad131bf6291e0f5d013ee379c5e3b Reviewed-by: Christian Stromme <christian.stromme@qt.io>
-rw-r--r--src/multimedia/audio/qsound.h2
-rw-r--r--src/multimedia/audio/qsoundeffect.h2
-rw-r--r--src/multimedia/audio/qsoundeffect_pulse_p.cpp37
-rw-r--r--src/multimedia/audio/qsoundeffect_pulse_p.h42
-rw-r--r--src/multimedia/audio/qsoundeffect_qaudio_p.cpp12
-rw-r--r--src/multimedia/audio/qsoundeffect_qaudio_p.h30
6 files changed, 48 insertions, 77 deletions
diff --git a/src/multimedia/audio/qsound.h b/src/multimedia/audio/qsound.h
index 0b6320025..57a254050 100644
--- a/src/multimedia/audio/qsound.h
+++ b/src/multimedia/audio/qsound.h
@@ -76,7 +76,7 @@ private Q_SLOTS:
void deleteOnComplete();
private:
- QSoundEffect *m_soundEffect;
+ QSoundEffect *m_soundEffect = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/multimedia/audio/qsoundeffect.h b/src/multimedia/audio/qsoundeffect.h
index 8bde1fe56..b1c5fd22b 100644
--- a/src/multimedia/audio/qsoundeffect.h
+++ b/src/multimedia/audio/qsoundeffect.h
@@ -123,7 +123,7 @@ public Q_SLOTS:
private:
Q_DISABLE_COPY(QSoundEffect)
- QSoundEffectPrivate* d;
+ QSoundEffectPrivate *d = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.cpp b/src/multimedia/audio/qsoundeffect_pulse_p.cpp
index 6c8b2a3fd..bbaf405b6 100644
--- a/src/multimedia/audio/qsoundeffect_pulse_p.cpp
+++ b/src/multimedia/audio/qsoundeffect_pulse_p.cpp
@@ -100,8 +100,6 @@ class PulseDaemon : public QObject
Q_OBJECT
public:
PulseDaemon()
- : m_prepared(false)
- , m_lockCount(0)
{
prepare();
}
@@ -256,11 +254,11 @@ private:
}
}
- bool m_prepared;
- pa_context *m_context;
- pa_threaded_mainloop *m_mainLoop;
- pa_mainloop_api *m_mainLoopApi;
- uint m_lockCount;
+ bool m_prepared = false;
+ pa_context *m_context = nullptr;
+ pa_threaded_mainloop *m_mainLoop = nullptr;
+ pa_mainloop_api *m_mainLoopApi = nullptr;
+ uint m_lockCount = 0;
QAtomicInt m_ref;
};
@@ -290,8 +288,7 @@ class QSoundEffectRef
{
public:
QSoundEffectRef(QSoundEffectPrivate *target)
- : m_ref(1)
- , m_target(target)
+ : m_target(target)
{
#ifdef QT_PA_DEBUG
qDebug() << "QSoundEffectRef(" << this << ") ctor";
@@ -342,29 +339,13 @@ public:
}
private:
- int m_ref;
+ int m_ref = 1;
mutable QMutex m_mutex;
- QSoundEffectPrivate *m_target;
+ QSoundEffectPrivate *m_target = nullptr;
};
QSoundEffectPrivate::QSoundEffectPrivate(QObject* parent):
- QObject(parent),
- m_pulseStream(nullptr),
- m_sinkInputId(-1),
- m_emptying(false),
- m_sampleReady(false),
- m_playing(false),
- m_status(QSoundEffect::Null),
- m_muted(false),
- m_playQueued(false),
- m_stopping(false),
- m_volume(1.0),
- m_loopCount(1),
- m_runningCount(0),
- m_reloadCategory(false),
- m_sample(nullptr),
- m_position(0),
- m_resourcesAvailable(false)
+ QObject(parent)
{
pulseDaemon()->ref();
diff --git a/src/multimedia/audio/qsoundeffect_pulse_p.h b/src/multimedia/audio/qsoundeffect_pulse_p.h
index 268a99326..8f74d67e7 100644
--- a/src/multimedia/audio/qsoundeffect_pulse_p.h
+++ b/src/multimedia/audio/qsoundeffect_pulse_p.h
@@ -149,36 +149,36 @@ private:
static void stream_write_done_callback(void *p);
static void stream_adjust_prebuffer_callback(pa_stream *s, int success, void *userdata);
- pa_stream *m_pulseStream;
- int m_sinkInputId;
+ pa_stream *m_pulseStream = nullptr;
+ int m_sinkInputId = -1;
pa_sample_spec m_pulseSpec;
- int m_pulseBufferSize;
-
- bool m_emptying;
- bool m_sampleReady;
- bool m_playing;
- QSoundEffect::Status m_status;
- bool m_muted;
- bool m_playQueued;
- bool m_stopping;
- qreal m_volume;
- int m_loopCount;
- int m_runningCount;
- QUrl m_source;
+ int m_pulseBufferSize = 0;
+
+ bool m_emptying = false;
+ bool m_sampleReady = false;
+ bool m_playing = false;
+ QSoundEffect::Status m_status = QSoundEffect::Null;
+ bool m_muted = false;
+ bool m_playQueued = false;
+ bool m_stopping = false;
+ qreal m_volume = 1.0;
+ int m_loopCount = 1;
+ int m_runningCount = 0;
+ QUrl m_source;
QByteArray m_name;
QString m_category;
- bool m_reloadCategory;
+ bool m_reloadCategory = false;
- QSample *m_sample;
- int m_position;
- QSoundEffectRef *m_ref;
+ QSample *m_sample = nullptr;
+ int m_position = 0;
+ QSoundEffectRef *m_ref = nullptr;
- bool m_resourcesAvailable;
+ bool m_resourcesAvailable = false;
// Protects volume while PuseAudio is accessing it
mutable QMutex m_volumeLock;
- QMediaPlayerResourceSetInterface *m_resources;
+ QMediaPlayerResourceSetInterface *m_resources = nullptr;
};
QT_END_NAMESPACE
diff --git a/src/multimedia/audio/qsoundeffect_qaudio_p.cpp b/src/multimedia/audio/qsoundeffect_qaudio_p.cpp
index 2c79afddc..73f1d5cfd 100644
--- a/src/multimedia/audio/qsoundeffect_qaudio_p.cpp
+++ b/src/multimedia/audio/qsoundeffect_qaudio_p.cpp
@@ -303,17 +303,7 @@ void QSoundEffectPrivate::setCategory(const QString &category)
}
PrivateSoundSource::PrivateSoundSource(QSoundEffectPrivate* s):
- QIODevice(s),
- m_loopCount(1),
- m_runningCount(0),
- m_playing(false),
- m_status(QSoundEffect::Null),
- m_audioOutput(nullptr),
- m_sample(nullptr),
- m_muted(false),
- m_volume(1.0),
- m_sampleReady(false),
- m_offset(0)
+ QIODevice(s)
{
soundeffect = s;
m_category = QLatin1String("game");
diff --git a/src/multimedia/audio/qsoundeffect_qaudio_p.h b/src/multimedia/audio/qsoundeffect_qaudio_p.h
index 6fc3ae8d5..db48e7ca6 100644
--- a/src/multimedia/audio/qsoundeffect_qaudio_p.h
+++ b/src/multimedia/audio/qsoundeffect_qaudio_p.h
@@ -78,20 +78,20 @@ private Q_SLOTS:
void stateChanged(QAudio::State);
private:
- QUrl m_url;
- int m_loopCount;
- int m_runningCount;
- bool m_playing;
- QSoundEffect::Status m_status;
- QAudioOutput *m_audioOutput;
- QSample *m_sample;
- bool m_muted;
- qreal m_volume;
- bool m_sampleReady;
- qint64 m_offset;
- QString m_category;
-
- QSoundEffectPrivate *soundeffect;
+ QUrl m_url;
+ int m_loopCount = 1;
+ int m_runningCount = 0;
+ bool m_playing = false;
+ QSoundEffect::Status m_status = QSoundEffect::Null;
+ QAudioOutput *m_audioOutput = nullptr;
+ QSample *m_sample = nullptr;
+ bool m_muted = false;
+ qreal m_volume = 1.0;
+ bool m_sampleReady = false;
+ qint64 m_offset = 0;
+ QString m_category;
+
+ QSoundEffectPrivate *soundeffect = nullptr;
};
@@ -142,7 +142,7 @@ private:
void setPlaying(bool playing);
void setLoopsRemaining(int loopsRemaining);
- PrivateSoundSource* d;
+ PrivateSoundSource *d = nullptr;
};
QT_END_NAMESPACE