mirror of
https://github.com/swift-project/pilotclient.git
synced 2026-04-02 06:35:52 +08:00
[AFV] CContextAudio::m_voiceClient is a raw pointer, and CAfvClient doesn't have a parent
This commit is contained in:
@@ -38,8 +38,8 @@ namespace BlackCore
|
||||
return cats;
|
||||
}
|
||||
|
||||
CAfvClient::CAfvClient(const QString &apiServer, QObject *parent) :
|
||||
CContinuousWorker(parent, "CAfvClient"),
|
||||
CAfvClient::CAfvClient(const QString &apiServer, QObject *owner) :
|
||||
CContinuousWorker(owner, "CAfvClient"),
|
||||
m_connection(new CClientConnection(apiServer, this)),
|
||||
m_input(new CInput(SampleRate, this)),
|
||||
m_output(new Output(this)),
|
||||
|
||||
@@ -63,7 +63,7 @@ namespace BlackCore
|
||||
Q_ENUM(ConnectionStatus)
|
||||
|
||||
//! Ctor
|
||||
CAfvClient(const QString &apiServer, QObject *parent = nullptr);
|
||||
CAfvClient(const QString &apiServer, QObject *owner);
|
||||
|
||||
//! Dtor
|
||||
virtual ~CAfvClient() override { this->stopAudio(); }
|
||||
|
||||
@@ -46,11 +46,11 @@ namespace BlackCore
|
||||
Q_ASSERT_X(m_voiceClient->owner() == this, Q_FUNC_INFO, "Wrong owner");
|
||||
Q_ASSERT_X(!CThreadUtils::isApplicationThread(m_voiceClient->thread()), Q_FUNC_INFO, "Must NOT be in main thread");
|
||||
|
||||
connect(m_voiceClient.get(), &CAfvClient::outputVolumePeakVU, this, &IContextAudio::outputVolumePeakVU);
|
||||
connect(m_voiceClient.get(), &CAfvClient::inputVolumePeakVU, this, &IContextAudio::inputVolumePeakVU);
|
||||
connect(m_voiceClient.get(), &CAfvClient::receivingCallsignsChanged, this, &IContextAudio::receivingCallsignsChanged);
|
||||
connect(m_voiceClient.get(), &CAfvClient::updatedFromOwnAircraftCockpit, this, &IContextAudio::updatedFromOwnAircraftCockpit);
|
||||
connect(m_voiceClient.data(), &CAfvClient::ptt, this, &IContextAudio::ptt);
|
||||
connect(m_voiceClient, &CAfvClient::outputVolumePeakVU, this, &IContextAudio::outputVolumePeakVU);
|
||||
connect(m_voiceClient, &CAfvClient::inputVolumePeakVU, this, &IContextAudio::inputVolumePeakVU);
|
||||
connect(m_voiceClient, &CAfvClient::receivingCallsignsChanged, this, &IContextAudio::receivingCallsignsChanged);
|
||||
connect(m_voiceClient, &CAfvClient::updatedFromOwnAircraftCockpit, this, &IContextAudio::updatedFromOwnAircraftCockpit);
|
||||
connect(m_voiceClient, &CAfvClient::ptt, this, &IContextAudio::ptt);
|
||||
|
||||
const CSettings as = m_audioSettings.getThreadLocal();
|
||||
this->setVoiceOutputVolume(as.getOutVolume());
|
||||
@@ -107,7 +107,8 @@ namespace BlackCore
|
||||
{
|
||||
m_voiceClient->stopAudio();
|
||||
m_voiceClient->quitAndWait();
|
||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(m_voiceClient.data()), Q_FUNC_INFO, "Needs to be back in current thread");
|
||||
Q_ASSERT_X(CThreadUtils::isCurrentThreadObjectThread(m_voiceClient), Q_FUNC_INFO, "Needs to be back in current thread");
|
||||
m_voiceClient = nullptr;
|
||||
}
|
||||
QObject::disconnect(this);
|
||||
}
|
||||
|
||||
@@ -260,7 +260,7 @@ namespace BlackCore
|
||||
BlackMisc::CSetting<Audio::TOutputDevice> m_outputDeviceSetting { this, &IContextAudio::changeDeviceSettings };
|
||||
|
||||
// AFV
|
||||
QScopedPointer<Afv::Clients::CAfvClient> m_voiceClient;
|
||||
Afv::Clients::CAfvClient *m_voiceClient = nullptr;
|
||||
|
||||
// Players
|
||||
BlackSound::CSelcalPlayer *m_selcalPlayer = nullptr;
|
||||
|
||||
Reference in New Issue
Block a user