diff --git a/audiodevice.cpp b/audiodevice.cpp index 88443b2..d71b850 100644 --- a/audiodevice.cpp +++ b/audiodevice.cpp @@ -4,7 +4,6 @@ #include #include -namespace { //! private helper to allow QAudioInput to write to a io device class AudioDeviceHelper : public QIODevice { @@ -18,14 +17,13 @@ private: AudioDevice &m_audioDevice; }; -class AudioDevicePrivate { +class AudioDevice::AudioDevicePrivate { public: AudioDevicePrivate(AudioDevice &audioDevice, const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format); AudioDeviceHelper helper; QAudioInput input; }; -} AudioDevice::AudioDevice(QObject *parent) : BaseDevice{parent} @@ -58,9 +56,6 @@ void AudioDevice::stop() m_private = nullptr; } - - -namespace { AudioDeviceHelper::AudioDeviceHelper(AudioDevice &audioDevice, QObject *parent) : QIODevice{parent}, m_audioDevice(audioDevice) { @@ -84,8 +79,7 @@ qint64 AudioDeviceHelper::writeData(const char *data, qint64 len) return len; } -AudioDevicePrivate::AudioDevicePrivate(AudioDevice &audioDevice, const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format) : +AudioDevice::AudioDevicePrivate::AudioDevicePrivate(AudioDevice &audioDevice, const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format) : helper{audioDevice}, input{audioDeviceInfo, format} { } -} diff --git a/audiodevice.h b/audiodevice.h index bcd319b..656cb0b 100644 --- a/audiodevice.h +++ b/audiodevice.h @@ -9,7 +9,6 @@ #include // forward declares -namespace { class AudioDevicePrivate; } class QAudioInput; class AudioDevice : public BaseDevice @@ -31,6 +30,7 @@ public: void setDevice(const QAudioDeviceInfo &device) { Q_ASSERT(!running()); m_device = device; } private: + class AudioDevicePrivate; std::unique_ptr m_private; int m_samplerate; diff --git a/basetonegenerator.cpp b/basetonegenerator.cpp index 94e65be..163f488 100644 --- a/basetonegenerator.cpp +++ b/basetonegenerator.cpp @@ -3,8 +3,6 @@ // Qt includes #include -namespace -{ //! private helper to allow QAudioOutput to read from a io device class BaseToneGeneratorHelper : public QIODevice { @@ -18,7 +16,7 @@ private: BaseToneGenerator &m_generator; }; -class BaseToneGeneratorPrivate +class BaseToneGenerator::BaseToneGeneratorPrivate { public: BaseToneGeneratorPrivate(BaseToneGenerator &generator, const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format); @@ -28,8 +26,6 @@ public: QAudioOutput output; }; -} - BaseToneGenerator::BaseToneGenerator() = default; BaseToneGenerator::~BaseToneGenerator() = default; @@ -58,7 +54,6 @@ void BaseToneGenerator::stop() m_private = nullptr; } -namespace { BaseToneGeneratorHelper::BaseToneGeneratorHelper(BaseToneGenerator &generator, QObject *parent) : QIODevice{parent}, m_generator{generator} { @@ -80,8 +75,7 @@ qint64 BaseToneGeneratorHelper::writeData(const char *data, qint64 len) qFatal("writing is not allowed!"); } -BaseToneGeneratorPrivate::BaseToneGeneratorPrivate(BaseToneGenerator &generator, const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format) : +BaseToneGenerator::BaseToneGeneratorPrivate::BaseToneGeneratorPrivate(BaseToneGenerator &generator, const QAudioDeviceInfo &audioDeviceInfo, const QAudioFormat &format) : helper{generator}, output{audioDeviceInfo, format} { } -} diff --git a/basetonegenerator.h b/basetonegenerator.h index 1c8b25f..b3d2397 100644 --- a/basetonegenerator.h +++ b/basetonegenerator.h @@ -9,9 +9,6 @@ // local includes #include "oscicommon.h" -// forward declares -namespace { class BaseToneGeneratorPrivate; } - class BaseToneGenerator { public: @@ -31,6 +28,7 @@ public: virtual std::size_t fill(SamplePair *begin, SamplePair *end) = 0; private: + class BaseToneGeneratorPrivate; std::unique_ptr m_private; int m_samplerate;