mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-04 08:36:52 +08:00
Refactor SECLAL player into new threaded player class
The reason for moving the implementation out from CSoundGenerator into its own class is, because CSoundGenerator was a very complex and obscure class. It mixed many tasks in one place. CSelcalPlayer is designed to play SELCALs only. The following design changes have been made, compared to CSoundGenerator: * Use pull mode instead of push mode. QBuffer is used as the QIODevice and is a wrapper around QByteArray. Therefore it is not necessary to implement our own QIODevice. * Internally it uses a CThreadedSelcalPlayer to relieve the load of the main thread. CThreadedSelcalPlayer inherits CContinuousWorker, no low level QThread implementation was necessary. * Push mode was not implemented. * It is important that the QAudioOutput is allocated in the worker thread. QAudioOutput allocates internal objects, which cannot be moved to the worker thread. * Data caching. The generated seclal audio data is cached. refs #736
This commit is contained in:
committed by
Mathew Sutcliffe
parent
1ff06a1174
commit
5486596335
@@ -86,6 +86,8 @@ namespace BlackCore
|
||||
|
||||
m_unusedVoiceChannels.push_back(m_channel1);
|
||||
m_unusedVoiceChannels.push_back(m_channel2);
|
||||
|
||||
m_selcalPlayer = new CSelcalPlayer(QAudioDeviceInfo::defaultOutputDevice(), this);
|
||||
}
|
||||
|
||||
CContextAudio *CContextAudio::registerWithDBus(CDBusServer *server)
|
||||
@@ -413,8 +415,7 @@ namespace BlackCore
|
||||
{
|
||||
Q_ASSERT(this->m_voice);
|
||||
if (m_debugEnabled) { CLogMessage(this, CLogCategory::contextSlot()).debug() << Q_FUNC_INFO << selcal; }
|
||||
CAudioDeviceInfo outputDevice = m_voiceOutputDevice->getCurrentOutputDevice();
|
||||
CSoundGenerator::playSelcal(90, selcal, outputDevice);
|
||||
m_selcalPlayer->play(90, selcal);
|
||||
}
|
||||
|
||||
void CContextAudio::playNotification(CNotificationSounds::Notification notification, bool considerSettings) const
|
||||
|
||||
@@ -28,6 +28,7 @@
|
||||
#include "blackmisc/identifier.h"
|
||||
#include "blackmisc/network/userlist.h"
|
||||
#include "blackmisc/settingscache.h"
|
||||
#include "blacksound/selcalplayer.h"
|
||||
|
||||
#include <QHash>
|
||||
#include <QList>
|
||||
@@ -181,6 +182,7 @@ namespace BlackCore
|
||||
|
||||
QList<QSharedPointer<IVoiceChannel>> m_unusedVoiceChannels;
|
||||
QHash<BlackMisc::Aviation::CComSystem::ComUnit, QSharedPointer<IVoiceChannel>> m_voiceChannelMapping;
|
||||
BlackSound::CSelcalPlayer *m_selcalPlayer = nullptr;
|
||||
|
||||
// settings
|
||||
BlackMisc::CSetting<BlackCore::Audio::TSettings> m_audioSettings { this };
|
||||
|
||||
Reference in New Issue
Block a user