Ref T730, improved threaded tone player

* allow to re-init and get device info
* mutable mutex
This commit is contained in:
Klaus Basan
2019-10-02 19:53:02 +02:00
committed by Mat Sutcliffe
parent 90e87835fc
commit 5d9ea83b93
2 changed files with 37 additions and 11 deletions

View File

@@ -39,12 +39,17 @@ namespace BlackSound
//! Destructor
virtual ~CThreadedTonePairPlayer() override;
public slots:
//! Play the list of tones.
//! If the player is currently active, this call will be ignored.
void play(int volume, const QList<BlackSound::CTonePair> &tonePairs);
protected slots:
//! Reinitialize audio
bool reinitializeAudio(const BlackMisc::Audio::CAudioDeviceInfo &device);
//! Used audio device
BlackMisc::Audio::CAudioDeviceInfo getAudioDevice() const;
protected:
//! \copydoc BlackMisc::CContinuousWorker::initialize
virtual void initialize() override;
@@ -65,10 +70,10 @@ namespace BlackSound
QAudioOutput *m_audioOutput = nullptr;
QByteArray m_bufferData;
QBuffer m_buffer;
QMutex m_mutex { QMutex::Recursive };
QAudioFormat m_audioFormat;
QMap<CTonePair, QByteArray> m_tonePairCache;
mutable QMutex m_mutex { QMutex::Recursive };
};
}
} // ns
#endif // guard